os/security/contentmgmt/contentaccessfwfordrm/inc/attributeset.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/inc/attributeset.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,126 @@
     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 __ATTRIBUTESET_H__
    1.30 +#define __ATTRIBUTESET_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <caf/caftypes.h>
    1.34 +
    1.35 +class RReadStream;
    1.36 +class RWriteStream;
    1.37 +
    1.38 +namespace ContentAccess
    1.39 +	{
    1.40 +	
    1.41 +	/** Holds the values of a predefined set of attributes based upon 
    1.42 +	ContentAccess::TAttribute
    1.43 +	
    1.44 +	It is also possible for an agent to provide an extended set of these 
    1.45 +	attributes beyond EAgentSpecificAttributeBase but only applications written 
    1.46 +	to support that particular agent will support this.
    1.47 +
    1.48 +	No duplicate attributes are allowed in the set
    1.49 +	*/
    1.50 +	class RAttributeSet
    1.51 +		{
    1.52 +		/** Holds the value of an attribute along with any error encountered
    1.53 +		while retrieving the attribute
    1.54 +		*/
    1.55 +		class TAttributeValue 
    1.56 +			{
    1.57 +		public:
    1.58 +			TInt iAttribute;
    1.59 +			TInt iValue;
    1.60 +			TInt iError;
    1.61 +			};
    1.62 +
    1.63 +	public:
    1.64 +		IMPORT_C RAttributeSet();
    1.65 +		
    1.66 +		/** Release all resources used by the RAttributeSet
    1.67 +		
    1.68 +		This must be called before the RAttribute set goes out of scope
    1.69 +		*/
    1.70 +		IMPORT_C void Close();
    1.71 +
    1.72 +		/** Add a new attribute to the set
    1.73 +		The attribute is initalised with a default value of EAttributeNotSupported
    1.74 +		
    1.75 +		@param aAttribute The attribute to add to the set
    1.76 +		*/
    1.77 +		IMPORT_C void AddL(TInt aAttribute);
    1.78 +
    1.79 +		/** Get the value of a specified attribute
    1.80 +		@param aAttribute The attribute to query
    1.81 +		@param aValue The value of the attribute
    1.82 +		@return Whether the value parameter was updated
    1.83 +		@return KErrNone The attribute value was updated
    1.84 +		@return KErrNotFound The attribute is not part of the set
    1.85 +		*/
    1.86 +		IMPORT_C TInt GetValue(TInt aAttribute, TInt& aValue) const;
    1.87 +
    1.88 +		/** Set the value of an attribute within the set
    1.89 +		@param aAttribute The attribute to set
    1.90 +		@param aValue The value of the attribute
    1.91 +		@param aErrorCode The error code to return when this attribute is requested via the GetValue() function
    1.92 +		@return Whether the new attribute value was set
    1.93 +		@return KErrNone if the value was set
    1.94 +		@return KErrNotFound if the attribute is not part of the set
    1.95 +		*/
    1.96 +		IMPORT_C TInt SetValue(TInt aAttribute, TInt aValue, TInt aErrorCode);
    1.97 +		
    1.98 +		/** Find the attribute stored at a particular index in the set
    1.99 +		@param aIndex The index of the attribute
   1.100 +		@return The attribute, NOT the value of the attribute
   1.101 +		*/
   1.102 +		IMPORT_C TInt operator [] (TInt aIndex) const;
   1.103 +
   1.104 +		/** The number of attributes in the set
   1.105 +		@return The number of attributes in the set
   1.106 +		*/
   1.107 +		IMPORT_C TInt Count() const;
   1.108 +		
   1.109 +		/** Write the RAttributeSet to a stream
   1.110 +		@param aStream The stream to write the attribute set to
   1.111 +		*/
   1.112 +		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.113 +
   1.114 +		/** Read the RAttributeSet from a stream
   1.115 +		This does not clear the contents of the attribute set before reading. The 
   1.116 +		values of any attributes already in the set are updated with new values 
   1.117 +		from the stream. New attributes from the stream and their values are added
   1.118 +		to the set.
   1.119 +		@param aStream The stream to read the attribute set from
   1.120 +		*/
   1.121 +		IMPORT_C void InternalizeL(RReadStream& aStream);
   1.122 +
   1.123 +	private:
   1.124 +		void AddL(TInt aAttribute, TInt aValue, TInt aErrorCode);
   1.125 +
   1.126 +		RArray <TAttributeValue> iAttributes;
   1.127 +		};
   1.128 +	}
   1.129 +#endif