author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
/* |
williamr@4 | 2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 3 |
* All rights reserved. |
williamr@4 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@4 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 8 |
* |
williamr@4 | 9 |
* Initial Contributors: |
williamr@4 | 10 |
* Nokia Corporation - initial contribution. |
williamr@4 | 11 |
* |
williamr@4 | 12 |
* Contributors: |
williamr@4 | 13 |
* |
williamr@4 | 14 |
* Description: A filtered and sorted collection of contact fields. |
williamr@4 | 15 |
* |
williamr@4 | 16 |
*/ |
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
#ifndef CVPBKFIELDFILTER_H |
williamr@4 | 20 |
#define CVPBKFIELDFILTER_H |
williamr@4 | 21 |
|
williamr@4 | 22 |
// INCLUDES |
williamr@4 | 23 |
#include <e32base.h> |
williamr@4 | 24 |
#include <mvpbkstorecontactfieldcollection.h> |
williamr@4 | 25 |
|
williamr@4 | 26 |
// FORWARD DECLARATIONS |
williamr@4 | 27 |
class MVPbkContactFieldSelector; |
williamr@4 | 28 |
class MVPbkContactFieldOrdering; |
williamr@4 | 29 |
|
williamr@4 | 30 |
|
williamr@4 | 31 |
/** |
williamr@4 | 32 |
* A filtered and sorted collection of Virtual Phonebook contact fields. |
williamr@4 | 33 |
*/ |
williamr@4 | 34 |
class CVPbkFieldFilter : |
williamr@4 | 35 |
public CBase, |
williamr@4 | 36 |
public MVPbkStoreContactFieldCollection |
williamr@4 | 37 |
{ |
williamr@4 | 38 |
public: // Types |
williamr@4 | 39 |
/** |
williamr@4 | 40 |
* CVPbkFieldFilter configuration. This configuration class is |
williamr@4 | 41 |
* used to configure the field filter. |
williamr@4 | 42 |
*/ |
williamr@4 | 43 |
class TConfig |
williamr@4 | 44 |
{ |
williamr@4 | 45 |
public: |
williamr@4 | 46 |
/** |
williamr@4 | 47 |
* Constructor. |
williamr@4 | 48 |
* |
williamr@4 | 49 |
* @param aBaseFields Mandatory base field set to filter. |
williamr@4 | 50 |
* @param aFieldSelector Optional field selector instance. |
williamr@4 | 51 |
* @param aFieldOrdering Optional field ordering instance. |
williamr@4 | 52 |
*/ |
williamr@4 | 53 |
inline TConfig ( |
williamr@4 | 54 |
MVPbkStoreContactFieldCollection& aBaseFields, |
williamr@4 | 55 |
MVPbkContactFieldSelector* aFieldSelector = NULL, |
williamr@4 | 56 |
MVPbkContactFieldOrdering* aFieldOrdering = NULL); |
williamr@4 | 57 |
|
williamr@4 | 58 |
public: |
williamr@4 | 59 |
///Ref: Base field collection that is filtered |
williamr@4 | 60 |
MVPbkStoreContactFieldCollection& iBaseFields; |
williamr@4 | 61 |
///Ref: A field selector |
williamr@4 | 62 |
MVPbkContactFieldSelector* iFieldSelector; |
williamr@4 | 63 |
///Ref: Field sorter |
williamr@4 | 64 |
MVPbkContactFieldOrdering* iFieldOrdering; |
williamr@4 | 65 |
///Ref: Spare for future extension |
williamr@4 | 66 |
TAny* iSpare; |
williamr@4 | 67 |
}; |
williamr@4 | 68 |
|
williamr@4 | 69 |
public: // Constructor and Destructor |
williamr@4 | 70 |
/** |
williamr@4 | 71 |
* Creates and returns a new instance of this class. |
williamr@4 | 72 |
* |
williamr@4 | 73 |
* @param aConfig Field filtering configuration. |
williamr@4 | 74 |
*/ |
williamr@4 | 75 |
IMPORT_C static CVPbkFieldFilter* NewL(const TConfig& aConfig); |
williamr@4 | 76 |
|
williamr@4 | 77 |
/** |
williamr@4 | 78 |
* Destructor. |
williamr@4 | 79 |
*/ |
williamr@4 | 80 |
~CVPbkFieldFilter(); |
williamr@4 | 81 |
|
williamr@4 | 82 |
public: // Interface |
williamr@4 | 83 |
/** |
williamr@4 | 84 |
* Reset the contents of this filtered field collection according |
williamr@4 | 85 |
* to a new configuration. |
williamr@4 | 86 |
* |
williamr@4 | 87 |
* @param aConfig Filtering configuration to rest to. |
williamr@4 | 88 |
*/ |
williamr@4 | 89 |
IMPORT_C void ResetL(const TConfig& aConfig); |
williamr@4 | 90 |
|
williamr@4 | 91 |
/** |
williamr@4 | 92 |
* Finds given field from the set of filtered fields |
williamr@4 | 93 |
* @param aContactField Field to search for. |
williamr@4 | 94 |
* @return Index of the given field, or KErrNotFound if field is not found. |
williamr@4 | 95 |
*/ |
williamr@4 | 96 |
IMPORT_C TInt FindField(const MVPbkBaseContactField& aContactField) const; |
williamr@4 | 97 |
|
williamr@4 | 98 |
public: // from MVPbkStoreContactFieldCollection |
williamr@4 | 99 |
MVPbkBaseContact& ParentContact() const; |
williamr@4 | 100 |
TInt FieldCount() const; |
williamr@4 | 101 |
const MVPbkStoreContactField& FieldAt(TInt aIndex) const; |
williamr@4 | 102 |
MVPbkStoreContactField& FieldAt(TInt aIndex); |
williamr@4 | 103 |
MVPbkStoreContactField* FieldAtLC(TInt aIndex) const; |
williamr@4 | 104 |
MVPbkStoreContact& ParentStoreContact() const; |
williamr@4 | 105 |
MVPbkStoreContactField* RetrieveField( |
williamr@4 | 106 |
const MVPbkContactLink& aContactLink) const; |
williamr@4 | 107 |
|
williamr@4 | 108 |
private: // Implementation |
williamr@4 | 109 |
CVPbkFieldFilter(); |
williamr@4 | 110 |
|
williamr@4 | 111 |
private: // Data |
williamr@4 | 112 |
///Ref: base fields |
williamr@4 | 113 |
MVPbkStoreContactFieldCollection* iBaseFields; |
williamr@4 | 114 |
///Own: field mapping |
williamr@4 | 115 |
RArray<TInt> iFieldMapping; |
williamr@4 | 116 |
}; |
williamr@4 | 117 |
|
williamr@4 | 118 |
|
williamr@4 | 119 |
// INLINE FUNCTIONS |
williamr@4 | 120 |
|
williamr@4 | 121 |
inline CVPbkFieldFilter::TConfig::TConfig |
williamr@4 | 122 |
(MVPbkStoreContactFieldCollection& aBaseFields, |
williamr@4 | 123 |
MVPbkContactFieldSelector* aFieldSelector /*= NULL*/, |
williamr@4 | 124 |
MVPbkContactFieldOrdering* aFieldOrdering /*= NULL*/) : |
williamr@4 | 125 |
iBaseFields(aBaseFields), |
williamr@4 | 126 |
iFieldSelector(aFieldSelector), |
williamr@4 | 127 |
iFieldOrdering(aFieldOrdering) |
williamr@4 | 128 |
{ |
williamr@4 | 129 |
} |
williamr@4 | 130 |
|
williamr@4 | 131 |
#endif // CVPBKFIELDFILTER_H |
williamr@4 | 132 |
|
williamr@4 | 133 |
// End of file |