00001 /* 00002 * ============================================================================== 00003 * Name : EPos_CPosLmMultiDbSearch.h 00004 * Part of : Mobile Location Framework/Landmarks 00005 * Interface : Landmarks Search API 00006 * Description : 00007 * 00008 * Version : 1.17 2005/07/07 13:40:10 00009 * 00010 * Copyright (c) 2002-2005 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. All rights are reserved. Copying, 00014 * including reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia Corporation. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia Corporation. 00019 * 00020 * ============================================================================== 00021 */ 00022 00023 #ifndef CPOSLMMULTIDBSEARCH_H 00024 #define CPOSLMMULTIDBSEARCH_H 00025 00026 // INCLUDES 00027 #include <e32base.h> 00028 #include <badesca.h> 00029 #include <EPos_CPosLandmarkSearch.h> 00030 #include <EPos_CPosLmCategoryManager.h> 00031 00032 // CONSTANT DECLARATIONS 00033 00034 // FORWARD DECLARATIONS 00035 class CPosLmSearchCriteria; 00036 class CPosLmDisplayData; 00037 class CPosLmMultiDbSearchOperation; 00038 class CPosLmMultiDbSortPref; 00039 class CPosLmMultiDbSearchItem; 00040 00041 // CLASS DECLARATION 00042 00105 class CPosLmMultiDbSearch : public CBase 00106 { 00107 public: // Data types 00108 00114 struct TSearchError 00115 { 00116 TUint iDatabaseIndex; 00119 TInt iErrorCode; 00121 }; 00122 00123 public: // Constructors and destructor 00124 00134 IMPORT_C static CPosLmMultiDbSearch* NewL( 00135 /* IN */ const CDesCArray& aDatabaseList 00136 ); 00137 00141 IMPORT_C virtual ~CPosLmMultiDbSearch(); 00142 00143 public: // New functions 00144 00173 IMPORT_C void SetDatabasesToSearchL( 00174 /* IN */ const CDesCArray& aDatabaseList 00175 ); 00176 00183 IMPORT_C CDesCArray* DatabasesToSearchL(); 00184 00201 IMPORT_C void SetMaxNumOfMatches( 00202 /* IN */ TInt aMaxNumOfMatches = KPosLmMaxNumOfMatchesUnlimited 00203 ); 00204 00235 IMPORT_C CPosLmOperation* StartLandmarkSearchL( 00236 /* IN */ const CPosLmSearchCriteria& aCriteria, 00237 /* IN */ TBool aSearchOnlyPreviousMatches = EFalse 00238 ); 00239 00278 IMPORT_C CPosLmOperation* StartLandmarkSearchL( 00279 /* IN */ const CPosLmSearchCriteria& aCriteria, 00280 /* IN */ const TPosLmSortPref& aSortPref, 00281 /* IN */ TBool aSearchOnlyPreviousMatches = EFalse 00282 ); 00283 00313 IMPORT_C CPosLmOperation* StartCategorySearchL( 00314 /* IN */ const CPosLmSearchCriteria& aCriteria, 00315 /* IN */ CPosLmCategoryManager::TCategorySortPref aSortPref, 00316 /* IN */ TBool aSearchOnlyPreviousMatches = EFalse 00317 ); 00318 00326 IMPORT_C TUint NumOfSearchErrors() const; 00327 00340 IMPORT_C void GetSearchError( 00341 /* IN */ TUint aErrorIndex, 00342 /* OUT */ TSearchError& aSearchError 00343 ) const; 00344 00353 IMPORT_C TUint TotalNumOfMatches() const; 00354 00370 IMPORT_C TUint NumOfMatches( 00371 /* IN */ TUint aDatabaseIndex 00372 ) const; 00373 00380 IMPORT_C TUint NumOfDatabasesToSearch() const; 00381 00396 IMPORT_C TPtrC DatabaseUriPtr( 00397 /* IN */ TUint aDatabaseIndex 00398 ) const; 00399 00433 IMPORT_C CPosLmItemIterator* MatchIteratorL( 00434 /* IN */ TUint aDatabaseIndex 00435 ); 00436 00467 IMPORT_C void SetDisplayData( 00468 /* IN/OUT */ CPosLmDisplayData& aData 00469 ); 00470 00478 IMPORT_C void UnsetDisplayData(); 00479 00490 IMPORT_C TInt MaxNumOfMatches() const; 00491 00492 /* 00493 * Tells if the database with the specified database index is to be 00494 * searched or not. 00495 * 00496 * @param aDatabaseIndex The index of the database. 00497 * @return ETrue if the database is to be searched, otherwise EFalse. 00498 */ 00499 TBool ToBeSearched( 00500 /* IN */ TUint aDatabaseIndex 00501 ) const; 00502 00503 /* 00504 * Gets a pointer to the database with the specified database index. 00505 * 00506 * @param aDatabaseIndex The index of the database. 00507 * @return A pointer to the landmark database. 00508 */ 00509 CPosLandmarkDatabase* DatabaseL( 00510 /* IN */ TUint aDatabaseIndex 00511 ); 00512 00513 /* 00514 * Gets a pointer to the single search class for the database with the 00515 * specified database index. 00516 * 00517 * @param aDatabaseIndex The index of the database. 00518 * @return A pointer to the single search class. 00519 */ 00520 CPosLandmarkSearch* SearcherL( 00521 /* IN */ TUint aDatabaseIndex 00522 ); 00523 00524 /* 00525 * This method must be called to notify this class when a search has 00526 * been started in the single search class corresponding to the 00527 * specified database index. 00528 * 00529 * @param aDatabaseIndex The index of the database. 00530 */ 00531 void SearchStarted( 00532 /* IN */ TUint aDatabaseIndex 00533 ); 00534 00535 /* 00536 * This method must be called to notify this class when a search has 00537 * been executed (partly or completely) in the single search class 00538 * corresponding to the specified database index. 00539 * 00540 * @param aDatabaseIndex The index of the database. 00541 * @param aSortPref The sort pref for the search. 00542 */ 00543 void SearchExecutedL( 00544 /* IN */ TUint aDatabaseIndex, 00545 /* IN */ const CPosLmMultiDbSortPref& aSortPref 00546 ); 00547 00548 /* 00549 * Adds a search error for the specified database index. 00550 * 00551 * @param aDatabaseIndex The index of the database. 00552 * @param aErrorCode The error code. 00553 */ 00554 void AddSearchError( 00555 /* IN */ TUint aDatabaseIndex, 00556 /* IN */ TInt aErrorCode 00557 ); 00558 00559 /* 00560 * This function must be called by the CPosLmMultiDbSearchOperation 00561 * when the search operation has completed or has been cancelled. 00562 */ 00563 void HandleSearchOperationCompleted(); 00564 00565 private: 00566 00570 CPosLmMultiDbSearch(); 00571 00575 void ConstructL(const CDesCArray& aDatabaseList); 00576 00577 void CloseDbsNotToSearch(const CDesCArray& aDatabaseList); 00578 00579 CPosLmOperation* StartSearchL( 00580 /* IN */ const CPosLmSearchCriteria& aCriteria, 00581 /* IN */ CPosLmMultiDbSortPref* aSortPref, 00582 /* IN */ TBool aSearchOnlyPreviousMatches 00583 ); 00584 00585 private: // Data 00586 00587 TInt iMaxNumOfMatches; 00588 TInt iNewMaxNumOfMatches; 00589 00590 CPosLmMultiDbSearchOperation* iMultiSearchOperation; // No ownership 00591 00592 RPointerArray<CPosLmMultiDbSearchItem> iSearchItems; 00593 00594 RArray<TSearchError> iSearchErrors; // Can contain dummy errors. 00595 TUint iNoOfSearchErrors; // Number of valid errors. 00596 00597 CPosLmDisplayData* iClientDisplayData; // No ownership 00598 00599 }; 00600 00601 // CPOSLMMULTIDBSEARCH_H 00602 #endif 00603 00604 // End of File