sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@publishedAll
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifndef __CAF_METADATAARRAY_H__
|
sl@0
|
27 |
#define __CAF_METADATAARRAY_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <e32base.h>
|
sl@0
|
30 |
#include <f32file.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
class RWriteStream;
|
sl@0
|
33 |
class RReadStream;
|
sl@0
|
34 |
|
sl@0
|
35 |
namespace ContentAccess
|
sl@0
|
36 |
{
|
sl@0
|
37 |
class CMetaData;
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
Stores an array of CMetaData objects for use in a supplier import operation
|
sl@0
|
41 |
|
sl@0
|
42 |
It provides search and routines (for both 8 bit and Unicode) to find the
|
sl@0
|
43 |
value corresponding to a particular field in the array.
|
sl@0
|
44 |
|
sl@0
|
45 |
Applications should use the unicode search function whenever possible because
|
sl@0
|
46 |
it removes the risk of losing information during the unicode to 8 bit
|
sl@0
|
47 |
conversion.
|
sl@0
|
48 |
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
class CMetaDataArray : public CBase
|
sl@0
|
51 |
{
|
sl@0
|
52 |
public:
|
sl@0
|
53 |
|
sl@0
|
54 |
IMPORT_C static CMetaDataArray* NewL();
|
sl@0
|
55 |
IMPORT_C static CMetaDataArray* NewLC();
|
sl@0
|
56 |
|
sl@0
|
57 |
/** Construct a CMetaDataArray from a stream
|
sl@0
|
58 |
@param aStream the stream containing the metadata array
|
sl@0
|
59 |
@return a new CMetaDataArray
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
IMPORT_C static CMetaDataArray* NewL(RReadStream& aStream);
|
sl@0
|
62 |
|
sl@0
|
63 |
/** Destructor */
|
sl@0
|
64 |
virtual ~CMetaDataArray();
|
sl@0
|
65 |
|
sl@0
|
66 |
/** Adds a new meta data,
|
sl@0
|
67 |
@param aField The name used to index the value of interest
|
sl@0
|
68 |
@param aData The data
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
IMPORT_C void AddL(const TDesC8& aField, const TDesC8& aData);
|
sl@0
|
71 |
|
sl@0
|
72 |
/** Adds a new meta data,
|
sl@0
|
73 |
@param aField The name used to index the value of interest
|
sl@0
|
74 |
@param aData The data
|
sl@0
|
75 |
*/
|
sl@0
|
76 |
IMPORT_C void AddL(const TDesC& aField, const TDesC& aData);
|
sl@0
|
77 |
|
sl@0
|
78 |
/** Retrieves the MetaData at the given index
|
sl@0
|
79 |
*
|
sl@0
|
80 |
* @param aIndex The index of the meta-data
|
sl@0
|
81 |
* @return
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
IMPORT_C const CMetaData& operator [] (TInt aIndex) const;
|
sl@0
|
84 |
|
sl@0
|
85 |
/** The number of metadata objects in the list
|
sl@0
|
86 |
*/
|
sl@0
|
87 |
IMPORT_C TInt Count() const;
|
sl@0
|
88 |
|
sl@0
|
89 |
/** Find the unicode data for a given unicode field.
|
sl@0
|
90 |
|
sl@0
|
91 |
@param aField The field to retrieve
|
sl@0
|
92 |
@param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
|
sl@0
|
93 |
@return The corresponding data or else a zero length string if the field was not found
|
sl@0
|
94 |
*/
|
sl@0
|
95 |
IMPORT_C const TDesC& SearchL(const TDesC& aField, TBool aMatchCase = EFalse) const;
|
sl@0
|
96 |
|
sl@0
|
97 |
/** Find the 8 bit data for a given 8 bit field.
|
sl@0
|
98 |
|
sl@0
|
99 |
@param aField8 The field to retrieve
|
sl@0
|
100 |
@param aMatchCase ETrue To perform case sensitive search, EFalse - To perform non case sensitive search
|
sl@0
|
101 |
@return The corresponding data or else a zero length string if the field was not found
|
sl@0
|
102 |
*/
|
sl@0
|
103 |
IMPORT_C const TDesC8& SearchL(const TDesC8& aField8, TBool aMatchCase = EFalse) const;
|
sl@0
|
104 |
|
sl@0
|
105 |
/** Externalizes the CMetaDataArray object to a stream.
|
sl@0
|
106 |
*
|
sl@0
|
107 |
* @param aStream The stream to write the header information to.
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
110 |
|
sl@0
|
111 |
private:
|
sl@0
|
112 |
CMetaDataArray();
|
sl@0
|
113 |
void InternalizeL(RReadStream& aStream);
|
sl@0
|
114 |
private:
|
sl@0
|
115 |
|
sl@0
|
116 |
RPointerArray <CMetaData> iArray;
|
sl@0
|
117 |
|
sl@0
|
118 |
// Length of the longest data item in the array
|
sl@0
|
119 |
TInt iMaxFieldLength;
|
sl@0
|
120 |
};
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
#endif
|