1.1 --- a/epoc32/include/wbconverter.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,471 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __WBCONVERTER_H
1.20 -#define __WBCONVERTER_H
1.21 -
1.22 -#include <e32std.h>
1.23 -#include <s32stor.h>
1.24 -#include <f32file.h>
1.25 -
1.26 -// forward declarations
1.27 -//
1.28 -class CWbxmlToken;
1.29 -class MWbxmlConverterObserver;
1.30 -class CByteList;
1.31 -class CCnvCharacterSetConverter;
1.32 -
1.33 -// consts, defines, enums
1.34 -//
1.35 -/**
1.36 -@publishedAll
1.37 -@deprecated
1.38 -*/
1.39 -_LIT8(KWbXmlVersion10,"<?xml version=\"1.0\"?>");
1.40 -
1.41 -/**
1.42 -@publishedAll
1.43 -@deprecated
1.44 -*/
1.45 -_LIT8(KWbPublicIdStartWml,"<!DOCTYPE wml PUBLIC \"");
1.46 -/**
1.47 -@publishedAll
1.48 -@deprecated
1.49 -*/
1.50 -_LIT8(KWbPublicIdStartSi,"<!DOCTYPE si PUBLIC \"");
1.51 -/**
1.52 -@publishedAll
1.53 -@deprecated
1.54 -*/
1.55 -_LIT8(KWbPublicIdStartSl,"<!DOCTYPE sl PUBLIC \"");
1.56 -
1.57 -
1.58 -/**
1.59 -@publishedAll
1.60 -@deprecated
1.61 -*/
1.62 -_LIT(KWbTokenDatabaseWml11,"\\RESOURCE\\WAPPUSH\\WMLC11.TOK");
1.63 -/**
1.64 -@publishedAll
1.65 -@deprecated
1.66 -*/
1.67 -_LIT(KWbTokenDatabaseWml12,"\\RESOURCE\\WAPPUSH\\WMLC12.TOK");
1.68 -/**
1.69 -@publishedAll
1.70 -@deprecated
1.71 -*/
1.72 -_LIT(KWbTokenDatabaseSI10,"\\RESOURCE\\WAPPUSH\\SI10.TOK");
1.73 -/**
1.74 -@publishedAll
1.75 -@deprecated
1.76 -*/
1.77 -_LIT(KWbTokenDatabaseSL10,"\\RESOURCE\\WAPPUSH\\SL10.TOK");
1.78 -
1.79 -/**
1.80 -@publishedAll
1.81 -@deprecated
1.82 -*/
1.83 -_LIT8(KWbPublicIdEnd11,"\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">");
1.84 -/**
1.85 -@publishedAll
1.86 -@deprecated
1.87 -*/
1.88 -_LIT8(KWbPublicIdEnd12,"\" \"http://www.wapforum.org/DTD/wml_1.2.xml\">");
1.89 -/**
1.90 -@publishedAll
1.91 -@deprecated
1.92 -*/
1.93 -_LIT8(KWbPublicIdEndSI10,"\" \"http://www.wapforum.org/DTD/si.dtd\">");
1.94 -/**
1.95 -@publishedAll
1.96 -@deprecated
1.97 -*/
1.98 -_LIT8(KWbPublicIdEndSL10,"\" \"http://www.wapforum.org/DTD/sl.dtd\">");
1.99 -
1.100 -/**
1.101 -@publishedAll
1.102 -@deprecated
1.103 -*/
1.104 -_LIT8(KWbTagStart,"<");
1.105 -/**
1.106 -@publishedAll
1.107 -@deprecated
1.108 -*/
1.109 -_LIT8(KWbTagStartClose,"</");
1.110 -/**
1.111 -@publishedAll
1.112 -@deprecated
1.113 -*/
1.114 -_LIT8(KWbTagEndWithContent,">");
1.115 -/**
1.116 -@publishedAll
1.117 -@deprecated
1.118 -*/
1.119 -_LIT8(KWbTagEndWithoutContent,"/>");
1.120 -/**
1.121 -@publishedAll
1.122 -@deprecated
1.123 -*/
1.124 -_LIT8(KWbVariableStart,"$(");
1.125 -/**
1.126 -@publishedAll
1.127 -@deprecated
1.128 -*/
1.129 -_LIT8(KWbVariableEscaped,":E)");
1.130 -/**
1.131 -@publishedAll
1.132 -@deprecated
1.133 -*/
1.134 -_LIT8(KWbVariableUnescaped,":U)");
1.135 -/**
1.136 -@publishedAll
1.137 -@deprecated
1.138 -*/
1.139 -_LIT8(KWbVariableNoescape,":N)");
1.140 -/**
1.141 -@publishedAll
1.142 -@deprecated
1.143 -*/
1.144 -_LIT8(KWbVariableNormal,")");
1.145 -/**
1.146 -@publishedAll
1.147 -@deprecated
1.148 -*/
1.149 -_LIT8(KWbQuote,"\"");
1.150 -/**
1.151 -@publishedAll
1.152 -@deprecated
1.153 -*/
1.154 -_LIT8(KWbSpace," ");
1.155 -/**
1.156 -@publishedAll
1.157 -@deprecated
1.158 -*/
1.159 -_LIT8(KWbTab,"\t");
1.160 -/**
1.161 -@publishedAll
1.162 -@deprecated
1.163 -*/
1.164 -_LIT8(KWbLineBreak,"\n");
1.165 -
1.166 -/**
1.167 -@publishedAll
1.168 -@deprecated
1.169 -*/
1.170 -const TInt8 KWbxmlIdIndex = 0;
1.171 -/**
1.172 -@publishedAll
1.173 -@deprecated
1.174 -*/
1.175 -const TInt8 KWbxmlIdUnknown = 1;
1.176 -/**
1.177 -@publishedAll
1.178 -@deprecated
1.179 -*/
1.180 -const TInt8 KWbxmlIdWml10 = 2;
1.181 -/**
1.182 -@publishedAll
1.183 -@deprecated
1.184 -*/
1.185 -const TInt8 KWbxmlIdWta10 = 3;
1.186 -/**
1.187 -@publishedAll
1.188 -@deprecated
1.189 -*/
1.190 -const TInt8 KWbxmlIdWml11 = 4;
1.191 -/**
1.192 -@publishedAll
1.193 -@deprecated
1.194 -*/
1.195 -const TInt8 KWbxmlIdSI = 5;
1.196 -/**
1.197 -@publishedAll
1.198 -@deprecated
1.199 -*/
1.200 -const TInt8 KWbxmlIdSL = 6;
1.201 -/**
1.202 -@publishedAll
1.203 -@deprecated
1.204 -*/
1.205 -const TInt8 KWbxmlIdWml12 = 9;
1.206 -
1.207 -// Entity translation literals
1.208 -/**
1.209 -@publishedAll
1.210 -@deprecated
1.211 -*/
1.212 -_LIT8(KEntityDollar,"$$");
1.213 -/**
1.214 -@publishedAll
1.215 -@deprecated
1.216 -*/
1.217 -_LIT8(KEntityAmp,"&");
1.218 -/**
1.219 -@publishedAll
1.220 -@deprecated
1.221 -*/
1.222 -_LIT8(KEntityLt,"<");
1.223 -/**
1.224 -@publishedAll
1.225 -@deprecated
1.226 -*/
1.227 -_LIT8(KEntityGt,">");
1.228 -/**
1.229 -@publishedAll
1.230 -@deprecated
1.231 -*/
1.232 -_LIT8(KEntityQuot,""");
1.233 -/**
1.234 -@publishedAll
1.235 -@deprecated
1.236 -*/
1.237 -_LIT8(KEntityApos,"'");
1.238 -/**
1.239 -@publishedAll
1.240 -@deprecated
1.241 -*/
1.242 -_LIT8(KEntityNbsp," ");
1.243 -/**
1.244 -@publishedAll
1.245 -@deprecated
1.246 -*/
1.247 -_LIT8(KEntityShy,"­");
1.248 -
1.249 -/**
1.250 -@publishedAll
1.251 -@deprecated
1.252 -*/
1.253 -const TUint16 KWbxmlSkipLiteralEndTagMagicToken = 0xac1d;
1.254 -
1.255 -
1.256 -///////////////////////////////////////////////////////////////////
1.257 -// CWbxmlConverter
1.258 -///////////////////////////////////////////////////////////////////
1.259 -class RFileReadStream;
1.260 -//##ModelId=3B6678E20007
1.261 -class CWbxmlConverter : public CBase
1.262 -/**
1.263 -@publishedAll
1.264 -@deprecated
1.265 -*/
1.266 -{
1.267 -public: // Methods
1.268 - //##ModelId=3B6678E30199
1.269 - ~CWbxmlConverter();
1.270 -
1.271 - // NOTE: input data really is 8bit bytecode
1.272 - //##ModelId=3B6678E300F9
1.273 - IMPORT_C static CWbxmlConverter* CWbxmlConverter::NewL(RFs& aFs, MWbxmlConverterObserver* aObserver);
1.274 - //##ModelId=3B6678E300BD
1.275 - IMPORT_C static CWbxmlConverter* CWbxmlConverter::NewLC(RFs& aFs, MWbxmlConverterObserver* aObserver);
1.276 - //##ModelId=3B6678E30135
1.277 - IMPORT_C static CWbxmlConverter* CWbxmlConverter::NewL(RFs& aFs, MWbxmlConverterObserver* aObserver, const TDesC* aCharacterEncoding);
1.278 - //##ModelId=3B6678E3009F
1.279 - IMPORT_C void ProcessDataL(HBufC8& aBuffer);
1.280 - //##ModelId=3B6678E3009E
1.281 - IMPORT_C void CommitL();
1.282 -
1.283 -private: // Emumerations
1.284 -
1.285 - enum TGotoState
1.286 - {
1.287 - EGotoStreaming = 1,
1.288 - EGotoString,
1.289 - EGotoOpaque
1.290 - };
1.291 - enum TConvertState
1.292 - {
1.293 - EConvertError = 1,
1.294 - EConvertVersion,
1.295 - EConvertPublicIdValue,
1.296 - EConvertCharset,
1.297 - EConvertStringTable,
1.298 - EConvertPublicIdName,
1.299 - EConvertData,
1.300 - EConvertFinished
1.301 - };
1.302 -
1.303 -private: // Methods
1.304 -
1.305 - //##ModelId=3B6678E30080
1.306 - CWbxmlConverter(RFs& aFs);
1.307 - //##ModelId=3B6678E30045
1.308 - void ConstructL(MWbxmlConverterObserver* aObserver, const TDesC* aCharacterEncoding);
1.309 -
1.310 - //##ModelId=3B6678E30044
1.311 - void HandleDataL();
1.312 - //##ModelId=3B6678E30009
1.313 - void SetNextStateL(const TInt aResult, const TConvertState aState);
1.314 - //##ModelId=3B6678E30008
1.315 - TInt ConvertWbxmlVersionL();
1.316 - //##ModelId=3B6678E203E8
1.317 - TInt ConvertPublicIdValueL(); // Extract PublicId
1.318 - //##ModelId=3B6678E203E7
1.319 - TInt ConvertPublicIdNameL(); // Report PublicId
1.320 - //##ModelId=3B6678E203E6
1.321 - TInt ConvertCharsetL();
1.322 - //##ModelId=3B6678E203DE
1.323 - TInt ConvertStringTableL();
1.324 - //##ModelId=3B6678E203DD
1.325 - TInt ConvertDataL();
1.326 - //##ModelId=3B6678E203DC
1.327 - TInt ConvertDataStreamingL();
1.328 - //##ModelId=3B6678E203D3
1.329 - TInt ConvertDataStringL();
1.330 - //##ModelId=3B6678E203D2
1.331 - TInt ConvertOpaqueDataL();
1.332 - //##ModelId=3B6678E203B4
1.333 - HBufC16* FormatDateStringL(TDesC8& aData);
1.334 -
1.335 - //##ModelId=3B6678E20396
1.336 - TInt OpenTokenFileL(HBufC& aFileName);
1.337 - //##ModelId=3B6678E2035A
1.338 - void ReadTokenFileL(RFileReadStream& aStream, HBufC8& aBuffer);
1.339 - //##ModelId=3B6678E2033C
1.340 - TInt LoadTokensL(HBufC* aBuffer);
1.341 -
1.342 - //##ModelId=3B6678E2030A
1.343 - TInt ExtractMultiByte(TUint32* aMultiByte, TInt aSkipHeader);
1.344 - //##ModelId=3B6678E202E3
1.345 - void Indent(const TInt aCount) const;
1.346 - //##ModelId=3B6678E202E2
1.347 - void FinishStringL();
1.348 - //##ModelId=3B6678E202C4
1.349 - HBufC16* CharsetConvertDataL(TDesC8& aData);
1.350 -
1.351 - // Gets the full path to wmlc token table. Input aTokenFilePath is the path, without the drive.
1.352 - //
1.353 - // In:
1.354 - // aTokenFilePath - the path to the token table file.
1.355 - //
1.356 - // Rtn: the full path to the token table file. Ownership is transfered to caller.
1.357 - //
1.358 - //##ModelId=3B6678E202A6
1.359 - HBufC* FindTokenFileL(const TDesC& aTokenFilePath) const;
1.360 -
1.361 - // Replaces characters originating from chracter entity references with the reference string
1.362 - // For example chracter '&' will be "decoded" back to "&"
1.363 - //
1.364 - // In:
1.365 - // aString - The original string containing the undedcoded characters.
1.366 - // This string can get ReAllocated during the process - DO NOT USE THIS POINTER
1.367 - // AFTER THE CALL to this method. (use the returned one instead...)
1.368 - // Return:
1.369 - // HBufC* - Pointer to the string with replaced stuff
1.370 - //
1.371 - //##ModelId=3B6678E20288
1.372 - HBufC* ReplaceCharacterEntitiesL(HBufC* aString);
1.373 -
1.374 - // MWbxmlConverterObserver interface overloads
1.375 - //##ModelId=3B6678E2024C
1.376 - void OutputL(const TUint32 aSource) const;
1.377 -
1.378 - //##ModelId=3B6678E2022E
1.379 - TBool OutputCheckQuoteL(HBufC8& aSource) const;
1.380 -
1.381 - // Helper method to optimise the OutputL oveloads
1.382 - //##ModelId=3B6678E20211
1.383 - void BufferAndOutputL(const TDesC8& aSource) const;
1.384 -
1.385 - // Must exist for Binary Compatibility
1.386 - //##ModelId=3B6678E20210
1.387 - IMPORT_C virtual void CWbxmlConverter_Reserved1();
1.388 -
1.389 -private: // Attributes
1.390 -
1.391 - // For binary compatibility
1.392 - //##ModelId=3B6678E20206
1.393 - TAny* CWbxmlConverter_Reserved;
1.394 -
1.395 - // Attributes
1.396 - // Note: conversion table from disk ie. you can change it at runtime
1.397 - //##ModelId=3B6678E201F2
1.398 - CArrayPtrFlat<CWbxmlToken>* iTagArray;
1.399 - //##ModelId=3B6678E201D3
1.400 - CArrayPtrFlat<CWbxmlToken>* iAttArray;
1.401 -
1.402 - //##ModelId=3B6678E2018D
1.403 - MWbxmlConverterObserver* iObserver;
1.404 -
1.405 - //##ModelId=3B6678E20179
1.406 - TUint8 iWbxmlVersion;
1.407 - //##ModelId=3B6678E20165
1.408 - TUint32 iWbxmlCharset;
1.409 - //##ModelId=3B6678E20151
1.410 - TUint32 iPublicId;
1.411 - //##ModelId=3B6678E2013D
1.412 - TUint32 iPublicIdIndex;
1.413 -
1.414 - // Note: must handle source as 8bit data even in Unicode compile!
1.415 - //##ModelId=3B6678E2012B
1.416 - CByteList* iByteList;
1.417 - //##ModelId=3B6678E2011F
1.418 - HBufC8* iStringTable;
1.419 - //##ModelId=3B6678E2010D
1.420 - HBufC8* iPublicIdStr;
1.421 - //##ModelId=3B6678E20101
1.422 - RFs& iFs;
1.423 -
1.424 - //##ModelId=3B6678E200ED
1.425 - TInt iState;
1.426 - //##ModelId=3B6678E200E3
1.427 - TUint32 iContinue;
1.428 -
1.429 - //##ModelId=3B6678E200D1
1.430 - TUint8 iVariable;
1.431 - //##ModelId=3B6678E200C5
1.432 - TUint8 hasAttrs;
1.433 - //##ModelId=3B6678E200B3
1.434 - TUint8 hasContent;
1.435 -
1.436 -
1.437 - //##ModelId=3B6678E200A7
1.438 - TInt iTagIndex;
1.439 - //##ModelId=3B6678E20095
1.440 - CArrayFixFlat<TUint16>* iTagStack;
1.441 - //##ModelId=3B6678E2006B
1.442 - TBool iRestrictedOutput;
1.443 -
1.444 - enum TParsing
1.445 - {
1.446 - EParseNot = 0,
1.447 - EParseTag,
1.448 - EParseAttrs
1.449 - };
1.450 - //##ModelId=3B6678E20059
1.451 - TParsing iParsing;
1.452 - //##ModelId=3B6678E2004F
1.453 - TBool iOpenQuote;
1.454 -
1.455 - //##ModelId=3B6678E20045
1.456 - mutable HBufC8* iOutputBuffer; // Buffered output buffer : Optimisation
1.457 -
1.458 - //##ModelId=3B6678E2003B
1.459 - CCnvCharacterSetConverter* iCharsetConverter;
1.460 -
1.461 -#ifdef __OUTPUT_WMLC
1.462 - //##ModelId=3B6678E20031
1.463 - RFile iWmlcFile; // Debug stuff
1.464 - //##ModelId=3B6678E20025
1.465 - RFs iWmlcFs; // Debug stuff
1.466 -#endif
1.467 -
1.468 -};
1.469 -
1.470 -#endif // __WBCONVERTER_H
1.471 -
1.472 -///////////////////////////////////////////////////////////////////
1.473 -// End of file
1.474 -///////////////////////////////////////////////////////////////////