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_METADATA_H__
29 #define __CAF_METADATA_H__
37 namespace ContentAccess
39 /** Stores a field and data pair for use in a supplier import operation
41 The field and data can be any values the application doing the import thinks
42 the agent will find useful. Some information that could be included here are
45 "Content Type", "application/vnd.oma.drm.dm"
47 The application can include anything it likes, if the agent doesn't understand
48 the header it can just ignore it, eg:
53 CMetaData can be used with 8-bit or unicode data and automatically performs
54 conversions between the two.
56 Applications should use the unicode functions whenever possible because it
57 removes the risk of losing information during the unicode to 8 bit conversion.
62 class CMetaData : public CBase
65 /** Construct a new CMetaData with 8 bit data
66 The 8-bit data will be stored in CMetaData as unicode
68 @param aField The name of the field
69 @param aData The data associated with the field
70 @return A CMetaData object populated with the given field and data
74 static CMetaData* NewL(const TDesC8& aField, const TDesC8& aData);
75 /** Construct a new CMetaData with unicode data
77 @param aField The name of the field
78 @param aData The data associated with the field
79 @return A CMetaData object populated with the given field and data
84 static CMetaData* NewL(const TDesC16& aField, const TDesC16& aData);
86 /** Construct a new CMetaData from a data stream
88 @param aStream The stream to read the CMetaData object from
89 @return A CMetaData object read from the stream
94 static CMetaData* NewL(RReadStream& aStream);
101 @return The field name
103 IMPORT_C const TDesC& Field() const;
106 @return The data value
108 IMPORT_C const TDesC& Data() const;
111 @return The field name
113 IMPORT_C const TDesC8& Field8() const;
116 @return The data value
118 IMPORT_C const TDesC8& Data8() const;
120 /** Write the CMetaData to a data stream
122 @param aStream The stream to write the CMetaData object to
126 void ExternalizeL(RWriteStream& aStream) const;
129 CMetaData(TBool aUnicode);
130 void ConstructL(const TDesC8& aField, const TDesC8& aData);
131 void ConstructL(const TDesC16& aField, const TDesC16& aData);
133 /** Read the CMetaData from a data stream
135 void InternalizeL(RReadStream& aStream);