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
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
/**
williamr@2
    22
 @file
williamr@2
    23
 @publishedPartner
williamr@2
    24
 @released
williamr@2
    25
*/
williamr@2
    26
williamr@2
    27
williamr@2
    28
#ifndef __STRINGATTRIBUTESET_H__
williamr@2
    29
#define __STRINGATTRIBUTESET_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <caf/caftypes.h>
williamr@2
    33
williamr@2
    34
class RReadStream;
williamr@2
    35
class RWriteStream;
williamr@2
    36
williamr@2
    37
namespace ContentAccess
williamr@2
    38
	{
williamr@2
    39
	class CStringAttribute;
williamr@2
    40
williamr@2
    41
	/** Holds the values of a predefined set of attributes based upon 
williamr@2
    42
	ContentAccess::TStringAttribute
williamr@2
    43
	
williamr@2
    44
	It is also possible for an agent to provide an extended set of these 
williamr@2
    45
	attributes beyond EAgentSpecificAttributeBase but only applications written 
williamr@2
    46
	to support a that particular agent will support this.
williamr@2
    47
williamr@2
    48
	No duplicate attributes are allowed in the set
williamr@2
    49
williamr@2
    50
	@publishedPartner
williamr@2
    51
	@released
williamr@2
    52
	*/
williamr@2
    53
	class RStringAttributeSet
williamr@2
    54
		{
williamr@2
    55
	public:
williamr@2
    56
		IMPORT_C RStringAttributeSet();
williamr@2
    57
		
williamr@2
    58
		/** Release all resources used by the RStringAttributeSet
williamr@2
    59
		
williamr@2
    60
		This must be called before the RStringAttribute set goes out of scope
williamr@2
    61
		*/
williamr@2
    62
		IMPORT_C void Close();
williamr@2
    63
williamr@2
    64
		/** Add a new attribute to the set
williamr@2
    65
		The attribute value is initalised with an empty string
williamr@2
    66
		
williamr@2
    67
		@param aAttribute The attribute to add to the set
williamr@2
    68
		*/
williamr@2
    69
		IMPORT_C void AddL(TInt aAttribute);
williamr@2
    70
williamr@2
    71
		/** Get the value of a specified attribute
williamr@2
    72
		@param aAttribute The attribute to query
williamr@2
    73
		@param aValue The value of the attribute is copied to this descriptor
williamr@2
    74
		@return The value of the attribute
williamr@2
    75
		@return KErrOverflow If the descriptor is not large enough to store the attribute
williamr@2
    76
		@return KErrNotFound if the attribute is not part of the set
williamr@2
    77
		*/
williamr@2
    78
		IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
williamr@2
    79
		
williamr@2
    80
williamr@2
    81
		/** Get the length of a buffer required to store the value of a specified attribute
williamr@2
    82
		@param aAttribute The attribute to query
williamr@2
    83
		@return The length of the value of the attribute
williamr@2
    84
		*/
williamr@2
    85
		IMPORT_C TInt GetValueLength(TInt aAttribute) const;
williamr@2
    86
		
williamr@2
    87
williamr@2
    88
		/** Set the value of an attribute within the set
williamr@2
    89
		@param aAttribute The attribute to set
williamr@2
    90
		@param aValue The value of the attribute
williamr@2
    91
		@param aErrorCode The error to return when GetValue() is called for this attribute
williamr@2
    92
		@leave KErrNotFound if the attribute is not part of the set
williamr@2
    93
		*/
williamr@2
    94
		IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
williamr@2
    95
		
williamr@2
    96
williamr@2
    97
		/** Find the attribute stored at a particular index in the set
williamr@2
    98
		@param aIndex The index of the attribute
williamr@2
    99
		@return The attribute, NOT the value of the attribute
williamr@2
   100
		*/
williamr@2
   101
		IMPORT_C TInt operator [] (TInt aIndex) const;
williamr@2
   102
williamr@2
   103
		/** The number of attributes in the set
williamr@2
   104
		@return The number of attributes in the set
williamr@2
   105
		*/
williamr@2
   106
		IMPORT_C TInt Count() const;
williamr@2
   107
		
williamr@2
   108
		/** Write the RAttributeSet to a stream
williamr@2
   109
		@param aStream The stream to write the attribute set to
williamr@2
   110
		*/
williamr@2
   111
		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   112
williamr@2
   113
		/** Read the RAttributeSet from a stream
williamr@2
   114
		This does not clear the contents of the attribute set before reading. The 
williamr@2
   115
		values of any attributes already in the set are updated with new values 
williamr@2
   116
		from the stream. New attributes from the stream and their values are added
williamr@2
   117
		to the set.
williamr@2
   118
		@param aStream The stream to read the attribute set from
williamr@2
   119
		*/
williamr@2
   120
		IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   121
williamr@2
   122
	private:
williamr@2
   123
		void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
williamr@2
   124
williamr@2
   125
		RPointerArray <CStringAttribute> iAttributes;
williamr@2
   126
		};
williamr@2
   127
	}
williamr@2
   128
#endif