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 __STRINGATTRIBUTESET_H__
27 #define __STRINGATTRIBUTESET_H__
30 #include <caf/caftypes.h>
35 namespace ContentAccess
37 class CStringAttribute;
39 /** Holds the values of a predefined set of attributes based upon
40 ContentAccess::TStringAttribute
42 It is also possible for an agent to provide an extended set of these
43 attributes beyond EAgentSpecificAttributeBase but only applications written
44 to support that particular agent will support this.
46 No duplicate attributes are allowed in the set
49 class RStringAttributeSet
52 IMPORT_C RStringAttributeSet();
54 /** Release all resources used by the RStringAttributeSet
56 This must be called before the RStringAttribute set goes out of scope
58 IMPORT_C void Close();
60 /** Add a new attribute to the set
61 The attribute value is initalised with an empty string
63 @param aAttribute The attribute to add to the set
65 IMPORT_C void AddL(TInt aAttribute);
67 /** Get the value of a specified attribute
68 @param aAttribute The attribute to query
69 @param aValue The value of the attribute is copied to this descriptor
70 @return The value of the attribute
71 @return KErrOverflow If the descriptor is not large enough to store the attribute
72 @return KErrNotFound if the attribute is not part of the set
74 IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
77 /** Get the length of a buffer required to store the value of a specified attribute
78 @param aAttribute The attribute to query
79 @return The length of the value of the attribute
81 IMPORT_C TInt GetValueLength(TInt aAttribute) const;
84 /** Set the value of an attribute within the set
85 @param aAttribute The attribute to set
86 @param aValue The value of the attribute
87 @param aErrorCode The error to return when GetValue() is called for this attribute
88 @leave KErrNotFound if the attribute is not part of the set
90 IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
93 /** Find the attribute stored at a particular index in the set
94 @param aIndex The index of the attribute
95 @return The attribute, NOT the value of the attribute
97 IMPORT_C TInt operator [] (TInt aIndex) const;
99 /** The number of attributes in the set
100 @return The number of attributes in the set
102 IMPORT_C TInt Count() const;
104 /** Write the RAttributeSet to a stream
105 @param aStream The stream to write the attribute set to
107 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
109 /** Read the RAttributeSet from a stream
110 This does not clear the contents of the attribute set before reading. The
111 values of any attributes already in the set are updated with new values
112 from the stream. New attributes from the stream and their values are added
114 @param aStream The stream to read the attribute set from
116 IMPORT_C void InternalizeL(RReadStream& aStream);
119 void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
121 RPointerArray <CStringAttribute> iAttributes;