os/security/contentmgmt/contentaccessfwfordrm/inc/metadata.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/inc/metadata.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,134 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedAll
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +
    1.29 +#ifndef __CAF_METADATA_H__
    1.30 +#define __CAF_METADATA_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <f32file.h>
    1.34 +
    1.35 +class RReadStream;
    1.36 +class RWriteStream;
    1.37 +
    1.38 +namespace ContentAccess
    1.39 +	{
    1.40 +	/** Stores a field and data pair for use in a supplier import operation
    1.41 +	
    1.42 +	The field and data can be any values the application doing the import thinks 
    1.43 +	the agent will find useful. Some information that could be included here are
    1.44 +	headers, eg:
    1.45 +
    1.46 +	"Content Type", "application/vnd.oma.drm.dm"
    1.47 +
    1.48 +	The application can include anything it likes, if the agent doesn't understand
    1.49 +	the header it can just ignore it, eg:
    1.50 +
    1.51 +	"Colour", "Yellow"
    1.52 +
    1.53 +
    1.54 +	CMetaData can be used with 8-bit or unicode data and automatically performs
    1.55 +	conversions between the two. 
    1.56 +	
    1.57 +	Applications should use the unicode functions whenever possible because it 
    1.58 +	removes the risk of losing information during the unicode to 8 bit conversion.
    1.59 +
    1.60 +	*/
    1.61 +	class CMetaData : public CBase
    1.62 +		{
    1.63 +	public:
    1.64 +		/** Construct a new CMetaData with 8 bit data 
    1.65 +		The 8-bit data will be stored in CMetaData as unicode 
    1.66 +		
    1.67 +		@param aField The name of the field
    1.68 +		@param aData The data associated with the field
    1.69 +		@return A CMetaData object populated with the given field and data		
    1.70 +		*/
    1.71 +		static CMetaData* NewL(const TDesC8& aField, const TDesC8& aData);
    1.72 +		/** Construct a new CMetaData with unicode data 
    1.73 +
    1.74 +		@param aField The name of the field
    1.75 +		@param aData The data associated with the field
    1.76 +		@return A CMetaData object populated with the given field and data		
    1.77 +
    1.78 +		*/
    1.79 +		static CMetaData* NewL(const TDesC16& aField, const TDesC16& aData);
    1.80 +
    1.81 +		/** Construct a new CMetaData from a data stream
    1.82 +
    1.83 +		@param aStream The stream to read the CMetaData object from
    1.84 +		@return A CMetaData object read from the stream
    1.85 +		
    1.86 +		*/
    1.87 +		static CMetaData* NewL(RReadStream& aStream);
    1.88 +
    1.89 +		/** destructor 
    1.90 +		*/
    1.91 +		virtual ~CMetaData();
    1.92 +
    1.93 +		/** The field name 
    1.94 +		@return The field name
    1.95 +		*/
    1.96 +		IMPORT_C const TDesC& Field() const;
    1.97 +		
    1.98 +		/** The data value 
    1.99 +		@return The data value
   1.100 +		*/
   1.101 +		IMPORT_C const TDesC& Data() const;
   1.102 +
   1.103 +		/** The field name 
   1.104 +		@return The field name
   1.105 +		*/
   1.106 +		IMPORT_C const TDesC8& Field8() const;
   1.107 +		
   1.108 +		/** The data value 
   1.109 +		@return The data value
   1.110 +		*/
   1.111 +		IMPORT_C const TDesC8& Data8() const;
   1.112 +
   1.113 +		/** Write the CMetaData to a data stream
   1.114 +		
   1.115 +		@param aStream The stream to write the CMetaData object to
   1.116 +		*/
   1.117 +		void ExternalizeL(RWriteStream& aStream) const;
   1.118 +
   1.119 +	private:
   1.120 +		CMetaData(TBool aUnicode);
   1.121 +		void ConstructL(const TDesC8& aField, const TDesC8& aData);
   1.122 +		void ConstructL(const TDesC16& aField, const TDesC16& aData);
   1.123 +
   1.124 +		/** Read the CMetaData from a data stream
   1.125 +		*/
   1.126 +		void InternalizeL(RReadStream& aStream);
   1.127 +
   1.128 +	private:
   1.129 +		HBufC* iField;
   1.130 +		HBufC* iData;
   1.131 +		HBufC8* iField8;
   1.132 +		HBufC8* iData8;
   1.133 +		TBool iUnicode;
   1.134 +		};
   1.135 +	}
   1.136 +
   1.137 +#endif