CDescriptorExamples Class Reference

List of all members.

Public Member Functions

 CDescriptorExamples (MResultViewer *aViewer)
void ToStack ()
void ToHeapL ()
void Literals ()
void NonModifyingMethods ()
void ModifyingMethodsL ()
void CharacterConversionsL ()
void LexicalAnalysis ()
void CircularBuffersL ()
void FlatDynamicBuffersL ()
void SegmentedDynamicBuffersL ()
void PackageBuffers ()
void RBufDemonstrations ()

Detailed Description

This class declares example methods that describe the usage of descriptors and related APIs.

Definition at line 67 of file DescriptorExamples.h.

Constructor & Destructor Documentation

CDescriptorExamples::CDescriptorExamples ( MResultViewer aViewer  ) 

This constructor instantiates an object whose example methods are used to demonstrate descriptors and related APIs.

aViewer MResultViewer object where results are to be written. This doesn't take ownership of given viewer so it has to be deleted after this object is no more used.

Definition at line 79 of file DescriptorExamples.h.

Member Function Documentation

void CDescriptorExamples::ToStack (  ) 

Examples in this method describes how to declare each descriptor type as an automatic variable (object allocated to stack). Following issues are covered:

  • how to declare each descriptor type to stack
  • using code blocks to deallocate unneeded automatic variables

Definition at line 39 of file DeclaringDescriptors.cpp.

void CDescriptorExamples::ToHeapL (  ) 

Examples in this method describes how to allocate descriptors from heap.

Definition at line 111 of file DeclaringDescriptors.cpp.

void CDescriptorExamples::Literals (  ) 

This example method describes how to declare literals. Following issues are covered:

  • declaring literal with macro _LIT
  • declaring literal with macro _L
  • declaring unicode characters in literals

Definition at line 147 of file DeclaringDescriptors.cpp.

void CDescriptorExamples::NonModifyingMethods (  ) 

This example demonstrates usage of non-modifying methods declared the base class of all descriptor, TDesC.

Definition at line 58 of file ManipulatingDescriptors.cpp.

void CDescriptorExamples::ModifyingMethodsL (  ) 

This example demonstrates usage modifying methods declared the base class of modifying descriptors, TDes.

Definition at line 196 of file ManipulatingDescriptors.cpp.

void CDescriptorExamples::CharacterConversionsL (  ) 

This example demonstrates how to convert string data encoded with one character set to unicode and vice versa. Conversion of SMS data is used as and example.

Definition at line 515 of file ManipulatingDescriptors.cpp.

void CDescriptorExamples::LexicalAnalysis (  ) 

This example demonstrates how numbers in string format can be parsed to binary representation.

Definition at line 683 of file ManipulatingDescriptors.cpp.

void CDescriptorExamples::CircularBuffersL (  ) 

The first example in this method demonstrates how circular buffer, First In First Out (FIFO) data structure, is used manipulate character data. Each item in the FIFO is instance of TText that is 16 bit character code unicode build and 8 bit character in non-unicode build.

The second example in this method extends the usage to a bit more complex type than a 8 or 16 bit number. An example class is used as an item in structure.

Definition at line 114 of file OtherBuffers.cpp.

void CDescriptorExamples::FlatDynamicBuffersL (  ) 

This method demonstrates how flat dynamic buffer (CBufFlat) is used to store and alter binary data. 8-bit character data is used as an example data.

Data in CBufFlat lies in one contiguous heap cell. CBufFlat extends the heap cell used to store the contents automatically when so needed. If heap cell can't extend a new cell is allocated, old data copied to new cell and old heap cell deleted.

Data is accessed and modified through base classes methods CBufBase::Read(), CBufBase::Write(), CBufBase::InsertL() and CBufBase::Delete(). Pointer access to data makes sence since data in heap cell is continuous.

Definition at line 237 of file OtherBuffers.cpp.

void CDescriptorExamples::SegmentedDynamicBuffersL (  ) 

This example demonstrates how segmented dynamic buffers (CBufSeg) are used to store and alter binary content. 8-bit character data is used as an example data.

CBufSeg splits contents to multiple heap cells having the same size. These cells are called segments of the data. CBufSeg allocates new segments automatically when data storage needs to be enlarged.

Data is accessed and modified through base classes methods CBufBase::Read(), CBufBase::Write(), CBufBase::InsertL() and CBufBase::Delete(). Pointer access is also possible but is difficult since data isn't continuous (like in case of

Definition at line 302 of file OtherBuffers.cpp.

void CDescriptorExamples::PackageBuffers (  ) 

This example method demonstrates how to declare and use package buffers and package pointers.

In typical cases the threads can't access to each others memory areas. However, interthread communication provides a way to read and write to other threads memory. The memory address given for reading or writing must be a descriptor. The actual reading and writing is done by kernel that will make sure that descriptor constraints are respected: buffer is not read or written before its starting index or after end index.

Package buffer capsulates any value object as an binary array that makes it easy pass object or structure of objects to other thread.

Definition at line 446 of file OtherBuffers.cpp.

void CDescriptorExamples::RBufDemonstrations (  ) 

Function demonstrates different usages of RBuf. It should be noted that the Create and Assign functions leak memory if the memory for the RBuf isn't freed (i.e calling Close()) before calling them. RBuf was introduced in Symbian OS 9 but was backported to Symbian OS 8.

Definition at line 498 of file OtherBuffers.cpp.

Generated by  doxygen 1.6.2