|
Nokia N97 SDK Example Applications Guide |
#include <shapelistmanager.h>
Inheritance diagram for CShapeListManager:

Definition at line 33 of file shapelistmanager.h.
Public Member Functions |
|
| virtual IMPORT_C | ~CShapeListManager () |
| IMPORT_C void | Clear () |
| IMPORT_C void | AddShapeL (NShapes::TShape *aShape) |
| IMPORT_C NShapes::TShape * | GetNextShape () |
| IMPORT_C TStreamId | StoreL (CStreamStore &aStore) const |
| IMPORT_C void | ExternalizeL (RWriteStream &aStream) const |
| IMPORT_C void | RestoreL (const CStreamStore &aStore, const TStreamId &aStreamId) |
| IMPORT_C void | InternalizeL (RReadStream &aStream) |
Static Public Member Functions |
|
| static IMPORT_C CShapeListManager * | NewL () |
| static IMPORT_C CShapeListManager * | NewLC () |
Protected Member Functions |
|
| IMPORT_C | CShapeListManager () |
| IMPORT_C void | ConstructL () |
Private Attributes |
|
| TInt | iNextShapeIndex |
| RPointerArray< NShapes::TShape > | iShapeList |
|
|
~CShapeListManager. Virtual destructor. Definition at line 78 of file shapelistmanager.cpp. References iShapeList. 00079 { 00080 iShapeList.ResetAndDestroy(); 00081 }
|
|
|
CShapeListManager C++ default constructor. Definition at line 33 of file shapelistmanager.cpp.
|
|
|
NewL Creates a new instance of the engine.
Definition at line 43 of file shapelistmanager.cpp. References NewLC(). Referenced by CGuiEngineDocument::ConstructL(), and CGuiEngineDocument::RestoreL(). 00044 { 00045 CShapeListManager* self = NewLC(); 00046 CleanupStack::Pop( self ); 00047 return self; 00048 }
|
|
|
NewLC Creates a new instance of the engine.
Definition at line 55 of file shapelistmanager.cpp. References ConstructL(). Referenced by NewL(). 00056 { 00057 CShapeListManager* self = new ( ELeave ) CShapeListManager; 00058 CleanupStack::PushL( self ); 00059 self->ConstructL(); 00060 return self; 00061 }
|
|
|
Clear Clear the list of shapes. Definition at line 89 of file shapelistmanager.cpp. References iNextShapeIndex, and iShapeList. Referenced by CGuiEngineAppView::Clear(), and RestoreL(). 00090 { 00091 iNextShapeIndex = 0; // The first shape in the list 00092 iShapeList.ResetAndDestroy(); 00093 }
|
|
|
AddShapeL Add a shape to the list
Definition at line 100 of file shapelistmanager.cpp. References iShapeList. Referenced by CGuiEngineAppView::OfferKeyEventL(). 00101 { 00102 User::LeaveIfError( iShapeList.Append( aShape ) ); 00103 }
|
|
|
GetNextShape Returns the next shape in the list and increments the next shape index.
Definition at line 110 of file shapelistmanager.cpp. References iNextShapeIndex, and iShapeList. Referenced by CGuiEngineAppView::Draw(). 00111 { 00112 if ( iShapeList.Count() > 0) 00113 { 00114 if ( iNextShapeIndex < iShapeList.Count()) 00115 { 00116 TShape* shape = iShapeList[ iNextShapeIndex ]; 00117 ++iNextShapeIndex; 00118 return shape; 00119 } 00120 // Gone past the end, so reset the index 00121 iNextShapeIndex = 0; 00122 } 00123 return NULL; 00124 }
|
|
|
StoreL Store the instance to the specified store
Definition at line 131 of file shapelistmanager.cpp. References ExternalizeL(). Referenced by CGuiEngineDocument::StoreL(). 00132 { 00133 00134 RStoreWriteStream stream; 00135 00136 // Create a stream within the store 00137 TStreamId id = stream.CreateLC( aStore ); 00138 00139 // Write the data to the stream 00140 ExternalizeL( stream ); 00141 stream.CommitL(); 00142 00143 CleanupStack::PopAndDestroy(); // the stream 00144 00145 return id; // return the stream ID 00146 }
|
|
|
ExternalizeL Virtual method that writes the shape to the specified write stream.
Definition at line 153 of file shapelistmanager.cpp. References NShapes::TShape::ExternalizeL(), and iShapeList. Referenced by StoreL(). 00154 { 00155 00156 TInt count = iShapeList.Count(); 00157 aStream.WriteInt16L( static_cast<TInt16>( count ) ); 00158 00159 for ( TInt index = 0; index < count; ++index ) 00160 { 00161 const TShape* shape = static_cast<TShape*>( iShapeList[ index ] ); 00162 shape->ExternalizeL( aStream ); 00163 } 00164 }
|
|
||||||||||||
|
RestoreL Restore the instance from the specified stream within the specified store
Definition at line 171 of file shapelistmanager.cpp. References Clear(), and InternalizeL(). Referenced by CGuiEngineDocument::RestoreL(). 00173 { 00174 00175 Clear(); 00176 RStoreReadStream stream; 00177 00178 // Open the stream 00179 stream.OpenLC( aStore, aStreamId ); 00180 00181 // Read the data from the stream 00182 InternalizeL( stream ); 00183 00184 CleanupStack::PopAndDestroy(); // the stream 00185 }
|
|
|
InternalizeL Restore the instance from the specified stream
Definition at line 192 of file shapelistmanager.cpp. References NShapes::TShape::InternalizeL(), and iShapeList. Referenced by RestoreL(). 00193 { 00194 00195 TInt count = aStream.ReadInt16L(); 00196 for ( TInt index = 0; index < count; ++index ) 00197 { 00198 00199 TShape* shape = NULL; 00200 switch ( TShape::ReadShapeTypeL( aStream ) ) 00201 { 00202 case KRectangle: 00203 shape = new ( ELeave ) TRectangle(); 00204 break; 00205 00206 case KCircle: 00207 shape = new ( ELeave ) TCircle(); 00208 break; 00209 00210 default: 00211 User::Leave( KErrCorrupt ); 00212 } 00213 00214 00215 CleanupStack::PushL( shape ); 00216 shape->InternalizeL( aStream ); 00217 User::LeaveIfError( iShapeList.Append( shape ) ); 00218 00219 CleanupStack::Pop( shape ); // Now owned by iShapeList 00220 } 00221 }
|
|
|
ConstructL 2nd phase constructor. Definition at line 68 of file shapelistmanager.cpp. Referenced by NewLC().
|
|
|
iNextShapeIndex The index of the next shape Definition at line 137 of file shapelistmanager.h. Referenced by Clear(), and GetNextShape(). |
|
|
iShapeList The list of shapes Definition at line 140 of file shapelistmanager.h. Referenced by AddShapeL(), Clear(), ExternalizeL(), GetNextShape(), InternalizeL(), and ~CShapeListManager(). |
|
© Nokia 2009 |