|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <LandmarksApplicationEngine.h>
Public Member Functions | |
| ~CLandmarksApplicationEngine () | |
| void | NotifyViewActivated (TUid aViewId, TBool aIsActive) |
| TBool | StartInitializeDbIfNecessaryL (MLandmarksOperationObserver *aObserver) |
| void | AddDbObserverL (MLandmarksDbObserver *aObserver) |
| CPosLandmark * | LandmarkLC (TPosLmItemId aItemId) |
| void | CommitLandmarkL (const CPosLandmark &aLandmark) |
| void | DeleteLandmarkL (TPosLmItemId aItemId) |
| void | AddLandmarkL (CPosLandmark &aLandmark) |
| void | StartSearchingLandmarksL (MLandmarksOperationObserver *aObserver) |
| void | StartSearchingLandmarksL (const TDesC &aSearchPattern, TBool aSearchOnlyInPreviousMatches, MLandmarksOperationObserver *aObserver) |
| RArray< TPosLmItemId > * | FetchLandmarkSearchResult () |
| void | StartReadingLandmarksL (TInt aNrOfItemsToReadPerBundle, MLandmarksOperationObserver *aObserver) |
| CArrayPtr< CPosLandmark > * | FetchLandmarksLC () |
| CPosLandmarkCategory * | CategoryLC (TPosLmItemId aItemId) |
| void | DeleteCategoryL (TPosLmItemId aItemId) |
| void | UpdateCategoryL (const CPosLandmarkCategory &aCategory) |
| void | AddCategoryL (CPosLandmarkCategory &aCategory) |
| void | StartSearchingCategoriesL (MLandmarksOperationObserver *aObserver) |
| void | StartSearchingCategoriesL (const TDesC &aSearchPattern, TBool aSearchOnlyInPreviousMatches, MLandmarksOperationObserver *aObserver) |
| RArray< TPosLmItemId > * | FetchCategorySearchResult () |
| void | StartReadingCategoriesL (TInt aNrOfItemsToReadPerBundle, MLandmarksOperationObserver *aObserver) |
| CArrayPtr< CPosLandmarkCategory > * | FetchCategoriesLC () |
| CArrayPtr< CPosLandmarkCategory > * | CategoriesL () |
Static Public Member Functions | |
| static CLandmarksApplicationEngine * | NewL () |
Private Member Functions | |
| CLandmarksApplicationEngine () | |
| void | ConstructL () |
| void | CompactIfNeededL () |
Private Attributes | |
| CPosLandmarkDatabase * | iDb |
| Default landmark database. | |
| CLandmarksEngine * | iLandmarksEngine |
| Landmarks engine part. | |
| CLandmarksCategoriesEngine * | iCategoriesEngine |
| Categories engine part. | |
| CLandmarksDbEventHandler * | iDbEventHandler |
| Database event handler. | |
CLandmarksApplicationEngine is the only engine class UI-components need to interact with. It uses the default landmark database for reading/writing landmarks and categories.
Definition at line 46 of file LandmarksApplicationEngine.h.
|
|
Destructor. Definition at line 66 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, iDb, iDbEventHandler, and iLandmarksEngine. 00067 { 00068 delete iLandmarksEngine; 00069 delete iCategoriesEngine; 00070 delete iDbEventHandler; 00071 delete iDb; 00072 }
|
|
|
C++ default constructor. Definition at line 34 of file LandmarksApplicationEngine.cpp.
|
|
|
Two-phased constructor.
Definition at line 55 of file LandmarksApplicationEngine.cpp. References CLandmarksApplicationEngine(). 00056 { 00057 CLandmarksApplicationEngine* self = 00058 new (ELeave) CLandmarksApplicationEngine(); 00059 CleanupStack::PushL(self); 00060 self->ConstructL(); 00061 CleanupStack::Pop(self); 00062 return self; 00063 }
|
|
||||||||||||
|
NotifyViewActivated notifies the engine which view is in focus. Should be called by views when they are activated/deactivated. This makes it possible for the engine to prioritize its asynchronous operations.
Definition at line 81 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, iLandmarksEngine, and CLandmarksEngineBase::SetPrio(). 00084 { 00085 if (aViewId.iUid == ELandmarksViewId) 00086 { 00087 if (aIsActive) 00088 { 00089 iLandmarksEngine->SetPrio(CActive::EPriorityStandard); 00090 } 00091 else 00092 { 00093 iLandmarksEngine->SetPrio(CActive::EPriorityLow); 00094 } 00095 } 00096 else if (aViewId.iUid == ELandmarksCategoriesViewId) 00097 { 00098 if (aIsActive) 00099 { 00100 iCategoriesEngine->SetPrio(CActive::EPriorityStandard); 00101 } 00102 else 00103 { 00104 iCategoriesEngine->SetPrio(CActive::EPriorityLow); 00105 } 00106 } 00107 }
|
|
|
StartInitializeDbIfNecessaryL indicates if the default database needs to be initialised before it can be used. If it needs to be initialized the initialization is started immediately and the supplied observer is notified when initialization is ready.
Definition at line 115 of file LandmarksApplicationEngine.cpp. References iLandmarksEngine, and CLandmarksEngine::StartInitializeDbIfNecessaryL(). 00117 { 00118 return iLandmarksEngine->StartInitializeDbIfNecessaryL(aObserver); 00119 }
|
|
|
AddDbObserverL registers the supplied observer as observer of database events.
Definition at line 127 of file LandmarksApplicationEngine.cpp. References CLandmarksDbEventHandler::AddObserverL(), iDb, and iDbEventHandler. 00129 { 00130 if (!iDbEventHandler) 00131 { 00132 iDbEventHandler = new (ELeave) CLandmarksDbEventHandler(*iDb); 00133 } 00134 iDbEventHandler->AddObserverL(aObserver); 00135 }
|
|
|
LandmarkLC reads all fields of a landmark in the default landmark database. Ownership of the returned landmark is transferred to the caller.
Definition at line 143 of file LandmarksApplicationEngine.cpp. References iDb. 00144 { 00145 return iDb->ReadLandmarkLC(aItemId); 00146 }
|
|
|
CommitLandmarkL commits a modified landmark.
Definition at line 154 of file LandmarksApplicationEngine.cpp. References CLandmarksEngine::CommitLandmarkL(), CompactIfNeededL(), iCategoriesEngine, and iLandmarksEngine. 00156 { 00157 // We need to cancel any search/read operation in any view engine. 00158 // Otherwise database will be locked. 00159 iLandmarksEngine->Cancel(); 00160 iCategoriesEngine->Cancel(); 00161 00162 iLandmarksEngine->CommitLandmarkL(aLandmark); 00163 CompactIfNeededL(); 00164 }
|
|
|
DeleteLandmarkL deletes a landmark.
Definition at line 172 of file LandmarksApplicationEngine.cpp. References CompactIfNeededL(), CLandmarksEngine::DeleteLandmarkL(), iCategoriesEngine, and iLandmarksEngine. 00173 { 00174 // We need to cancel any search/read operation in any view engine. 00175 // Otherwise database will be locked. 00176 iLandmarksEngine->Cancel(); 00177 iCategoriesEngine->Cancel(); 00178 00179 iLandmarksEngine->DeleteLandmarkL(aItemId); 00180 CompactIfNeededL(); 00181 }
|
|
|
AddLandmarkL adds a landmark to the database.
Definition at line 189 of file LandmarksApplicationEngine.cpp. References CLandmarksEngine::AddLandmarkL(), CompactIfNeededL(), iCategoriesEngine, and iLandmarksEngine. 00190 { 00191 // We need to cancel any search/read operation in any view engine. 00192 // Otherwise database will be locked. 00193 iLandmarksEngine->Cancel(); 00194 iCategoriesEngine->Cancel(); 00195 00196 iLandmarksEngine->AddLandmarkL(aLandmark); 00197 CompactIfNeededL(); 00198 }
|
|
|
StartSearchingLandmarksL starts an asynchronous search operation for landmarks. When the search completes the supplied observer is notified and it is supposed to fetch the matches by calling FetchLandmarkSearchResult(). All landmarks in the database are returned.
Definition at line 206 of file LandmarksApplicationEngine.cpp. References iLandmarksEngine, and CLandmarksEngine::StartSearchingLandmarksL(). 00208 { 00209 iLandmarksEngine->StartSearchingLandmarksL(aObserver); 00210 }
|
|
||||||||||||||||
|
StartSearchingLandmarksL starts an asynchronous search operation for landmarks. The names of the landmarks are used as criterion for a match. When the search completes the supplied observer is notified and it is supposed to fetch the matches by calling FetchLandmarkSearchResult().
Definition at line 218 of file LandmarksApplicationEngine.cpp. References iLandmarksEngine, and CLandmarksEngine::StartSearchingLandmarksL(). 00222 { 00223 iLandmarksEngine->StartSearchingLandmarksL( 00224 aSearchPattern, 00225 aSearchOnlyInPreviousMatches, 00226 aObserver); 00227 }
|
|
|
FetchLandmarkSearchResult should be called after a successful landmark search operation. It returns the matches from the previous landmark search operation. Ownership of the returened array is kept by this class.
Definition at line 235 of file LandmarksApplicationEngine.cpp. References CLandmarksEngine::FetchSearchResult(), and iLandmarksEngine. 00236 { 00237 return iLandmarksEngine->FetchSearchResult(); 00238 }
|
|
||||||||||||
|
StartReadingLandmarksL should be called after a successful landmark search operation. It continously reads a number of landmarks partially, i.e. only the name and the icon of the landmarks are read, until all landmarks found in a previous search operation are read. The method is asynchronous and every time a number of landmarks are read the supplied observer is notified, FetchLandmarksLC should be called to fetch the read landmarks.
Definition at line 246 of file LandmarksApplicationEngine.cpp. References iLandmarksEngine, and CLandmarksEngine::StartReadingLandmarksL(). 00249 { 00250 iLandmarksEngine->StartReadingLandmarksL( 00251 aNrOfItemsToReadPerBundle, 00252 aObserver); 00253 }
|
|
|
FetchLandmarksLC should be called after a successful landmark read operation. It returns the landmarks that were partially read during a preceding landmark read operation. Ownership of the returned array is transferred to the caller.
Definition at line 261 of file LandmarksApplicationEngine.cpp. References CLandmarksEngine::FetchLandmarksLC(), and iLandmarksEngine. 00262 { 00263 return iLandmarksEngine->FetchLandmarksLC(); 00264 }
|
|
|
CategoryLC reads all fields of a category in the default landmark database. Ownership of the returned category is transferred to the caller.
Definition at line 272 of file LandmarksApplicationEngine.cpp. References CLandmarksCategoriesEngine::CategoryLC(), and iCategoriesEngine. 00274 { 00275 return iCategoriesEngine->CategoryLC(aItemId); 00276 }
|
|
|
DeleteCategoryL deletes a category.
Definition at line 284 of file LandmarksApplicationEngine.cpp. References CompactIfNeededL(), CLandmarksCategoriesEngine::DeleteCategoryL(), iCategoriesEngine, and iLandmarksEngine. 00285 { 00286 // We need to cancel any search/read operation in any view engine. 00287 // Otherwise database will be locked. 00288 iLandmarksEngine->Cancel(); 00289 iCategoriesEngine->Cancel(); 00290 00291 iCategoriesEngine->DeleteCategoryL(aItemId); 00292 CompactIfNeededL(); 00293 }
|
|
|
UpdateCategoryL updates a modified category.
Definition at line 301 of file LandmarksApplicationEngine.cpp. References CompactIfNeededL(), iCategoriesEngine, iLandmarksEngine, and CLandmarksCategoriesEngine::UpdateCategoryL(). 00303 { 00304 // We need to cancel any search/read operation in any view engine. 00305 // Otherwise database will be locked. 00306 iLandmarksEngine->Cancel(); 00307 iCategoriesEngine->Cancel(); 00308 00309 iCategoriesEngine->UpdateCategoryL(aCategory); 00310 CompactIfNeededL(); 00311 }
|
|
|
AddCategoryL adds a category to the default database.
Definition at line 319 of file LandmarksApplicationEngine.cpp. References CLandmarksCategoriesEngine::AddCategoryL(), CompactIfNeededL(), iCategoriesEngine, and iLandmarksEngine. 00320 { 00321 // We need to cancel any search/read operation in any view engine. 00322 // Otherwise database will be locked. 00323 iLandmarksEngine->Cancel(); 00324 iCategoriesEngine->Cancel(); 00325 00326 iCategoriesEngine->AddCategoryL(aCategory); 00327 CompactIfNeededL(); 00328 }
|
|
|
StartSearchingCategoriesL starts an asynchronous search operation for categories. When the search completes the supplied observer is notified and it is supposed to fetch the matches by calling FetchCategorySearchResult. All categoiries in the database are returned.
Definition at line 353 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, and CLandmarksCategoriesEngine::StartSearchingCategoriesL(). 00355 { 00356 iCategoriesEngine->StartSearchingCategoriesL(aObserver); 00357 }
|
|
||||||||||||||||
|
StartSearchingCategoriesL starts an asynchronous search operation for categories. The names of the categories are used as criterion for a match. When the search completes the supplied observer is notified and it is supposed to fetch the matches by calling FetchLandmarkSearchResult().
Definition at line 336 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, and CLandmarksCategoriesEngine::StartSearchingCategoriesL(). 00340 { 00341 iCategoriesEngine->StartSearchingCategoriesL( 00342 aSearchPattern, 00343 aSearchOnlyInPreviousMatches, 00344 aObserver); 00345 }
|
|
|
FetchCategorySearchResult should be called after a successful category search operation. It returns the matches from the previous category search operation. Ownership of the returned array is kept by this class.
Definition at line 365 of file LandmarksApplicationEngine.cpp. References CLandmarksCategoriesEngine::FetchSearchResult(), and iCategoriesEngine. 00366 { 00367 return iCategoriesEngine->FetchSearchResult(); 00368 }
|
|
||||||||||||
|
StartReadingCategoriesL should be called after a successful category search operation. It continously reads a number of categories until all landmarks found in a previous search operation are read. The method is asynchronous and every time a number of categories are read the supplied observer is notified. FetchLandmarksLC should be called to fetch the read categories.
Definition at line 376 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, and CLandmarksCategoriesEngine::StartReadingCategoriesL(). 00379 { 00380 iCategoriesEngine->StartReadingCategoriesL( 00381 aNrOfItemsToReadPerBundle, aObserver); 00382 }
|
|
|
FetchCategoriesLC should be called after a successful category read operation. It returns the categories that were read during a preceding landmark read operation. Ownership of teh returned array is transferred to the caller.
Definition at line 390 of file LandmarksApplicationEngine.cpp. References CLandmarksCategoriesEngine::FetchCategoriesLC(), and iCategoriesEngine. 00391 { 00392 return iCategoriesEngine->FetchCategoriesLC(); 00393 }
|
|
|
CategoriesL reads all categories in the default database synchronously. Ownership of the returned array is transferred to the caller.
Definition at line 401 of file LandmarksApplicationEngine.cpp. References CLandmarksCategoriesEngine::CategoriesL(), and iCategoriesEngine. 00402 { 00403 return iCategoriesEngine->CategoriesL(); 00404 }
|
|
|
By default Symbian 2nd phase constructor is private. Definition at line 43 of file LandmarksApplicationEngine.cpp. References iCategoriesEngine, iDb, iLandmarksEngine, CLandmarksCategoriesEngine::NewL(), and CLandmarksEngine::NewL(). 00044 { 00045 iDb = CPosLandmarkDatabase::OpenL(); 00046 iLandmarksEngine = CLandmarksEngine::NewL(*iDb); 00047 iCategoriesEngine = CLandmarksCategoriesEngine::NewL(*iDb); 00048 }
|
|
|
CompactIfNeededL compacts the database synchronously if necessary. Definition at line 412 of file LandmarksApplicationEngine.cpp. References iDb. 00413 { 00414 CPosLandmarkDatabase::TSize dbSize = iDb->SizeL(); 00415 if (dbSize.iUsage < KDbUsageLimit) 00416 { 00417 ExecuteAndDeleteLD(iDb->CompactL()); 00418 } 00419 }
|
|
© Nokia 2006 |