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.
28 #ifndef __CAF_METADATAARRAY_H__
29 #define __CAF_METADATAARRAY_H__
37 namespace ContentAccess
42 Stores an array of CMetaData objects for use in a supplier import operation
44 It provides search and routines (for both 8 bit and Unicode) to find the
45 value corresponding to a particular field in the array.
47 Applications should use the unicode search function whenever possible because
48 it removes the risk of losing information during the unicode to 8 bit
54 class CMetaDataArray : public CBase
58 IMPORT_C static CMetaDataArray* NewL();
59 IMPORT_C static CMetaDataArray* NewLC();
61 /** Construct a CMetaDataArray from a stream
62 @param aStream the stream containing the metadata array
63 @return a new CMetaDataArray
65 IMPORT_C static CMetaDataArray* NewL(RReadStream& aStream);
68 virtual ~CMetaDataArray();
70 /** Adds a new meta data,
71 @param aField The name used to index the value of interest
74 IMPORT_C void AddL(const TDesC8& aField, const TDesC8& aData);
76 /** Adds a new meta data,
77 @param aField The name used to index the value of interest
80 IMPORT_C void AddL(const TDesC& aField, const TDesC& aData);
82 /** Retrieves the MetaData at the given index
84 * @param aIndex The index of the meta-data
87 IMPORT_C const CMetaData& operator [] (TInt aIndex) const;
89 /** The number of metadata objects in the list
91 IMPORT_C TInt Count() const;
93 /** Find the unicode data for a given unicode field.
95 @param aField The field to retrieve
96 @param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
97 @return The corresponding data or else a zero length string if the field was not found
99 IMPORT_C const TDesC& SearchL(const TDesC& aField, TBool aMatchCase = EFalse) const;
101 /** Find the 8 bit data for a given 8 bit field.
103 @param aField8 The field to retrieve
104 @param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
105 @return The corresponding data or else a zero length string if the field was not found
107 IMPORT_C const TDesC8& SearchL(const TDesC8& aField8, TBool aMatchCase = EFalse) const;
109 /** Externalizes the CMetaDataArray object to a stream.
111 * @param aStream The stream to write the header information to.
113 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
117 void InternalizeL(RReadStream& aStream);
120 RPointerArray <CMetaData> iArray;
122 // Length of the longest data item in the array
123 TInt iMaxFieldLength;