1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/CVPbkFieldFilter.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,133 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: A filtered and sorted collection of contact fields.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef CVPBKFIELDFILTER_H
1.23 +#define CVPBKFIELDFILTER_H
1.24 +
1.25 +// INCLUDES
1.26 +#include <e32base.h>
1.27 +#include <mvpbkstorecontactfieldcollection.h>
1.28 +
1.29 +// FORWARD DECLARATIONS
1.30 +class MVPbkContactFieldSelector;
1.31 +class MVPbkContactFieldOrdering;
1.32 +
1.33 +
1.34 +/**
1.35 + * A filtered and sorted collection of Virtual Phonebook contact fields.
1.36 + */
1.37 +class CVPbkFieldFilter :
1.38 + public CBase,
1.39 + public MVPbkStoreContactFieldCollection
1.40 + {
1.41 + public: // Types
1.42 + /**
1.43 + * CVPbkFieldFilter configuration. This configuration class is
1.44 + * used to configure the field filter.
1.45 + */
1.46 + class TConfig
1.47 + {
1.48 + public:
1.49 + /**
1.50 + * Constructor.
1.51 + *
1.52 + * @param aBaseFields Mandatory base field set to filter.
1.53 + * @param aFieldSelector Optional field selector instance.
1.54 + * @param aFieldOrdering Optional field ordering instance.
1.55 + */
1.56 + inline TConfig (
1.57 + MVPbkStoreContactFieldCollection& aBaseFields,
1.58 + MVPbkContactFieldSelector* aFieldSelector = NULL,
1.59 + MVPbkContactFieldOrdering* aFieldOrdering = NULL);
1.60 +
1.61 + public:
1.62 + ///Ref: Base field collection that is filtered
1.63 + MVPbkStoreContactFieldCollection& iBaseFields;
1.64 + ///Ref: A field selector
1.65 + MVPbkContactFieldSelector* iFieldSelector;
1.66 + ///Ref: Field sorter
1.67 + MVPbkContactFieldOrdering* iFieldOrdering;
1.68 + ///Ref: Spare for future extension
1.69 + TAny* iSpare;
1.70 + };
1.71 +
1.72 + public: // Constructor and Destructor
1.73 + /**
1.74 + * Creates and returns a new instance of this class.
1.75 + *
1.76 + * @param aConfig Field filtering configuration.
1.77 + */
1.78 + IMPORT_C static CVPbkFieldFilter* NewL(const TConfig& aConfig);
1.79 +
1.80 + /**
1.81 + * Destructor.
1.82 + */
1.83 + ~CVPbkFieldFilter();
1.84 +
1.85 + public: // Interface
1.86 + /**
1.87 + * Reset the contents of this filtered field collection according
1.88 + * to a new configuration.
1.89 + *
1.90 + * @param aConfig Filtering configuration to rest to.
1.91 + */
1.92 + IMPORT_C void ResetL(const TConfig& aConfig);
1.93 +
1.94 + /**
1.95 + * Finds given field from the set of filtered fields
1.96 + * @param aContactField Field to search for.
1.97 + * @return Index of the given field, or KErrNotFound if field is not found.
1.98 + */
1.99 + IMPORT_C TInt FindField(const MVPbkBaseContactField& aContactField) const;
1.100 +
1.101 + public: // from MVPbkStoreContactFieldCollection
1.102 + MVPbkBaseContact& ParentContact() const;
1.103 + TInt FieldCount() const;
1.104 + const MVPbkStoreContactField& FieldAt(TInt aIndex) const;
1.105 + MVPbkStoreContactField& FieldAt(TInt aIndex);
1.106 + MVPbkStoreContactField* FieldAtLC(TInt aIndex) const;
1.107 + MVPbkStoreContact& ParentStoreContact() const;
1.108 + MVPbkStoreContactField* RetrieveField(
1.109 + const MVPbkContactLink& aContactLink) const;
1.110 +
1.111 + private: // Implementation
1.112 + CVPbkFieldFilter();
1.113 +
1.114 + private: // Data
1.115 + ///Ref: base fields
1.116 + MVPbkStoreContactFieldCollection* iBaseFields;
1.117 + ///Own: field mapping
1.118 + RArray<TInt> iFieldMapping;
1.119 + };
1.120 +
1.121 +
1.122 +// INLINE FUNCTIONS
1.123 +
1.124 +inline CVPbkFieldFilter::TConfig::TConfig
1.125 + (MVPbkStoreContactFieldCollection& aBaseFields,
1.126 + MVPbkContactFieldSelector* aFieldSelector /*= NULL*/,
1.127 + MVPbkContactFieldOrdering* aFieldOrdering /*= NULL*/) :
1.128 + iBaseFields(aBaseFields),
1.129 + iFieldSelector(aFieldSelector),
1.130 + iFieldOrdering(aFieldOrdering)
1.131 + {
1.132 + }
1.133 +
1.134 +#endif // CVPBKFIELDFILTER_H
1.135 +
1.136 +// End of file