epoc32/include/caf/stringattributeset.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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
 @file
williamr@4
    21
 @publishedAll
williamr@2
    22
 @released
williamr@2
    23
*/
williamr@2
    24
williamr@2
    25
williamr@2
    26
#ifndef __STRINGATTRIBUTESET_H__
williamr@2
    27
#define __STRINGATTRIBUTESET_H__
williamr@2
    28
williamr@2
    29
#include <e32base.h>
williamr@2
    30
#include <caf/caftypes.h>
williamr@2
    31
williamr@2
    32
class RReadStream;
williamr@2
    33
class RWriteStream;
williamr@2
    34
williamr@2
    35
namespace ContentAccess
williamr@2
    36
	{
williamr@2
    37
	class CStringAttribute;
williamr@2
    38
williamr@2
    39
	/** Holds the values of a predefined set of attributes based upon 
williamr@2
    40
	ContentAccess::TStringAttribute
williamr@2
    41
	
williamr@2
    42
	It is also possible for an agent to provide an extended set of these 
williamr@2
    43
	attributes beyond EAgentSpecificAttributeBase but only applications written 
williamr@4
    44
	to support that particular agent will support this.
williamr@2
    45
williamr@2
    46
	No duplicate attributes are allowed in the set
williamr@2
    47
williamr@2
    48
	*/
williamr@2
    49
	class RStringAttributeSet
williamr@2
    50
		{
williamr@2
    51
	public:
williamr@2
    52
		IMPORT_C RStringAttributeSet();
williamr@2
    53
		
williamr@2
    54
		/** Release all resources used by the RStringAttributeSet
williamr@2
    55
		
williamr@2
    56
		This must be called before the RStringAttribute set goes out of scope
williamr@2
    57
		*/
williamr@2
    58
		IMPORT_C void Close();
williamr@2
    59
williamr@2
    60
		/** Add a new attribute to the set
williamr@2
    61
		The attribute value is initalised with an empty string
williamr@2
    62
		
williamr@2
    63
		@param aAttribute The attribute to add to the set
williamr@2
    64
		*/
williamr@2
    65
		IMPORT_C void AddL(TInt aAttribute);
williamr@2
    66
williamr@2
    67
		/** Get the value of a specified attribute
williamr@2
    68
		@param aAttribute The attribute to query
williamr@2
    69
		@param aValue The value of the attribute is copied to this descriptor
williamr@2
    70
		@return The value of the attribute
williamr@2
    71
		@return KErrOverflow If the descriptor is not large enough to store the attribute
williamr@2
    72
		@return KErrNotFound if the attribute is not part of the set
williamr@2
    73
		*/
williamr@2
    74
		IMPORT_C TInt GetValue(TInt aAttribute, TDes& aValue) const;
williamr@2
    75
		
williamr@2
    76
williamr@2
    77
		/** Get the length of a buffer required to store the value of a specified attribute
williamr@2
    78
		@param aAttribute The attribute to query
williamr@2
    79
		@return The length of the value of the attribute
williamr@2
    80
		*/
williamr@2
    81
		IMPORT_C TInt GetValueLength(TInt aAttribute) const;
williamr@2
    82
		
williamr@2
    83
williamr@2
    84
		/** Set the value of an attribute within the set
williamr@2
    85
		@param aAttribute The attribute to set
williamr@2
    86
		@param aValue The value of the attribute
williamr@2
    87
		@param aErrorCode The error to return when GetValue() is called for this attribute
williamr@2
    88
		@leave KErrNotFound if the attribute is not part of the set
williamr@2
    89
		*/
williamr@2
    90
		IMPORT_C TInt SetValue(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
williamr@2
    91
		
williamr@2
    92
williamr@2
    93
		/** Find the attribute stored at a particular index in the set
williamr@2
    94
		@param aIndex The index of the attribute
williamr@2
    95
		@return The attribute, NOT the value of the attribute
williamr@2
    96
		*/
williamr@2
    97
		IMPORT_C TInt operator [] (TInt aIndex) const;
williamr@2
    98
williamr@2
    99
		/** The number of attributes in the set
williamr@2
   100
		@return The number of attributes in the set
williamr@2
   101
		*/
williamr@2
   102
		IMPORT_C TInt Count() const;
williamr@2
   103
		
williamr@2
   104
		/** Write the RAttributeSet to a stream
williamr@2
   105
		@param aStream The stream to write the attribute set to
williamr@2
   106
		*/
williamr@2
   107
		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   108
williamr@2
   109
		/** Read the RAttributeSet from a stream
williamr@2
   110
		This does not clear the contents of the attribute set before reading. The 
williamr@2
   111
		values of any attributes already in the set are updated with new values 
williamr@2
   112
		from the stream. New attributes from the stream and their values are added
williamr@2
   113
		to the set.
williamr@2
   114
		@param aStream The stream to read the attribute set from
williamr@2
   115
		*/
williamr@2
   116
		IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   117
williamr@2
   118
	private:
williamr@2
   119
		void AddL(TInt aAttribute, const TDesC& aValue, TInt aErrorCode);
williamr@2
   120
williamr@2
   121
		RPointerArray <CStringAttribute> iAttributes;
williamr@2
   122
		};
williamr@2
   123
	}
williamr@2
   124
#endif