epoc32/include/caf/stringattributeset.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 /**
    22  @file
    23  @publishedPartner
    24  @released
    25 */
    26 
    27 
    28 #ifndef __STRINGATTRIBUTESET_H__
    29 #define __STRINGATTRIBUTESET_H__
    30 
    31 #include <e32base.h>
    32 #include <caf/caftypes.h>
    33 
    34 class RReadStream;
    35 class RWriteStream;
    36 
    37 namespace ContentAccess
    38 	{
    39 	class CStringAttribute;
    40 
    41 	/** Holds the values of a predefined set of attributes based upon 
    42 	ContentAccess::TStringAttribute
    43 	
    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.
    47 
    48 	No duplicate attributes are allowed in the set
    49 
    50 	@publishedPartner
    51 	@released
    52 	*/
    53 	class RStringAttributeSet
    54 		{
    55 	public:
    56 		IMPORT_C RStringAttributeSet();
    57 		
    58 		/** Release all resources used by the RStringAttributeSet
    59 		
    60 		This must be called before the RStringAttribute set goes out of scope
    61 		*/
    62 		IMPORT_C void Close();
    63 
    64 		/** Add a new attribute to the set
    65 		The attribute value is initalised with an empty string
    66 		
    67 		@param aAttribute The attribute to add to the set
    68 		*/
    69 		IMPORT_C void AddL(TInt aAttribute);
    70 
    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
    77 		*/
    78 		IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
    79 		
    80 
    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
    84 		*/
    85 		IMPORT_C TInt GetValueLength(TInt aAttribute) const;
    86 		
    87 
    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
    93 		*/
    94 		IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
    95 		
    96 
    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
   100 		*/
   101 		IMPORT_C TInt operator [] (TInt aIndex) const;
   102 
   103 		/** The number of attributes in the set
   104 		@return The number of attributes in the set
   105 		*/
   106 		IMPORT_C TInt Count() const;
   107 		
   108 		/** Write the RAttributeSet to a stream
   109 		@param aStream The stream to write the attribute set to
   110 		*/
   111 		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   112 
   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
   117 		to the set.
   118 		@param aStream The stream to read the attribute set from
   119 		*/
   120 		IMPORT_C void InternalizeL(RReadStream& aStream);
   121 
   122 	private:
   123 		void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
   124 
   125 		RPointerArray <CStringAttribute> iAttributes;
   126 		};
   127 	}
   128 #endif