williamr@2
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __DICTIONARYCODEPAGE_H__
|
williamr@2
|
17 |
#define __DICTIONARYCODEPAGE_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32base.h>
|
williamr@2
|
20 |
#include <stringpool.h>
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
namespace Xml
|
williamr@2
|
24 |
{
|
williamr@2
|
25 |
|
williamr@2
|
26 |
class CDictionaryCodePage : public CBase
|
williamr@2
|
27 |
/**
|
williamr@2
|
28 |
The CDictionaryCodePage, represents a single numeric code page for Elements, Attributes, and
|
williamr@2
|
29 |
AttributeValues.
|
williamr@2
|
30 |
|
williamr@2
|
31 |
This object refers to the appropriate string pool tables, and creates mappings between
|
williamr@2
|
32 |
strings in these tables and their token values.
|
williamr@2
|
33 |
|
williamr@2
|
34 |
Used mainly for wbxml document parsing, and allows for the quick comparison of strings.
|
williamr@2
|
35 |
|
williamr@2
|
36 |
This object is associated with a string dictionary via a user defined class.
|
williamr@2
|
37 |
|
williamr@2
|
38 |
@see RStringPool
|
williamr@2
|
39 |
@see CStringDictionary
|
williamr@2
|
40 |
|
williamr@2
|
41 |
@publishedPartner
|
williamr@2
|
42 |
@released
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
{
|
williamr@2
|
45 |
|
williamr@2
|
46 |
public:
|
williamr@2
|
47 |
|
williamr@2
|
48 |
enum TStringType
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
A structure for describing the types of string pool table associated with this class.
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
{
|
williamr@2
|
53 |
EStringTypeElement,
|
williamr@2
|
54 |
EStringTypeAttribute,
|
williamr@2
|
55 |
EStringTypeAttributeValue
|
williamr@2
|
56 |
};
|
williamr@2
|
57 |
|
williamr@2
|
58 |
|
williamr@2
|
59 |
public:
|
williamr@2
|
60 |
|
williamr@2
|
61 |
IMPORT_C static CDictionaryCodePage* NewL(const TStringTable* aElementTable,
|
williamr@2
|
62 |
const TStringTable* aAttributeTable,
|
williamr@2
|
63 |
const TStringTable* aValueTable,
|
williamr@2
|
64 |
TUint8 aCodePage);
|
williamr@2
|
65 |
|
williamr@2
|
66 |
IMPORT_C virtual ~CDictionaryCodePage();
|
williamr@2
|
67 |
|
williamr@2
|
68 |
IMPORT_C const TStringTable* StringTable(TStringType aType) const;
|
williamr@2
|
69 |
IMPORT_C TUint8 CodePage() const;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
IMPORT_C TInt StringPoolIndexFromToken(TInt aToken, TStringType aType) const;
|
williamr@2
|
72 |
IMPORT_C TInt TokenFromStringPoolIndex(TInt aIndex, TStringType aType) const;
|
williamr@2
|
73 |
|
williamr@2
|
74 |
IMPORT_C void ConstructIndexMappingL(const TInt* aStringPoolToTokenMapping, TStringType aType);
|
williamr@2
|
75 |
|
williamr@2
|
76 |
private:
|
williamr@2
|
77 |
|
williamr@2
|
78 |
CDictionaryCodePage(const TStringTable* aElementTable, const TStringTable* aAttributeTable,
|
williamr@2
|
79 |
const TStringTable* aValueTable, TUint8 aCodePage);
|
williamr@2
|
80 |
|
williamr@2
|
81 |
CDictionaryCodePage(const CDictionaryCodePage& aOriginal);
|
williamr@2
|
82 |
CDictionaryCodePage& operator=(const CDictionaryCodePage& aRhs);
|
williamr@2
|
83 |
|
williamr@2
|
84 |
private:
|
williamr@2
|
85 |
|
williamr@2
|
86 |
struct TStringPoolTokenMapping
|
williamr@2
|
87 |
/**
|
williamr@2
|
88 |
The TStringPoolTokenMapping struct stores a mapping between table index and
|
williamr@2
|
89 |
token values for a single string entry.
|
williamr@2
|
90 |
*/
|
williamr@2
|
91 |
{
|
williamr@2
|
92 |
TInt iTokenValue;
|
williamr@2
|
93 |
TInt iTableIndex;
|
williamr@2
|
94 |
};
|
williamr@2
|
95 |
|
williamr@2
|
96 |
static TInt CompareStringPoolTokenMappingTable(const TStringPoolTokenMapping& aFirst,
|
williamr@2
|
97 |
const TStringPoolTokenMapping& aSecond);
|
williamr@2
|
98 |
private:
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
Pointer to the static Element string pool table.
|
williamr@2
|
102 |
We do not own this.
|
williamr@2
|
103 |
*/
|
williamr@2
|
104 |
const TStringTable* iElementTable;
|
williamr@2
|
105 |
|
williamr@2
|
106 |
/**
|
williamr@2
|
107 |
Pointer to the static Attribute string pool table.
|
williamr@2
|
108 |
We do not own this.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
const TStringTable* iAttributeTable;
|
williamr@2
|
111 |
|
williamr@2
|
112 |
/**
|
williamr@2
|
113 |
Pointer to the static AttributeValue string pool table.
|
williamr@2
|
114 |
We do not own this.
|
williamr@2
|
115 |
*/
|
williamr@2
|
116 |
const TStringTable* iValueTable;
|
williamr@2
|
117 |
|
williamr@2
|
118 |
/**
|
williamr@2
|
119 |
Array to obtain a Element Token from String Pool index.
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
RArray<TInt> iElementStringPoolIndexToToken;
|
williamr@2
|
122 |
|
williamr@2
|
123 |
/**
|
williamr@2
|
124 |
Array to obtain a Element String Pool Index from a token.
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
RArray<TStringPoolTokenMapping> iElementTokenToStringPoolIndex;
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
Array to obtain a Attribute Token from String Pool index.
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
RArray<TInt> iAttributeStringPoolIndexToToken;
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
Array to obtain a Attribute String Pool Index from a token.
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
RArray<TStringPoolTokenMapping> iAttributeTokenToStringPoolIndex;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/**
|
williamr@2
|
139 |
Array to obtain a Value Token from String Pool index.
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
RArray<TInt> iValueStringPoolIndexToToken;
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
Array to obtain a Value String Pool Index from a token.
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
RArray<TStringPoolTokenMapping> iValueTokenToStringPoolIndex;
|
williamr@2
|
147 |
|
williamr@2
|
148 |
|
williamr@2
|
149 |
/**
|
williamr@2
|
150 |
The numeric codepage this object represents.
|
williamr@2
|
151 |
*/
|
williamr@2
|
152 |
TUint8 iCodePage;
|
williamr@2
|
153 |
|
williamr@2
|
154 |
};
|
williamr@2
|
155 |
|
williamr@2
|
156 |
}
|
williamr@2
|
157 |
|
williamr@2
|
158 |
#endif // __DICTIONARYCODEPAGE_H__
|