phonebookengines/VirtualPhonebook/VPbkCntModel/inc/CContactStoreDomain.h
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Maps a Contact Model databases to a virtual Phonebook contact.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VPBKCNTMODEL_CCONTACTSTOREDOMAIN_H
       
    20 #define VPBKCNTMODEL_CCONTACTSTOREDOMAIN_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include "CVPbkContactStoreDomain.h"
       
    27 
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class TVPbkContactStoreUriPtr;
       
    31 class CVPbkContactStoreUriArray;
       
    32 class CVPbkContactStoreList;
       
    33 class CVPbkContactOperationFactory;
       
    34 class RSharedDataClient;
       
    35 
       
    36 namespace VPbkEngUtils
       
    37     {
       
    38     class CTextStore;
       
    39     }
       
    40 
       
    41 namespace VPbkCntModel {
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class CFieldTypeMap;
       
    45 class CContact;
       
    46 class CFieldFactory;
       
    47 class CAsyncContactOperation;
       
    48 
       
    49 // CLASS DECLARATIONS
       
    50 
       
    51 /**
       
    52  * Maps a Contact Model databases to a virtual Phonebook contact.
       
    53  */
       
    54 NONSHARABLE_CLASS( CContactStoreDomain ): 
       
    55         public CVPbkContactStoreDomain
       
    56     {
       
    57     public:  // Constructor and destructor
       
    58         /**
       
    59          * Creates a new instance of this class.
       
    60          *
       
    61          * @param aURIList              List of filename URI of the Contact Model database to map.
       
    62          * @param aURIDomain            URI domain names
       
    63          * @param aMasterFieldTypeList  Master field type list of vpbk.
       
    64          * @param aFieldTypeMap         Field type mapper. Ownership is transferred to 
       
    65          *                              this object in the end of this function.
       
    66          * @return A new instance of this class.
       
    67          */
       
    68         static CContactStoreDomain* NewL
       
    69             (const CVPbkContactStoreUriArray& aURIList, 
       
    70             const TDesC& aURIDomain,
       
    71             const MVPbkFieldTypeList& aMasterFieldTypeList,
       
    72             CFieldTypeMap* aFieldTypeMap);
       
    73 
       
    74         /**
       
    75          * Creates a new instance of this class. 
       
    76          * Only for ECom use.
       
    77          *
       
    78          * @param aParam   ecom paramater.
       
    79          */
       
    80         static CContactStoreDomain* NewL(TAny* aParam);
       
    81 
       
    82         ~CContactStoreDomain();
       
    83 
       
    84     public:  // New functions
       
    85         /**
       
    86          * Returns the field type map to use for mapping Contact Model field
       
    87          * types to Virtual Phonebook field types.
       
    88          */
       
    89         const CFieldTypeMap& FieldTypeMap() const;
       
    90 
       
    91         /**
       
    92          * Returns the file server session.
       
    93          */
       
    94         RFs& FsSession() const;
       
    95 
       
    96         /**
       
    97          * Returns the master field type list.
       
    98          */
       
    99         const MVPbkFieldTypeList& MasterFieldTypeList() const;
       
   100 
       
   101         /**
       
   102          * Return shared data client.
       
   103          * @return shared data client pointer or NULL.
       
   104          */
       
   105         RSharedDataClient* SharedDataClient() const;        
       
   106 
       
   107     public: // from CVPbkContactStoreDomain
       
   108         const TDesC& UriDomain() const;
       
   109         void LoadContactStoreL(const TVPbkContactStoreUriPtr& aUri);
       
   110         MVPbkContactOperation* CreateContactRetrieverL(
       
   111                 const MVPbkContactLink& aLink,
       
   112                 MVPbkSingleContactOperationObserver& aObserver);
       
   113         MVPbkContactOperation* CreateDeleteContactsOperationL(
       
   114                 const MVPbkContactLinkArray& aContactLinks, 
       
   115                 MVPbkBatchOperationObserver& aObserver);
       
   116         MVPbkContactOperation* CreateCommitContactsOperationL(
       
   117                 const TArray<MVPbkStoreContact*>& aContacts,
       
   118                 MVPbkBatchOperationObserver& aObserver);
       
   119         MVPbkContactOperation* CreateMatchPhoneNumberOperationL(
       
   120                 const TDesC& aPhoneNumber, 
       
   121                 TInt aMaxMatchDigits,
       
   122                 MVPbkContactFindObserver& aObserver);
       
   123         MVPbkContactOperation* CreateFindOperationL(
       
   124                 const TDesC& aSearchString, 
       
   125                 const MVPbkFieldTypeList& aFieldTypes,
       
   126                 MVPbkContactFindObserver& aObserver);
       
   127         MVPbkContactOperation* CreateFindOperationL(
       
   128                 const MDesC16Array& aSearchStrings, 
       
   129                 const MVPbkFieldTypeList& aFieldTypes, 
       
   130                 MVPbkContactFindFromStoresObserver& aObserver, 
       
   131                 const TCallBack& aWordParserCallBack );
       
   132         
       
   133         TAny* ContactOperationFactoryExtension( TUid aExtensionUid );
       
   134         
       
   135         MVPbkContactOperation* CreateFindOperationL(
       
   136 		        const MDesC16Array& aSearchStrings, 
       
   137 		        const MVPbkFieldTypeList& aFieldTypes, 
       
   138 		        MVPbkContactFindFromStoresObserver& aObserver, 
       
   139 		        const TCallBack& aWordParserCallBack,
       
   140 		        const CDesC16ArrayFlat& aStoreEntriesArray );
       
   141 
       
   142         MVPbkContactOperation* CreateCompressStoresOperationL(
       
   143         		MVPbkBatchOperationObserver& aObserver);
       
   144 
       
   145         TInt Count() const;
       
   146         MVPbkContactStore& At(TInt aIndex) const;
       
   147         MVPbkContactStore* Find(const TVPbkContactStoreUriPtr& aUri) const;
       
   148         void OpenAllL(MVPbkContactStoreListObserver& aObserver);
       
   149         void CloseAll(MVPbkContactStoreListObserver& aObserver);
       
   150 
       
   151     private:  // Implementation
       
   152         CContactStoreDomain(const MVPbkFieldTypeList& aMasterFieldTypeList);
       
   153         void ConstructL(const CVPbkContactStoreUriArray& aURIList, 
       
   154                 const TDesC& aURIDomain,
       
   155                 CFieldTypeMap* aFieldTypeMap);
       
   156 
       
   157     private:  // Data
       
   158         ///Own: this domains URI domain name
       
   159         HBufC* iDomainDescriptor;
       
   160         ///Own: Contact model to VPbk field type mapping
       
   161         CFieldTypeMap* iFieldTypeMap;
       
   162         ///Own: list of stores in this domain
       
   163         CVPbkContactStoreList* iContactStoreList;
       
   164         ///Own: a factory for creating multioperations
       
   165         CVPbkContactOperationFactory* iOperationFactory;
       
   166         ///Ref: Master field type list
       
   167         const MVPbkFieldTypeList& iMasterFieldTypeList;
       
   168         ///Own: File server session shared among stores
       
   169         RFs iFs;
       
   170         ///Own: Text storage for extension names
       
   171         VPbkEngUtils::CTextStore* iTextStore;        
       
   172         ///Own: Shared data client
       
   173         RSharedDataClient* iSharedDataClient;
       
   174 
       
   175     };
       
   176 
       
   177 
       
   178 // INLINE FUNCTIONS
       
   179 
       
   180 inline const CFieldTypeMap& CContactStoreDomain::FieldTypeMap() const
       
   181     {
       
   182     return *iFieldTypeMap;
       
   183     }
       
   184 
       
   185 inline RFs& CContactStoreDomain::FsSession() const
       
   186     {
       
   187     return const_cast<RFs&>(iFs);
       
   188     }
       
   189 
       
   190 inline const MVPbkFieldTypeList& CContactStoreDomain::MasterFieldTypeList() const
       
   191     {
       
   192     return iMasterFieldTypeList;
       
   193     }
       
   194 
       
   195 inline RSharedDataClient* CContactStoreDomain::SharedDataClient() const
       
   196     {
       
   197     return iSharedDataClient;
       
   198     }
       
   199 
       
   200 } // namespace VPbkCntModel
       
   201 
       
   202 #endif  // VPBKCNTMODEL_CCONTACTSTOREDOMAIN_H
       
   203 
       
   204 //End of file
       
   205 
       
   206