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