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