63
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: A filtered and sorted collection of contact fields.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CVPBKFIELDFILTER_H
|
|
20 |
#define CVPBKFIELDFILTER_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <MVPbkStoreContactFieldCollection.h>
|
|
25 |
|
|
26 |
// FORWARD DECLARATIONS
|
|
27 |
class MVPbkContactFieldSelector;
|
|
28 |
class MVPbkContactFieldOrdering;
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* A filtered and sorted collection of Virtual Phonebook contact fields.
|
|
33 |
*/
|
|
34 |
class CVPbkFieldFilter :
|
|
35 |
public CBase,
|
|
36 |
public MVPbkStoreContactFieldCollection
|
|
37 |
{
|
|
38 |
public: // Types
|
|
39 |
/**
|
|
40 |
* CVPbkFieldFilter configuration. This configuration class is
|
|
41 |
* used to configure the field filter.
|
|
42 |
*/
|
|
43 |
class TConfig
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
/**
|
|
47 |
* Constructor.
|
|
48 |
*
|
|
49 |
* @param aBaseFields Mandatory base field set to filter.
|
|
50 |
* @param aFieldSelector Optional field selector instance.
|
|
51 |
* @param aFieldOrdering Optional field ordering instance.
|
|
52 |
*/
|
|
53 |
inline TConfig (
|
|
54 |
MVPbkStoreContactFieldCollection& aBaseFields,
|
|
55 |
MVPbkContactFieldSelector* aFieldSelector = NULL,
|
|
56 |
MVPbkContactFieldOrdering* aFieldOrdering = NULL);
|
|
57 |
|
|
58 |
public:
|
|
59 |
///Ref: Base field collection that is filtered
|
|
60 |
MVPbkStoreContactFieldCollection& iBaseFields;
|
|
61 |
///Ref: A field selector
|
|
62 |
MVPbkContactFieldSelector* iFieldSelector;
|
|
63 |
///Ref: Field sorter
|
|
64 |
MVPbkContactFieldOrdering* iFieldOrdering;
|
|
65 |
///Ref: Spare for future extension
|
|
66 |
TAny* iSpare;
|
|
67 |
};
|
|
68 |
|
|
69 |
public: // Constructor and Destructor
|
|
70 |
/**
|
|
71 |
* Creates and returns a new instance of this class.
|
|
72 |
*
|
|
73 |
* @param aConfig Field filtering configuration.
|
|
74 |
*/
|
|
75 |
IMPORT_C static CVPbkFieldFilter* NewL(const TConfig& aConfig);
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Destructor.
|
|
79 |
*/
|
|
80 |
~CVPbkFieldFilter();
|
|
81 |
|
|
82 |
public: // Interface
|
|
83 |
/**
|
|
84 |
* Reset the contents of this filtered field collection according
|
|
85 |
* to a new configuration.
|
|
86 |
*
|
|
87 |
* @param aConfig Filtering configuration to rest to.
|
|
88 |
*/
|
|
89 |
IMPORT_C void ResetL(const TConfig& aConfig);
|
|
90 |
|
|
91 |
/**
|
|
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.
|
|
95 |
*/
|
|
96 |
IMPORT_C TInt FindField(const MVPbkBaseContactField& aContactField) const;
|
|
97 |
|
|
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;
|
|
107 |
|
|
108 |
private: // Implementation
|
|
109 |
CVPbkFieldFilter();
|
|
110 |
|
|
111 |
private: // Data
|
|
112 |
///Ref: base fields
|
|
113 |
MVPbkStoreContactFieldCollection* iBaseFields;
|
|
114 |
///Own: field mapping
|
|
115 |
RArray<TInt> iFieldMapping;
|
|
116 |
};
|
|
117 |
|
|
118 |
|
|
119 |
// INLINE FUNCTIONS
|
|
120 |
|
|
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)
|
|
128 |
{
|
|
129 |
}
|
|
130 |
|
|
131 |
#endif // CVPBKFIELDFILTER_H
|
|
132 |
|
|
133 |
// End of file
|