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 __STRINGATTRIBUTESET_H__
29 #define __STRINGATTRIBUTESET_H__
32 #include <caf/caftypes.h>
37 namespace ContentAccess
39 class CStringAttribute;
41 /** Holds the values of a predefined set of attributes based upon
42 ContentAccess::TStringAttribute
44 It is also possible for an agent to provide an extended set of these
45 attributes beyond EAgentSpecificAttributeBase but only applications written
46 to support a that particular agent will support this.
48 No duplicate attributes are allowed in the set
53 class RStringAttributeSet
56 IMPORT_C RStringAttributeSet();
58 /** Release all resources used by the RStringAttributeSet
60 This must be called before the RStringAttribute set goes out of scope
62 IMPORT_C void Close();
64 /** Add a new attribute to the set
65 The attribute value is initalised with an empty string
67 @param aAttribute The attribute to add to the set
69 IMPORT_C void AddL(TInt aAttribute);
71 /** Get the value of a specified attribute
72 @param aAttribute The attribute to query
73 @param aValue The value of the attribute is copied to this descriptor
74 @return The value of the attribute
75 @return KErrOverflow If the descriptor is not large enough to store the attribute
76 @return KErrNotFound if the attribute is not part of the set
78 IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
81 /** Get the length of a buffer required to store the value of a specified attribute
82 @param aAttribute The attribute to query
83 @return The length of the value of the attribute
85 IMPORT_C TInt GetValueLength(TInt aAttribute) const;
88 /** Set the value of an attribute within the set
89 @param aAttribute The attribute to set
90 @param aValue The value of the attribute
91 @param aErrorCode The error to return when GetValue() is called for this attribute
92 @leave KErrNotFound if the attribute is not part of the set
94 IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
97 /** Find the attribute stored at a particular index in the set
98 @param aIndex The index of the attribute
99 @return The attribute, NOT the value of the attribute
101 IMPORT_C TInt operator [] (TInt aIndex) const;
103 /** The number of attributes in the set
104 @return The number of attributes in the set
106 IMPORT_C TInt Count() const;
108 /** Write the RAttributeSet to a stream
109 @param aStream The stream to write the attribute set to
111 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
113 /** Read the RAttributeSet from a stream
114 This does not clear the contents of the attribute set before reading. The
115 values of any attributes already in the set are updated with new values
116 from the stream. New attributes from the stream and their values are added
118 @param aStream The stream to read the attribute set from
120 IMPORT_C void InternalizeL(RReadStream& aStream);
123 void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
125 RPointerArray <CStringAttribute> iAttributes;