Update contrib.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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.
26 #ifndef __STREAMABLEPTRARRAY_H__
27 #define __STREAMABLEPTRARRAY_H__
32 namespace ContentAccess
34 /** Template class used to store an array of pointers that can also write itself to a stream
36 The RStreamablePtrArray owns all the elements contained within it. The close
37 function must be called before the RStreamablePtrArray goes out of scope.
39 The close function frees all resources and deletes all array elements
41 The array can be streamed using the InternalizeL() and ExternalizeL() functions
45 class RStreamablePtrArray
49 inline RStreamablePtrArray();
51 /** Free all resources held by the array
53 Calls ResetAndDestroy();
57 /** Append an element to the array
59 Ownership of the pointer is transferred to the array
60 @param aElement The item to add to the array
62 inline void AppendL(T* aElement);
64 /** Count the number of objects in the array */
65 inline TInt Count() const;
67 /** Return a pointer to an element at a given index in the array
69 @param aIndex The zero based index in the array, must be less than Count()
70 @return A pointer to the object stored in the array
72 inline T* operator [] (TInt aIndex) const;
74 /** Delete all elements in the array*/
75 inline void ResetAndDestroy();
77 /** Add array elements from a stream */
78 inline void InternalizeL(RReadStream& aStream);
80 /** Write the entire array to a stream */
81 inline void ExternalizeL(RWriteStream& aStream) const;
83 /** Remove an element from the array.
84 Note that the function does not delete the pointer.
86 inline void RemoveL(TInt aIndex);
89 RPointerArray <T> iArray;
93 // include inline function definitions
94 #include <caf/streamableptrarray.inl>