1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/inc/stringattributeset.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,124 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +
1.29 +#ifndef __STRINGATTRIBUTESET_H__
1.30 +#define __STRINGATTRIBUTESET_H__
1.31 +
1.32 +#include <e32base.h>
1.33 +#include <caf/caftypes.h>
1.34 +
1.35 +class RReadStream;
1.36 +class RWriteStream;
1.37 +
1.38 +namespace ContentAccess
1.39 + {
1.40 + class CStringAttribute;
1.41 +
1.42 + /** Holds the values of a predefined set of attributes based upon
1.43 + ContentAccess::TStringAttribute
1.44 +
1.45 + It is also possible for an agent to provide an extended set of these
1.46 + attributes beyond EAgentSpecificAttributeBase but only applications written
1.47 + to support that particular agent will support this.
1.48 +
1.49 + No duplicate attributes are allowed in the set
1.50 +
1.51 + */
1.52 + class RStringAttributeSet
1.53 + {
1.54 + public:
1.55 + IMPORT_C RStringAttributeSet();
1.56 +
1.57 + /** Release all resources used by the RStringAttributeSet
1.58 +
1.59 + This must be called before the RStringAttribute set goes out of scope
1.60 + */
1.61 + IMPORT_C void Close();
1.62 +
1.63 + /** Add a new attribute to the set
1.64 + The attribute value is initalised with an empty string
1.65 +
1.66 + @param aAttribute The attribute to add to the set
1.67 + */
1.68 + IMPORT_C void AddL(TInt aAttribute);
1.69 +
1.70 + /** Get the value of a specified attribute
1.71 + @param aAttribute The attribute to query
1.72 + @param aValue The value of the attribute is copied to this descriptor
1.73 + @return The value of the attribute
1.74 + @return KErrOverflow If the descriptor is not large enough to store the attribute
1.75 + @return KErrNotFound if the attribute is not part of the set
1.76 + */
1.77 + IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
1.78 +
1.79 +
1.80 + /** Get the length of a buffer required to store the value of a specified attribute
1.81 + @param aAttribute The attribute to query
1.82 + @return The length of the value of the attribute
1.83 + */
1.84 + IMPORT_C TInt GetValueLength(TInt aAttribute) const;
1.85 +
1.86 +
1.87 + /** Set the value of an attribute within the set
1.88 + @param aAttribute The attribute to set
1.89 + @param aValue The value of the attribute
1.90 + @param aErrorCode The error to return when GetValue() is called for this attribute
1.91 + @leave KErrNotFound if the attribute is not part of the set
1.92 + */
1.93 + IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
1.94 +
1.95 +
1.96 + /** Find the attribute stored at a particular index in the set
1.97 + @param aIndex The index of the attribute
1.98 + @return The attribute, NOT the value of the attribute
1.99 + */
1.100 + IMPORT_C TInt operator [] (TInt aIndex) const;
1.101 +
1.102 + /** The number of attributes in the set
1.103 + @return The number of attributes in the set
1.104 + */
1.105 + IMPORT_C TInt Count() const;
1.106 +
1.107 + /** Write the RAttributeSet to a stream
1.108 + @param aStream The stream to write the attribute set to
1.109 + */
1.110 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.111 +
1.112 + /** Read the RAttributeSet from a stream
1.113 + This does not clear the contents of the attribute set before reading. The
1.114 + values of any attributes already in the set are updated with new values
1.115 + from the stream. New attributes from the stream and their values are added
1.116 + to the set.
1.117 + @param aStream The stream to read the attribute set from
1.118 + */
1.119 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.120 +
1.121 + private:
1.122 + void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
1.123 +
1.124 + RPointerArray <CStringAttribute> iAttributes;
1.125 + };
1.126 + }
1.127 +#endif