2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: A filtered and sorted collection of contact fields.
19 #ifndef CVPBKFIELDFILTER_H
20 #define CVPBKFIELDFILTER_H
24 #include <mvpbkstorecontactfieldcollection.h>
26 // FORWARD DECLARATIONS
27 class MVPbkContactFieldSelector;
28 class MVPbkContactFieldOrdering;
32 * A filtered and sorted collection of Virtual Phonebook contact fields.
34 class CVPbkFieldFilter :
36 public MVPbkStoreContactFieldCollection
40 * CVPbkFieldFilter configuration. This configuration class is
41 * used to configure the field filter.
49 * @param aBaseFields Mandatory base field set to filter.
50 * @param aFieldSelector Optional field selector instance.
51 * @param aFieldOrdering Optional field ordering instance.
54 MVPbkStoreContactFieldCollection& aBaseFields,
55 MVPbkContactFieldSelector* aFieldSelector = NULL,
56 MVPbkContactFieldOrdering* aFieldOrdering = NULL);
59 ///Ref: Base field collection that is filtered
60 MVPbkStoreContactFieldCollection& iBaseFields;
61 ///Ref: A field selector
62 MVPbkContactFieldSelector* iFieldSelector;
64 MVPbkContactFieldOrdering* iFieldOrdering;
65 ///Ref: Spare for future extension
69 public: // Constructor and Destructor
71 * Creates and returns a new instance of this class.
73 * @param aConfig Field filtering configuration.
75 IMPORT_C static CVPbkFieldFilter* NewL(const TConfig& aConfig);
84 * Reset the contents of this filtered field collection according
85 * to a new configuration.
87 * @param aConfig Filtering configuration to rest to.
89 IMPORT_C void ResetL(const TConfig& aConfig);
92 * Finds given field from the set of filtered fields
93 * @param aContactField Field to search for.
94 * @return Index of the given field, or KErrNotFound if field is not found.
96 IMPORT_C TInt FindField(const MVPbkBaseContactField& aContactField) const;
98 public: // from MVPbkStoreContactFieldCollection
99 MVPbkBaseContact& ParentContact() const;
100 TInt FieldCount() const;
101 const MVPbkStoreContactField& FieldAt(TInt aIndex) const;
102 MVPbkStoreContactField& FieldAt(TInt aIndex);
103 MVPbkStoreContactField* FieldAtLC(TInt aIndex) const;
104 MVPbkStoreContact& ParentStoreContact() const;
105 MVPbkStoreContactField* RetrieveField(
106 const MVPbkContactLink& aContactLink) const;
108 private: // Implementation
113 MVPbkStoreContactFieldCollection* iBaseFields;
114 ///Own: field mapping
115 RArray<TInt> iFieldMapping;
121 inline CVPbkFieldFilter::TConfig::TConfig
122 (MVPbkStoreContactFieldCollection& aBaseFields,
123 MVPbkContactFieldSelector* aFieldSelector /*= NULL*/,
124 MVPbkContactFieldOrdering* aFieldOrdering /*= NULL*/) :
125 iBaseFields(aBaseFields),
126 iFieldSelector(aFieldSelector),
127 iFieldOrdering(aFieldOrdering)
131 #endif // CVPBKFIELDFILTER_H