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: An array for store URIs.
19 #ifndef CVPBKCONTACTSTOREURIARRAY_H
20 #define CVPBKCONTACTSTOREURIARRAY_H
25 // FORWARD DECLARATIONS
26 class TVPbkContactStoreUriPtr;
27 class CVPbkContactStoreUri;
32 * Virtual Phonebook contact store URI array. Responsible for
33 * implementing a container for contact store URI's. In addition
34 * to common container behaviour the class can internalize and
35 * externalize store URI's from and to descriptors.
37 class CVPbkContactStoreUriArray : public CBase
39 public: // Construction and destruction
41 * Creates a new instance of this class.
42 * @return Newly created instance of this class.
44 IMPORT_C static CVPbkContactStoreUriArray* NewL();
47 * Creates a new instance of this class. Leaves
48 * the instance to the cleanup stack.
49 * @return Newly created instance of this class.
51 IMPORT_C static CVPbkContactStoreUriArray* NewLC();
54 * Creates a new instance of this class internalizing the
55 * contents of the descriptor.
56 * @param aPackedUris Packed URIs created by using the
57 * PackLC functionality of this class.
58 * @return Newly created instance of this class.
60 IMPORT_C static CVPbkContactStoreUriArray* NewLC(const TDesC8& aPackedUris);
65 ~CVPbkContactStoreUriArray();
70 * Appends StoreUriPtr to this array.
72 * @param aStoreUri Store URI to add array.
74 IMPORT_C void AppendL(const TVPbkContactStoreUriPtr& aStoreUri);
77 * Appends array of StoreUriPtr to this array.
79 * @param aUriArray Array of Store URIs to add array.
81 IMPORT_C void AppendAllL(const CVPbkContactStoreUriArray& aUriArray);
84 * Removes StoreUriPtr from this array.
86 * @param aStoreUri Store Uri to add array.
88 IMPORT_C void Remove(const TVPbkContactStoreUriPtr& aStoreUri);
91 * Returns the count of Store URIs in this array.
93 * @return Count of Store URIs in array.
95 IMPORT_C TInt Count() const;
98 * Gets the URI pointer descriptor from this array at
101 * @param aIndex Index which URI Ptr is needed
102 * @return URI pointer descriptor.
104 IMPORT_C TVPbkContactStoreUriPtr operator[](TInt aIndex) const;
107 * Packs this URI array to a heap descriptor.
109 * @return Packed URI array in a heap descriptor.
111 IMPORT_C HBufC8* PackLC() const;
114 * Checks whether the given URI is already in this array.
116 * @param aStoreUri Store URI to check.
117 * @return ETrue if Store URI is in this array, EFalse if not.
119 IMPORT_C TBool IsIncluded(const TVPbkContactStoreUriPtr& aStoreUri) const;
121 private: // Implementation
122 CVPbkContactStoreUriArray();
124 void ConstructL(const TDesC8& aPackedUris);
125 TInt CalculateExternalizedSize() const;
128 ///Own: Array of contact store URI's
129 RPointerArray<CVPbkContactStoreUri> iUris;
132 #endif // CVPBKCONTACTSTOREURIARRAY_H