epos_cposlmmultidbsearch.h

Go to the documentation of this file.
00001 /*
00002 * ==============================================================================
00003 *  Name        : EPos_CPosLmMultiDbSearch.h
00004 *  Part of     : Mobile Location Framework/Landmarks
00005 *  Interface   : Landmarks Search API
00006 *  Description :
00007 *
00008 *  Version     : %version %
00009 *
00010 *  Copyright (c) 2002-2007 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 #include <e32base.h>
00027 #include <badesca.h>
00028 #include <epos_cposlandmarksearch.h>
00029 #include <epos_cposlmcategorymanager.h>
00030 
00031 class CPosLmSearchCriteria;
00032 class CPosLmDisplayData;
00033 class CPosLmMultiDbSearchOperation;
00034 class CPosLmMultiDbSortPref;
00035 class CPosLmMultiDbSearchItem;
00036 
00099 class CPosLmMultiDbSearch : public CBase
00100     {
00101     public:  // Data types
00102 
00106         struct TSearchError
00107             {
00108             TUint iDatabaseIndex; 
00111             TInt iErrorCode; 
00113             };
00114 
00115     public:  // Constructors and destructor
00116 
00126         IMPORT_C static CPosLmMultiDbSearch* NewL( const CDesCArray&  aDatabaseList );
00127 
00131         IMPORT_C virtual ~CPosLmMultiDbSearch();
00132 
00133     public: // New functions
00134 
00163         IMPORT_C void SetDatabasesToSearchL( const CDesCArray&  aDatabaseList );
00164 
00171         IMPORT_C CDesCArray* DatabasesToSearchL();
00172 
00189         IMPORT_C void SetMaxNumOfMatches( TInt  aMaxNumOfMatches = KPosLmMaxNumOfMatchesUnlimited );
00190 
00221         IMPORT_C CPosLmOperation* StartLandmarkSearchL(
00222             const CPosLmSearchCriteria&  aCriteria,
00223             TBool  aSearchOnlyPreviousMatches = EFalse );
00224 
00263         IMPORT_C CPosLmOperation* StartLandmarkSearchL(
00264             const CPosLmSearchCriteria&  aCriteria,
00265             const TPosLmSortPref&  aSortPref,
00266             TBool  aSearchOnlyPreviousMatches = EFalse );
00267 
00297         IMPORT_C CPosLmOperation* StartCategorySearchL(
00298             const CPosLmSearchCriteria&  aCriteria,
00299             CPosLmCategoryManager::TCategorySortPref  aSortPref,
00300             TBool  aSearchOnlyPreviousMatches = EFalse );
00301 
00309         IMPORT_C TUint NumOfSearchErrors() const;
00310 
00323         IMPORT_C void GetSearchError(
00324             TUint  aErrorIndex,
00325             TSearchError&  aSearchError ) const;
00326 
00335         IMPORT_C TUint TotalNumOfMatches() const;
00336 
00352         IMPORT_C TUint NumOfMatches( TUint aDatabaseIndex ) const;
00353 
00360         IMPORT_C TUint NumOfDatabasesToSearch() const;
00361 
00376         IMPORT_C TPtrC DatabaseUriPtr( TUint aDatabaseIndex ) const;
00377 
00411         IMPORT_C CPosLmItemIterator* MatchIteratorL( TUint aDatabaseIndex );
00412 
00443         IMPORT_C void SetDisplayData( CPosLmDisplayData& aData );
00444 
00452         IMPORT_C void UnsetDisplayData();
00453 
00464         IMPORT_C TInt MaxNumOfMatches() const;
00465 
00466         /*
00467         * Tells if the database with the specified database index is to be
00468         * searched or not.
00469         *
00470         * @param aDatabaseIndex The index of the database.
00471         * @return ETrue if the database is to be searched, otherwise EFalse.
00472         */
00473         TBool ToBeSearched( TUint aDatabaseIndex ) const;
00474 
00475         /*
00476         * Gets a pointer to the database with the specified database index.
00477         *
00478         * @param aDatabaseIndex The index of the database.
00479         * @return A pointer to the landmark database.
00480         */
00481         CPosLandmarkDatabase* DatabaseL( TUint aDatabaseIndex );
00482 
00483         /*
00484         * Gets a pointer to the single search class for the database with the
00485         * specified database index.
00486         *
00487         * @param aDatabaseIndex The index of the database.
00488         * @return A pointer to the single search class.
00489         */
00490         CPosLandmarkSearch* SearcherL( TUint aDatabaseIndex );
00491 
00492         /*
00493         * This method must be called to notify this class when a search has
00494         * been started in the single search class corresponding to the
00495         * specified database index.
00496         *
00497         * @param aDatabaseIndex The index of the database.
00498         */
00499         void SearchStarted( TUint aDatabaseIndex );
00500 
00501         /*
00502         * This method must be called to notify this class when a search has
00503         * been executed (partly or completely) in the single search class
00504         * corresponding to the specified database index.
00505         *
00506         * @param[in] aDatabaseIndex The index of the database.
00507         * @param[in] aSortPref The sort pref for the search.
00508         */
00509         void SearchExecutedL(
00510             TUint aDatabaseIndex,
00511             const CPosLmMultiDbSortPref& aSortPref );
00512 
00513         /*
00514         * Adds a search error for the specified database index.
00515         *
00516         * @param aDatabaseIndex The index of the database.
00517         * @param aErrorCode The error code.
00518         */
00519         void AddSearchError( TUint aDatabaseIndex, TInt aErrorCode );
00520 
00521         /*
00522         * This function must be called by the CPosLmMultiDbSearchOperation
00523         * when the search operation has completed or has been cancelled.
00524         */
00525         void HandleSearchOperationCompleted();
00526 
00527     private:
00528 
00532         CPosLmMultiDbSearch();
00533 
00537         void ConstructL(const CDesCArray& aDatabaseList);
00538 
00539         void CloseDbsNotToSearch(const CDesCArray& aDatabaseList);
00540 
00541         CPosLmOperation* StartSearchL(
00542             const CPosLmSearchCriteria& aCriteria,
00543             CPosLmMultiDbSortPref* aSortPref,
00544             TBool aSearchOnlyPreviousMatches );
00545 
00546     private:    // Data
00547 
00548         TInt                    iMaxNumOfMatches;
00549         TInt                    iNewMaxNumOfMatches;
00550 
00551         CPosLmMultiDbSearchOperation* iMultiSearchOperation; // No ownership
00552 
00553         RPointerArray<CPosLmMultiDbSearchItem> iSearchItems;
00554 
00555         RArray<TSearchError>    iSearchErrors; // Can contain dummy errors.
00556         TUint                   iNoOfSearchErrors; // Number of valid errors.
00557 
00558         CPosLmDisplayData*      iClientDisplayData; // No ownership
00559 
00560     };
00561 
00562 // CPOSLMMULTIDBSEARCH_H
00563 #endif
00564 

Copyright © Nokia Corporation 2001-2008
Back to top