emailcontacts/contactactionservice/inc/TFscStoreContactAnalyzer.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Store contact analyzer.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TFSCSTORECONTACTANALYZER_H
       
    20 #define TFSCSTORECONTACTANALYZER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32def.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CVPbkContactManager;
       
    27 class MVPbkStoreContact;
       
    28 class MVPbkContactFieldSelector;
       
    29 class MVPbkFieldTypeList;
       
    30 class MVPbkBaseContactFieldCollection;
       
    31 class MVPbkBaseContactField;
       
    32 class CVPbkFieldTypeSelector;
       
    33 class MVPbkFieldTypeSelector;
       
    34 class MVPbkFieldType;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  * Store contact analyzer.
       
    40  */
       
    41 class TFscStoreContactAnalyzer
       
    42     {
       
    43 public:
       
    44     // Constructors and destructor
       
    45 
       
    46     /**
       
    47      * Constructor.
       
    48      *
       
    49      * @param aContactManager   Virtual Phonebook contact manager.
       
    50      * @param aContact          Store contact.
       
    51      */
       
    52     TFscStoreContactAnalyzer(
       
    53             const CVPbkContactManager& aContactManager,
       
    54             const MVPbkStoreContact* aContact);
       
    55 
       
    56 public:
       
    57     // Interface
       
    58 
       
    59     /**
       
    60      * Analyses if the contact has a field with type specified
       
    61      * in aResId definition.
       
    62      *
       
    63      * @param aResId        A VPBK_FIELD_TYPE_SELECTOR resource id.
       
    64      * @param aStartIndex   Starts looking up the specified field from
       
    65      *                      this field index.
       
    66      * @param aContact      The contact to analyze. If NULL the contact
       
    67      *                      got from the constructor is used.
       
    68      * @return  Field index if contact has field specified in aResId,
       
    69      *          otherwise KErrNotFound.
       
    70      */
       
    71     TInt HasFieldL(
       
    72             TInt aResId,
       
    73             TInt aStartIndex = 0,
       
    74             const MVPbkStoreContact* aContact = NULL ) const;
       
    75 
       
    76     /**
       
    77      * Analyses if the contact supports field with type specified
       
    78      * in aResId definition.
       
    79 
       
    80      * @param aResId        A VPBK_FIELD_TYPE_SELECTOR resource id.
       
    81      * @param aContact      The contact to analyze. If NULL the
       
    82      *                      contact got from constructor is used.
       
    83      * @return  ETrue if the field type is supported by the contact,
       
    84      *          otherwise EFalse.
       
    85      */
       
    86     TBool IsFieldTypeSupportedL(
       
    87             TInt aResId,
       
    88             const MVPbkStoreContact* aContact = NULL ) const;
       
    89 
       
    90     /**
       
    91      * Checks if the aFieldType is same as specified in aResId definition.
       
    92      * Returns ETrue is same, otherwise EFalse.
       
    93      *
       
    94      * @param aFieldType   The field type to check.
       
    95      * @param aResId       Selector's resource id.
       
    96      * @return  ETrue if the field type is included.
       
    97      */
       
    98     TBool IsFieldTypeIncludedL(
       
    99             const MVPbkFieldType& aFieldType,
       
   100             TInt aResId ) const;
       
   101 
       
   102     /**
       
   103      * Checks if the aField's field type is same as specified in
       
   104      * aResId definition. Returns ETrue is same, otherwise EFalse.
       
   105      *
       
   106      * @param aField       The field whose type to check.
       
   107      * @param aResId       Selector's resource id.
       
   108      * @return  ETrue if the field type is included.
       
   109      */
       
   110     TBool IsFieldTypeIncludedL(
       
   111             const MVPbkBaseContactField& aField,
       
   112             TInt aResId ) const;
       
   113 
       
   114 private: // Implementation
       
   115     TFscStoreContactAnalyzer();
       
   116     TInt IsFieldIncluded(
       
   117             const MVPbkBaseContactFieldCollection& aFields,
       
   118             TInt aStartIndex,
       
   119             const MVPbkContactFieldSelector& aFieldTypeSelector ) const;
       
   120     TBool IsFieldTypeIncluded(
       
   121             const MVPbkFieldTypeList& aFieldTypes,
       
   122             const MVPbkFieldTypeSelector& aFieldTypeSelector ) const;
       
   123     CVPbkFieldTypeSelector* CreateFieldTypeSelectorLC(
       
   124             TInt aResId ) const;
       
   125 
       
   126 private: // Data
       
   127     /// Ref: Virtual Phonebook contact manager
       
   128     const CVPbkContactManager& iContactManager;
       
   129     /// Ref: The contact to analyze
       
   130     const MVPbkStoreContact* iContact;
       
   131     };
       
   132 
       
   133 #endif // TFSCSTORECONTACTANALYZER_H
       
   134 // End of File