diff -r 000000000000 -r e686773b3f54 phonebookengines/VirtualPhonebook/VPbkCntModel/inc/TContactFieldCollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookengines/VirtualPhonebook/VPbkCntModel/inc/TContactFieldCollection.h Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Maps a Contact Model field collection to a virtual Phonebook + field collection. +* +*/ + + +#ifndef VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H +#define VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H + + +// INCLUDES +#include +#include "TContactField.h" + +// FORWARD DECLARATIONS +class CContactItemFieldSet; + +namespace VPbkCntModel { + +// FORWARD DECLARATIONS +class CContact; + +// CLASS DECLARATIONS + +/** + * Maps a Contact Model field collection to a virtual Phonebook field collection. + */ +NONSHARABLE_CLASS( TContactFieldCollection ): + public MVPbkStoreContactFieldCollection + { + public: // Constructor and destructor + /** + * Constructor. + * + * @param aParentContact the contact whose field collection this is. + * @parma aFieldSet the Contact Model field set to map. + */ + TContactFieldCollection + (CContact& aParentContact, CContactItemFieldSet& aFieldSet); + + /** + * Destructor. + */ + ~TContactFieldCollection(); + + public: // New functions + /** + * Resets a new parent contact for this field collection. + * + * @param aParentContact the contact whose field collection this is. + * @parma aFieldSet the Contact Model field set to map. + */ + void SetContact + (CContact& aParentContact, CContactItemFieldSet& aFieldSet); + + /** + * Returns a pointer to the field that is used as a return value of + * FieldAt functions. + * + * @see CContact::AddFieldL + */ + const MVPbkStoreContactField* FieldPointer() const; + + public: // from MVPbkStoreContactFieldCollection + MVPbkBaseContact& ParentContact() const; + TInt FieldCount() const; + const MVPbkStoreContactField& FieldAt(TInt aIndex) const; + MVPbkStoreContactField& FieldAt(TInt aIndex); + MVPbkStoreContactField* FieldAtLC(TInt aIndex) const; + MVPbkStoreContact& ParentStoreContact() const; + MVPbkStoreContactField* RetrieveField( + const MVPbkContactLink& aContactLink) const; + + private: // Data + CContactItemFieldSet* iFieldSet; + mutable TContactField iCurrentField; + CContact* iParentContact; + }; + + +// INLINE FUNCTIONS + +inline const MVPbkStoreContactField* TContactFieldCollection::FieldPointer() const + { + return &iCurrentField; + } + + +} // namespace VPbkCntModel + +#endif // VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H +//End of file + +