2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __ATTRIBUTESET_H__
29 #define __ATTRIBUTESET_H__
32 #include <caf/caftypes.h>
37 namespace ContentAccess
40 /** Holds the values of a predefined set of attributes based upon
41 ContentAccess::TAttribute
43 It is also possible for an agent to provide an extended set of these
44 attributes beyond EAgentSpecificAttributeBase but only applications written
45 to support a that particular agent will support this.
47 No duplicate attributes are allowed in the set
54 /** Holds the value of an attribute along with any error encountered
55 while retrieving the attribute
66 IMPORT_C RAttributeSet();
68 /** Release all resources used by the RAttributeSet
70 This must be called before the RAttribute set goes out of scope
72 IMPORT_C void Close();
74 /** Add a new attribute to the set
75 The attribute is initalised with a default value of EAttributeNotSupported
77 @param aAttribute The attribute to add to the set
79 IMPORT_C void AddL(TInt aAttribute);
81 /** Get the value of a specified attribute
82 @param aAttribute The attribute to query
83 @param aValue The value of the attribute
84 @return Whether the value parameter was updated
85 @return KErrNone The attribute value was updated
86 @return KErrNotFound The attribute is not part of the set
88 IMPORT_C TInt GetValue(TInt aAttribute, TInt& aValue) const;
90 /** Set the value of an attribute within the set
91 @param aAttribute The attribute to set
92 @param aValue The value of the attribute
93 @param aErrorCode The error code to return when this attribute is requested via the GetValue() function
94 @return Whether the new attribute value was set
95 @return KErrNone if the value was set
96 @return KErrNotFound if the attribute is not part of the set
98 IMPORT_C TInt SetValue(TInt aAttribute, TInt aValue, TInt aErrorCode);
100 /** Find the attribute stored at a particular index in the set
101 @param aIndex The index of the attribute
102 @return The attribute, NOT the value of the attribute
104 IMPORT_C TInt operator [] (TInt aIndex) const;
106 /** The number of attributes in the set
107 @return The number of attributes in the set
109 IMPORT_C TInt Count() const;
111 /** Write the RAttributeSet to a stream
112 @param aStream The stream to write the attribute set to
114 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
116 /** Read the RAttributeSet from a stream
117 This does not clear the contents of the attribute set before reading. The
118 values of any attributes already in the set are updated with new values
119 from the stream. New attributes from the stream and their values are added
121 @param aStream The stream to read the attribute set from
123 IMPORT_C void InternalizeL(RReadStream& aStream);
126 void AddL(TInt aAttribute, TInt aValue, TInt aErrorCode);
128 RArray <TAttributeValue> iAttributes;