epoc32/include/caf/metadataarray.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/caf/metadataarray.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,127 @@
     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 +
    1.24 +/**
    1.25 + @file
    1.26 + @publishedPartner
    1.27 + @released
    1.28 +*/
    1.29 +
    1.30 +
    1.31 +#ifndef __CAF_METADATAARRAY_H__
    1.32 +#define __CAF_METADATAARRAY_H__
    1.33 +
    1.34 +#include <e32base.h>
    1.35 +#include <f32file.h>
    1.36 +
    1.37 +class RWriteStream;
    1.38 +class RReadStream;
    1.39 +
    1.40 +namespace ContentAccess
    1.41 +	{
    1.42 +	class CMetaData;
    1.43 +
    1.44 +	/**
    1.45 +	Stores an array of CMetaData objects for use in a supplier import operation
    1.46 +	
    1.47 +	It provides search and routines (for both 8 bit and Unicode) to find the
    1.48 +	value corresponding to a particular field in the array.
    1.49 +
    1.50 +  	Applications should use the unicode search function whenever possible because 
    1.51 +	it removes the risk of losing information during the unicode to 8 bit 
    1.52 +	conversion.
    1.53 +
    1.54 +	@publishedPartner
    1.55 +	@released
    1.56 +	*/
    1.57 +	class CMetaDataArray : public CBase
    1.58 +		{
    1.59 +	public:
    1.60 +	
    1.61 +		IMPORT_C static CMetaDataArray* NewL();
    1.62 +		IMPORT_C static CMetaDataArray* NewLC();
    1.63 +
    1.64 +		/** Construct a CMetaDataArray from a stream
    1.65 +		@param aStream the stream containing the metadata array
    1.66 +		@return a new CMetaDataArray
    1.67 +		*/
    1.68 +		IMPORT_C static CMetaDataArray* NewL(RReadStream& aStream);
    1.69 +
    1.70 +		/** Destructor */
    1.71 +		virtual ~CMetaDataArray();
    1.72 +
    1.73 +		/** Adds a new meta data,
    1.74 +		@param aField The name used to index the value of interest
    1.75 +		@param aData		The data
    1.76 +		*/		
    1.77 +		IMPORT_C void AddL(const TDesC8& aField, const TDesC8& aData);
    1.78 +
    1.79 +		/** Adds a new meta data,
    1.80 +		@param aField The name used to index the value of interest
    1.81 +		@param aData		The data
    1.82 +		*/		
    1.83 +		IMPORT_C void AddL(const TDesC& aField, const TDesC& aData);
    1.84 +
    1.85 +		/** Retrieves the MetaData at the given index
    1.86 +		*
    1.87 +		* @param aIndex	The index of the meta-data
    1.88 +		* @return		
    1.89 +		*/
    1.90 +		IMPORT_C const CMetaData& operator [] (TInt aIndex) const;
    1.91 +
    1.92 +		/** The number of metadata objects in the list
    1.93 +		*/
    1.94 +		IMPORT_C TInt Count() const;
    1.95 +
    1.96 +		/** Find the unicode data for a given unicode field. 
    1.97 +
    1.98 +		@param aField	The field to retrieve
    1.99 +		@param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
   1.100 +		@return The corresponding data or else a zero length string if the field was not found	
   1.101 +		*/
   1.102 +		IMPORT_C const TDesC& SearchL(const TDesC& aField, TBool aMatchCase = EFalse) const;
   1.103 +		
   1.104 +		/** Find the 8 bit data for a given 8 bit field. 
   1.105 +
   1.106 +		@param aField8	The field to retrieve
   1.107 +		@param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
   1.108 +		@return The corresponding data or else a zero length string if the field was not found
   1.109 +		*/
   1.110 +		IMPORT_C const TDesC8& SearchL(const TDesC8& aField8, TBool aMatchCase = EFalse) const;
   1.111 +		
   1.112 +		/** Externalizes the CMetaDataArray object to a stream.
   1.113 +		* 
   1.114 +		* @param aStream	The stream to write the header information to.
   1.115 +		*/
   1.116 +		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.117 +
   1.118 +	private:
   1.119 +		CMetaDataArray();
   1.120 +		void InternalizeL(RReadStream& aStream);
   1.121 +	private:
   1.122 +
   1.123 +		RPointerArray <CMetaData> iArray;  
   1.124 +
   1.125 +		// Length of the longest data item in the array
   1.126 +		TInt iMaxFieldLength;
   1.127 +		};
   1.128 +	}
   1.129 +
   1.130 +#endif