epoc32/include/caf/attributeset.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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
 @file
williamr@4
    21
 @publishedAll
williamr@2
    22
 @released
williamr@2
    23
*/
williamr@2
    24
williamr@2
    25
williamr@2
    26
#ifndef __ATTRIBUTESET_H__
williamr@2
    27
#define __ATTRIBUTESET_H__
williamr@2
    28
williamr@2
    29
#include <e32base.h>
williamr@2
    30
#include <caf/caftypes.h>
williamr@2
    31
williamr@2
    32
class RReadStream;
williamr@2
    33
class RWriteStream;
williamr@2
    34
williamr@2
    35
namespace ContentAccess
williamr@2
    36
	{
williamr@2
    37
	
williamr@2
    38
	/** Holds the values of a predefined set of attributes based upon 
williamr@2
    39
	ContentAccess::TAttribute
williamr@2
    40
	
williamr@2
    41
	It is also possible for an agent to provide an extended set of these 
williamr@2
    42
	attributes beyond EAgentSpecificAttributeBase but only applications written 
williamr@4
    43
	to support that particular agent will support this.
williamr@2
    44
williamr@2
    45
	No duplicate attributes are allowed in the set
williamr@2
    46
	*/
williamr@2
    47
	class RAttributeSet
williamr@2
    48
		{
williamr@2
    49
		/** Holds the value of an attribute along with any error encountered
williamr@2
    50
		while retrieving the attribute
williamr@2
    51
		*/
williamr@2
    52
		class TAttributeValue 
williamr@2
    53
			{
williamr@2
    54
		public:
williamr@2
    55
			TInt iAttribute;
williamr@2
    56
			TInt iValue;
williamr@2
    57
			TInt iError;
williamr@2
    58
			};
williamr@2
    59
williamr@2
    60
	public:
williamr@2
    61
		IMPORT_C RAttributeSet();
williamr@2
    62
		
williamr@2
    63
		/** Release all resources used by the RAttributeSet
williamr@2
    64
		
williamr@2
    65
		This must be called before the RAttribute set goes out of scope
williamr@2
    66
		*/
williamr@2
    67
		IMPORT_C void Close();
williamr@2
    68
williamr@2
    69
		/** Add a new attribute to the set
williamr@2
    70
		The attribute is initalised with a default value of EAttributeNotSupported
williamr@2
    71
		
williamr@2
    72
		@param aAttribute The attribute to add to the set
williamr@2
    73
		*/
williamr@2
    74
		IMPORT_C void AddL(TInt aAttribute);
williamr@2
    75
williamr@2
    76
		/** Get the value of a specified attribute
williamr@2
    77
		@param aAttribute The attribute to query
williamr@2
    78
		@param aValue The value of the attribute
williamr@2
    79
		@return Whether the value parameter was updated
williamr@2
    80
		@return KErrNone The attribute value was updated
williamr@2
    81
		@return KErrNotFound The attribute is not part of the set
williamr@2
    82
		*/
williamr@2
    83
		IMPORT_C TInt GetValue(TInt aAttribute, TInt& aValue) const;
williamr@2
    84
williamr@2
    85
		/** Set the value of an attribute within the set
williamr@2
    86
		@param aAttribute The attribute to set
williamr@2
    87
		@param aValue The value of the attribute
williamr@2
    88
		@param aErrorCode The error code to return when this attribute is requested via the GetValue() function
williamr@2
    89
		@return Whether the new attribute value was set
williamr@2
    90
		@return KErrNone if the value was set
williamr@2
    91
		@return KErrNotFound if the attribute is not part of the set
williamr@2
    92
		*/
williamr@2
    93
		IMPORT_C TInt SetValue(TInt aAttribute, TInt aValue, TInt aErrorCode);
williamr@2
    94
		
williamr@2
    95
		/** Find the attribute stored at a particular index in the set
williamr@2
    96
		@param aIndex The index of the attribute
williamr@2
    97
		@return The attribute, NOT the value of the attribute
williamr@2
    98
		*/
williamr@2
    99
		IMPORT_C TInt operator [] (TInt aIndex) const;
williamr@2
   100
williamr@2
   101
		/** The number of attributes in the set
williamr@2
   102
		@return The number of attributes in the set
williamr@2
   103
		*/
williamr@2
   104
		IMPORT_C TInt Count() const;
williamr@2
   105
		
williamr@2
   106
		/** Write the RAttributeSet to a stream
williamr@2
   107
		@param aStream The stream to write the attribute set to
williamr@2
   108
		*/
williamr@2
   109
		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   110
williamr@2
   111
		/** Read the RAttributeSet from a stream
williamr@2
   112
		This does not clear the contents of the attribute set before reading. The 
williamr@2
   113
		values of any attributes already in the set are updated with new values 
williamr@2
   114
		from the stream. New attributes from the stream and their values are added
williamr@2
   115
		to the set.
williamr@2
   116
		@param aStream The stream to read the attribute set from
williamr@2
   117
		*/
williamr@2
   118
		IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   119
williamr@2
   120
	private:
williamr@2
   121
		void AddL(TInt aAttribute, TInt aValue, TInt aErrorCode);
williamr@2
   122
williamr@2
   123
		RArray <TAttributeValue> iAttributes;
williamr@2
   124
		};
williamr@2
   125
	}
williamr@2
   126
#endif