2 * Copyright (c) 2004-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: An interface for the field collection of the store contact
19 #ifndef MVPBKSTORECONTACTFIELDCOLLECTION_H
20 #define MVPBKSTORECONTACTFIELDCOLLECTION_H
25 #include <mvpbkbasecontactfieldcollection.h>
27 // Includes needed for covariant return types
28 #include <mvpbkstorecontactfield.h>
30 // FORWARD DECLARATIONS
31 class MVPbkStoreContact;
32 class MVPbkStoreContactField;
37 * An interface for the field collection of the store contact
39 * A field collection interface can be used for looping the contact fields.
41 class MVPbkStoreContactFieldCollection : public MVPbkBaseContactFieldCollection
47 virtual ~MVPbkStoreContactFieldCollection() { }
49 public: // From MVPbkBaseContactFieldCollection (covariant return types))
50 const MVPbkStoreContactField& FieldAt(TInt aIndex) const =0;
52 public: // New functions
54 * Returns a field in this collection.
56 * @param aIndex A zero-based index of the field to return.
57 * @return A reference to the field at aIndex. Reference is valid until
58 * FieldAt is called again. If you need a permanent copy,
59 * call MVPbkStoreContactField::CloneLC to the returned
61 * @see MVPbkStoreContactField::CloneLC
62 * @precond aIndex >= 0 && aIndex < FieldCount()
63 * VPbkError::Panic(VPbkError::EInvalidFieldIndex) is raised
64 * if the precondition does not hold.
66 virtual MVPbkStoreContactField& FieldAt( TInt aIndex ) = 0;
69 * Returns a copy of the field in this collection.
71 * Client gets the ownership of the field.
73 * @param aIndex A zero-based index of the field to return.
74 * @return A new instance to the field at aIndex. The field is valid
75 * as long as the parent contact is valid
76 * @precond aIndex >= 0 && aIndex < FieldCount()
77 * VPbkError::Panic(VPbkError::EInvalidFieldIndex) is raised
78 * if the precondition does not hold.
80 virtual MVPbkStoreContactField* FieldAtLC( TInt aIndex ) const = 0;
83 * Returns the parent contact of the field collection
85 * @return the parent contact of the field collection
87 virtual MVPbkStoreContact& ParentStoreContact() const = 0;
90 * Returns a field in this collection identified by a contact field
93 * A contact field link can be created using the MVPbkStoreContactField
94 * interface. The same link works then as a contact link and
97 * NOTE: implementations of stores are possibly using an index
98 * of the field as an identifier so clients should prefer not
99 * to save field links permanently. E.g modifying the contact
100 * can invalidate the link in some store implementations.
101 * A field link is practical in use cases where the link is
102 * created and immediately given to another component.
104 * @param aContactLink A valid contact field link.
105 * @return A field in this collection identified by aContactLink or NULL
106 * if the link does not contain field information or if the
107 * link does not refer to the parent contact of this field collection.
109 virtual MVPbkStoreContactField* RetrieveField(
110 const MVPbkContactLink& aContactLink ) const = 0;
113 * Returns an extension point for this interface or NULL.
115 * @param aExtensionUid no extensions defined currently.
116 * @return An extension point for this interface or NULL.
118 virtual TAny* StoreContactFieldCollectionExtension(
119 TUid /*aExtensionUid*/ ) { return NULL; }
123 #endif // MVPBKSTORECONTACTFIELDCOLLECTION_H