epoc32/include/caf/stringattributeset.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/caf/stringattributeset.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,128 @@
     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 +
    1.24 +/**
    1.25 + @file
    1.26 + @publishedPartner
    1.27 + @released
    1.28 +*/
    1.29 +
    1.30 +
    1.31 +#ifndef __STRINGATTRIBUTESET_H__
    1.32 +#define __STRINGATTRIBUTESET_H__
    1.33 +
    1.34 +#include <e32base.h>
    1.35 +#include <caf/caftypes.h>
    1.36 +
    1.37 +class RReadStream;
    1.38 +class RWriteStream;
    1.39 +
    1.40 +namespace ContentAccess
    1.41 +	{
    1.42 +	class CStringAttribute;
    1.43 +
    1.44 +	/** Holds the values of a predefined set of attributes based upon 
    1.45 +	ContentAccess::TStringAttribute
    1.46 +	
    1.47 +	It is also possible for an agent to provide an extended set of these 
    1.48 +	attributes beyond EAgentSpecificAttributeBase but only applications written 
    1.49 +	to support a that particular agent will support this.
    1.50 +
    1.51 +	No duplicate attributes are allowed in the set
    1.52 +
    1.53 +	@publishedPartner
    1.54 +	@released
    1.55 +	*/
    1.56 +	class RStringAttributeSet
    1.57 +		{
    1.58 +	public:
    1.59 +		IMPORT_C RStringAttributeSet();
    1.60 +		
    1.61 +		/** Release all resources used by the RStringAttributeSet
    1.62 +		
    1.63 +		This must be called before the RStringAttribute set goes out of scope
    1.64 +		*/
    1.65 +		IMPORT_C void Close();
    1.66 +
    1.67 +		/** Add a new attribute to the set
    1.68 +		The attribute value is initalised with an empty string
    1.69 +		
    1.70 +		@param aAttribute The attribute to add to the set
    1.71 +		*/
    1.72 +		IMPORT_C void AddL(TInt aAttribute);
    1.73 +
    1.74 +		/** Get the value of a specified attribute
    1.75 +		@param aAttribute The attribute to query
    1.76 +		@param aValue The value of the attribute is copied to this descriptor
    1.77 +		@return The value of the attribute
    1.78 +		@return KErrOverflow If the descriptor is not large enough to store the attribute
    1.79 +		@return KErrNotFound if the attribute is not part of the set
    1.80 +		*/
    1.81 +		IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
    1.82 +		
    1.83 +
    1.84 +		/** Get the length of a buffer required to store the value of a specified attribute
    1.85 +		@param aAttribute The attribute to query
    1.86 +		@return The length of the value of the attribute
    1.87 +		*/
    1.88 +		IMPORT_C TInt GetValueLength(TInt aAttribute) const;
    1.89 +		
    1.90 +
    1.91 +		/** Set the value of an attribute within the set
    1.92 +		@param aAttribute The attribute to set
    1.93 +		@param aValue The value of the attribute
    1.94 +		@param aErrorCode The error to return when GetValue() is called for this attribute
    1.95 +		@leave KErrNotFound if the attribute is not part of the set
    1.96 +		*/
    1.97 +		IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
    1.98 +		
    1.99 +
   1.100 +		/** Find the attribute stored at a particular index in the set
   1.101 +		@param aIndex The index of the attribute
   1.102 +		@return The attribute, NOT the value of the attribute
   1.103 +		*/
   1.104 +		IMPORT_C TInt operator [] (TInt aIndex) const;
   1.105 +
   1.106 +		/** The number of attributes in the set
   1.107 +		@return The number of attributes in the set
   1.108 +		*/
   1.109 +		IMPORT_C TInt Count() const;
   1.110 +		
   1.111 +		/** Write the RAttributeSet to a stream
   1.112 +		@param aStream The stream to write the attribute set to
   1.113 +		*/
   1.114 +		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.115 +
   1.116 +		/** Read the RAttributeSet from a stream
   1.117 +		This does not clear the contents of the attribute set before reading. The 
   1.118 +		values of any attributes already in the set are updated with new values 
   1.119 +		from the stream. New attributes from the stream and their values are added
   1.120 +		to the set.
   1.121 +		@param aStream The stream to read the attribute set from
   1.122 +		*/
   1.123 +		IMPORT_C void InternalizeL(RReadStream& aStream);
   1.124 +
   1.125 +	private:
   1.126 +		void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
   1.127 +
   1.128 +		RPointerArray <CStringAttribute> iAttributes;
   1.129 +		};
   1.130 +	}
   1.131 +#endif