25
|
1 |
/*
|
|
2 |
* Copyright (c) 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 "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: Metadata backend engine
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
19
|
18 |
#ifndef CMETADATA_UTILITY_ITF_H
|
|
19 |
#define CMETADATA_UTILITY_ITF_H
|
|
20 |
|
|
21 |
#ifdef __cplusplus
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <e32std.h>
|
|
25 |
#include <e32hashtab.h>
|
|
26 |
#include <OpenMAXAL.h>
|
|
27 |
|
20
|
28 |
#include <hxmetadatautil.h>
|
19
|
29 |
#include <MetaDataUtility.h>
|
|
30 |
#include <MetaDataFieldContainer.h>
|
|
31 |
#include <MetaDataField.hrh>
|
|
32 |
|
|
33 |
#define MAX_EXTENSION_SIZE 10
|
|
34 |
#define uint32 unsigned int
|
|
35 |
|
|
36 |
class CS60MetadataUtilityItf;
|
|
37 |
class CHXMetadataUtilityItf;
|
|
38 |
|
|
39 |
NONSHARABLE_CLASS(CMetadataUtilityItf)
|
25
|
40 |
{
|
19
|
41 |
public:
|
|
42 |
|
25
|
43 |
enum TValueEncodingType
|
|
44 |
{
|
|
45 |
EUnknownEncoding, EAsciiEncoding, EUnicodeEncoding, EBinaryEncoding,
|
|
46 |
};
|
|
47 |
|
|
48 |
static CMetadataUtilityItf* New(char* uri);
|
19
|
49 |
|
25
|
50 |
CMetadataUtilityItf();
|
|
51 |
virtual ~CMetadataUtilityItf();
|
|
52 |
TInt ParseSource(char* uri);
|
|
53 |
TInt OpenSource(char* uri);
|
|
54 |
TInt CalculateNumMetadataItems(TUint*);
|
|
55 |
char* GetKey(TInt index);
|
|
56 |
TInt GetValueSize(TInt index);
|
|
57 |
TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize,
|
|
58 |
TInt* encodingType);
|
19
|
59 |
|
25
|
60 |
//helper function
|
|
61 |
//extracts left part of input descriptor upto (maxLen-1) and copies content in outPtr
|
|
62 |
//append a null terminator
|
|
63 |
static TInt ExtractUCS2(TDesC& inDes, char* outPtr, TInt maxLen);
|
19
|
64 |
|
|
65 |
private:
|
25
|
66 |
CS60MetadataUtilityItf* m_pS60Util;
|
|
67 |
CHXMetadataUtilityItf* m_pHXUtil;
|
|
68 |
};
|
19
|
69 |
|
|
70 |
NONSHARABLE_CLASS(CS60MetadataUtilityItf)
|
25
|
71 |
{
|
19
|
72 |
public:
|
|
73 |
|
25
|
74 |
static CS60MetadataUtilityItf* New();
|
|
75 |
~CS60MetadataUtilityItf();
|
19
|
76 |
|
25
|
77 |
TInt CalculateNumMetadataItems(TUint*);
|
19
|
78 |
|
25
|
79 |
char* GetKey(TInt index);
|
|
80 |
TInt GetValueSize(TInt index);
|
|
81 |
TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize,
|
|
82 |
TInt* encodingType);
|
|
83 |
|
|
84 |
TInt ParseSource(TDesC&);
|
19
|
85 |
|
25
|
86 |
char* KeyMapping(TMetaDataFieldId);
|
|
87 |
TInt ValueEncoding(TMetaDataFieldId);
|
19
|
88 |
|
25
|
89 |
static bool IsSupportedExtension(char* extn);
|
19
|
90 |
|
25
|
91 |
TInt Reset();
|
19
|
92 |
|
|
93 |
private:
|
25
|
94 |
|
19
|
95 |
CS60MetadataUtilityItf();
|
|
96 |
void ConstructL();
|
25
|
97 |
|
|
98 |
CMetaDataUtility* pMetaDataUtility; //S60MetadataUtility
|
|
99 |
|
|
100 |
TUint uNumMetadataItems;
|
|
101 |
|
|
102 |
};
|
19
|
103 |
|
|
104 |
NONSHARABLE_CLASS(CHXMetadataUtilityItf)
|
25
|
105 |
{
|
19
|
106 |
public:
|
|
107 |
|
25
|
108 |
static CHXMetadataUtilityItf* New();
|
|
109 |
~CHXMetadataUtilityItf();
|
|
110 |
|
|
111 |
TInt CalculateNumMetadataItems(TUint*);
|
|
112 |
|
|
113 |
char* GetKey(TInt index);
|
19
|
114 |
|
25
|
115 |
TInt ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID);
|
|
116 |
TInt GetValueSize(TInt index);
|
|
117 |
TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize,
|
|
118 |
TInt* encodingType);
|
|
119 |
|
|
120 |
TInt ParseSource(TDesC&);
|
|
121 |
char* KeyMapping(HXMetaDataKeys::EHXMetaDataId);
|
|
122 |
|
|
123 |
TInt Reset();
|
19
|
124 |
|
|
125 |
private:
|
25
|
126 |
CHXMetadataUtilityItf();
|
19
|
127 |
void ConstructL();
|
25
|
128 |
|
|
129 |
CHXMetaDataUtility *pHXMetaDataUtility;
|
19
|
130 |
|
25
|
131 |
TUint uNumMetadataItems;
|
|
132 |
};
|
19
|
133 |
|
|
134 |
#else
|
|
135 |
|
|
136 |
extern void* mmf_metadata_utility_init(char*);
|
25
|
137 |
extern void mmf_metadata_utility_destroy(void* context);
|
19
|
138 |
extern XAresult mmf_metadata_utility_parse_source(void* , char*);
|
25
|
139 |
extern XAresult mmf_get_item_count(void* context, XAuint32* itemCount);
|
|
140 |
extern XAresult mmf_get_key_size(void* context, XAuint32 keyIndex, XAuint32* keySize);
|
|
141 |
extern XAresult mmf_get_key(void* context, XAuint32 index,XAuint32 keySize, XAMetadataInfo *pKey);
|
|
142 |
extern XAresult mmf_get_value_size(void* context, XAuint32 index, XAuint32 *pValueSize);
|
|
143 |
extern XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue);
|
19
|
144 |
#endif //__cplusplus
|
|
145 |
#endif
|