First public contribution.
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.
26 #ifndef __ATTRIBUTESET_H__
27 #define __ATTRIBUTESET_H__
30 #include <caf/caftypes.h>
35 namespace ContentAccess
38 /** Holds the values of a predefined set of attributes based upon
39 ContentAccess::TAttribute
41 It is also possible for an agent to provide an extended set of these
42 attributes beyond EAgentSpecificAttributeBase but only applications written
43 to support that particular agent will support this.
45 No duplicate attributes are allowed in the set
49 /** Holds the value of an attribute along with any error encountered
50 while retrieving the attribute
61 IMPORT_C RAttributeSet();
63 /** Release all resources used by the RAttributeSet
65 This must be called before the RAttribute set goes out of scope
67 IMPORT_C void Close();
69 /** Add a new attribute to the set
70 The attribute is initalised with a default value of EAttributeNotSupported
72 @param aAttribute The attribute to add to the set
74 IMPORT_C void AddL(TInt aAttribute);
76 /** Get the value of a specified attribute
77 @param aAttribute The attribute to query
78 @param aValue The value of the attribute
79 @return Whether the value parameter was updated
80 @return KErrNone The attribute value was updated
81 @return KErrNotFound The attribute is not part of the set
83 IMPORT_C TInt GetValue(TInt aAttribute, TInt& aValue) const;
85 /** Set the value of an attribute within the set
86 @param aAttribute The attribute to set
87 @param aValue The value of the attribute
88 @param aErrorCode The error code to return when this attribute is requested via the GetValue() function
89 @return Whether the new attribute value was set
90 @return KErrNone if the value was set
91 @return KErrNotFound if the attribute is not part of the set
93 IMPORT_C TInt SetValue(TInt aAttribute, TInt aValue, TInt aErrorCode);
95 /** Find the attribute stored at a particular index in the set
96 @param aIndex The index of the attribute
97 @return The attribute, NOT the value of the attribute
99 IMPORT_C TInt operator [] (TInt aIndex) const;
101 /** The number of attributes in the set
102 @return The number of attributes in the set
104 IMPORT_C TInt Count() const;
106 /** Write the RAttributeSet to a stream
107 @param aStream The stream to write the attribute set to
109 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
111 /** Read the RAttributeSet from a stream
112 This does not clear the contents of the attribute set before reading. The
113 values of any attributes already in the set are updated with new values
114 from the stream. New attributes from the stream and their values are added
116 @param aStream The stream to read the attribute set from
118 IMPORT_C void InternalizeL(RReadStream& aStream);
121 void AddL(TInt aAttribute, TInt aValue, TInt aErrorCode);
123 RArray <TAttributeValue> iAttributes;