epoc32/include/caf/attributeset.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
/**
williamr@2
    22
 @file
williamr@2
    23
 @publishedPartner
williamr@2
    24
 @released
williamr@2
    25
*/
williamr@2
    26
williamr@2
    27
williamr@2
    28
#ifndef __ATTRIBUTESET_H__
williamr@2
    29
#define __ATTRIBUTESET_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <caf/caftypes.h>
williamr@2
    33
williamr@2
    34
class RReadStream;
williamr@2
    35
class RWriteStream;
williamr@2
    36
williamr@2
    37
namespace ContentAccess
williamr@2
    38
	{
williamr@2
    39
	
williamr@2
    40
	/** Holds the values of a predefined set of attributes based upon 
williamr@2
    41
	ContentAccess::TAttribute
williamr@2
    42
	
williamr@2
    43
	It is also possible for an agent to provide an extended set of these 
williamr@2
    44
	attributes beyond EAgentSpecificAttributeBase but only applications written 
williamr@2
    45
	to support a that particular agent will support this.
williamr@2
    46
williamr@2
    47
	No duplicate attributes are allowed in the set
williamr@2
    48
williamr@2
    49
	@publishedPartner
williamr@2
    50
	@released
williamr@2
    51
	*/
williamr@2
    52
	class RAttributeSet
williamr@2
    53
		{
williamr@2
    54
		/** Holds the value of an attribute along with any error encountered
williamr@2
    55
		while retrieving the attribute
williamr@2
    56
		*/
williamr@2
    57
		class TAttributeValue 
williamr@2
    58
			{
williamr@2
    59
		public:
williamr@2
    60
			TInt iAttribute;
williamr@2
    61
			TInt iValue;
williamr@2
    62
			TInt iError;
williamr@2
    63
			};
williamr@2
    64
williamr@2
    65
	public:
williamr@2
    66
		IMPORT_C RAttributeSet();
williamr@2
    67
		
williamr@2
    68
		/** Release all resources used by the RAttributeSet
williamr@2
    69
		
williamr@2
    70
		This must be called before the RAttribute set goes out of scope
williamr@2
    71
		*/
williamr@2
    72
		IMPORT_C void Close();
williamr@2
    73
williamr@2
    74
		/** Add a new attribute to the set
williamr@2
    75
		The attribute is initalised with a default value of EAttributeNotSupported
williamr@2
    76
		
williamr@2
    77
		@param aAttribute The attribute to add to the set
williamr@2
    78
		*/
williamr@2
    79
		IMPORT_C void AddL(TInt aAttribute);
williamr@2
    80
williamr@2
    81
		/** Get the value of a specified attribute
williamr@2
    82
		@param aAttribute The attribute to query
williamr@2
    83
		@param aValue The value of the attribute
williamr@2
    84
		@return Whether the value parameter was updated
williamr@2
    85
		@return KErrNone The attribute value was updated
williamr@2
    86
		@return KErrNotFound The attribute is not part of the set
williamr@2
    87
		*/
williamr@2
    88
		IMPORT_C TInt GetValue(TInt aAttribute, TInt& aValue) const;
williamr@2
    89
williamr@2
    90
		/** Set the value of an attribute within the set
williamr@2
    91
		@param aAttribute The attribute to set
williamr@2
    92
		@param aValue The value of the attribute
williamr@2
    93
		@param aErrorCode The error code to return when this attribute is requested via the GetValue() function
williamr@2
    94
		@return Whether the new attribute value was set
williamr@2
    95
		@return KErrNone if the value was set
williamr@2
    96
		@return KErrNotFound if the attribute is not part of the set
williamr@2
    97
		*/
williamr@2
    98
		IMPORT_C TInt SetValue(TInt aAttribute, TInt aValue, TInt aErrorCode);
williamr@2
    99
		
williamr@2
   100
		/** Find the attribute stored at a particular index in the set
williamr@2
   101
		@param aIndex The index of the attribute
williamr@2
   102
		@return The attribute, NOT the value of the attribute
williamr@2
   103
		*/
williamr@2
   104
		IMPORT_C TInt operator [] (TInt aIndex) const;
williamr@2
   105
williamr@2
   106
		/** The number of attributes in the set
williamr@2
   107
		@return The number of attributes in the set
williamr@2
   108
		*/
williamr@2
   109
		IMPORT_C TInt Count() const;
williamr@2
   110
		
williamr@2
   111
		/** Write the RAttributeSet to a stream
williamr@2
   112
		@param aStream The stream to write the attribute set to
williamr@2
   113
		*/
williamr@2
   114
		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   115
williamr@2
   116
		/** Read the RAttributeSet from a stream
williamr@2
   117
		This does not clear the contents of the attribute set before reading. The 
williamr@2
   118
		values of any attributes already in the set are updated with new values 
williamr@2
   119
		from the stream. New attributes from the stream and their values are added
williamr@2
   120
		to the set.
williamr@2
   121
		@param aStream The stream to read the attribute set from
williamr@2
   122
		*/
williamr@2
   123
		IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   124
williamr@2
   125
	private:
williamr@2
   126
		void AddL(TInt aAttribute, TInt aValue, TInt aErrorCode);
williamr@2
   127
williamr@2
   128
		RArray <TAttributeValue> iAttributes;
williamr@2
   129
		};
williamr@2
   130
	}
williamr@2
   131
#endif