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