First public contribution.
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 __CAF_METADATA_H__
27 #define __CAF_METADATA_H__
35 namespace ContentAccess
37 /** Stores a field and data pair for use in a supplier import operation
39 The field and data can be any values the application doing the import thinks
40 the agent will find useful. Some information that could be included here are
43 "Content Type", "application/vnd.oma.drm.dm"
45 The application can include anything it likes, if the agent doesn't understand
46 the header it can just ignore it, eg:
51 CMetaData can be used with 8-bit or unicode data and automatically performs
52 conversions between the two.
54 Applications should use the unicode functions whenever possible because it
55 removes the risk of losing information during the unicode to 8 bit conversion.
58 class CMetaData : public CBase
61 /** Construct a new CMetaData with 8 bit data
62 The 8-bit data will be stored in CMetaData as unicode
64 @param aField The name of the field
65 @param aData The data associated with the field
66 @return A CMetaData object populated with the given field and data
68 static CMetaData* NewL(const TDesC8& aField, const TDesC8& aData);
69 /** Construct a new CMetaData with unicode data
71 @param aField The name of the field
72 @param aData The data associated with the field
73 @return A CMetaData object populated with the given field and data
76 static CMetaData* NewL(const TDesC16& aField, const TDesC16& aData);
78 /** Construct a new CMetaData from a data stream
80 @param aStream The stream to read the CMetaData object from
81 @return A CMetaData object read from the stream
84 static CMetaData* NewL(RReadStream& aStream);
91 @return The field name
93 IMPORT_C const TDesC& Field() const;
96 @return The data value
98 IMPORT_C const TDesC& Data() const;
101 @return The field name
103 IMPORT_C const TDesC8& Field8() const;
106 @return The data value
108 IMPORT_C const TDesC8& Data8() const;
110 /** Write the CMetaData to a data stream
112 @param aStream The stream to write the CMetaData object to
114 void ExternalizeL(RWriteStream& aStream) const;
117 CMetaData(TBool aUnicode);
118 void ConstructL(const TDesC8& aField, const TDesC8& aData);
119 void ConstructL(const TDesC16& aField, const TDesC16& aData);
121 /** Read the CMetaData from a data stream
123 void InternalizeL(RReadStream& aStream);