os/textandloc/charconvfw/charconv_fw/inc/charconv.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconv_fw/inc/charconv.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,755 @@
     1.4 +/*
     1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#if !defined(__CHARCONV_H__)
    1.23 +#define __CHARCONV_H__
    1.24 +
    1.25 +#if !defined(__E32STD_H__)
    1.26 +#include <e32std.h>
    1.27 +#endif
    1.28 +
    1.29 +#if !defined(__E32BASE_H__)
    1.30 +#include <e32base.h>
    1.31 +#endif
    1.32 +
    1.33 +/** 
    1.34 +The maximum length in bytes of the replacement text for unconvertible Unicode 
    1.35 +characters (=50) (see CCnvCharacterSetConverter::SetReplacementForUnconvertibleUnicodeCharactersL()). 
    1.36 +@publishedAll
    1.37 +@released
    1.38 +*/
    1.39 +const TInt KMaximumLengthOfReplacementForUnconvertibleUnicodeCharacters=50;
    1.40 +
    1.41 +/** 
    1.42 +UTF-7 
    1.43 +@publishedAll
    1.44 +@released
    1.45 +*/
    1.46 +const TUint KCharacterSetIdentifierUtf7=0x1000582c;
    1.47 +/** 
    1.48 +UTF-8 
    1.49 +@publishedAll
    1.50 +@released
    1.51 +*/
    1.52 +const TUint KCharacterSetIdentifierUtf8=0x1000582d;
    1.53 +/** 
    1.54 +IMAP UTF-7 
    1.55 +@publishedAll
    1.56 +@released
    1.57 +*/
    1.58 +const TUint KCharacterSetIdentifierImapUtf7=0x1000582e;
    1.59 +/** 
    1.60 +Java UTF-8 
    1.61 +@publishedAll
    1.62 +@released
    1.63 +*/
    1.64 +const TUint KCharacterSetIdentifierJavaConformantUtf8=0x1000582f;
    1.65 +/** 
    1.66 +Code Page 1252 
    1.67 +@publishedAll
    1.68 +@released
    1.69 +*/
    1.70 +const TUint KCharacterSetIdentifierCodePage1252=0x100012b6;
    1.71 +/** 
    1.72 +ISO 8859-1 
    1.73 +@publishedAll
    1.74 +@released
    1.75 +*/
    1.76 +const TUint KCharacterSetIdentifierIso88591=0x10003b10;
    1.77 +/** 
    1.78 +ISO 8859-2 
    1.79 +@publishedAll
    1.80 +@released
    1.81 +*/
    1.82 +const TUint KCharacterSetIdentifierIso88592=0x1000507e;
    1.83 +/** 
    1.84 +ISO 8859-3 
    1.85 +@publishedAll
    1.86 +@released
    1.87 +*/
    1.88 +const TUint KCharacterSetIdentifierIso88593=0x10008a28;
    1.89 +/** 
    1.90 +ISO 8859-4 
    1.91 +@publishedAll
    1.92 +@released
    1.93 +*/
    1.94 +const TUint KCharacterSetIdentifierIso88594=0x1000507f;
    1.95 +/** 
    1.96 +ISO 8859-5 
    1.97 +@publishedAll
    1.98 +@released
    1.99 +*/
   1.100 +const TUint KCharacterSetIdentifierIso88595=0x10005080;
   1.101 +/** 
   1.102 +ISO 8859-6 
   1.103 +@publishedAll
   1.104 +@released
   1.105 +*/
   1.106 +const TUint KCharacterSetIdentifierIso88596=0x10008a29;
   1.107 +/** 
   1.108 +ISO 8859-7 
   1.109 +@publishedAll
   1.110 +@released
   1.111 +*/
   1.112 +const TUint KCharacterSetIdentifierIso88597=0x10005081;
   1.113 +/** 
   1.114 +ISO 8859-8 
   1.115 +@publishedAll
   1.116 +@released
   1.117 +*/
   1.118 +const TUint KCharacterSetIdentifierIso88598=0x10008a2a;
   1.119 +/** 
   1.120 +ISO 8859-9 
   1.121 +@publishedAll
   1.122 +@released
   1.123 +*/
   1.124 +const TUint KCharacterSetIdentifierIso88599=0x10005082;
   1.125 +/** 
   1.126 +ISO 8859-10 
   1.127 +@publishedAll
   1.128 +@released
   1.129 +*/
   1.130 +const TUint KCharacterSetIdentifierIso885910=0x10008a2b;
   1.131 +/** 
   1.132 +ISO 8859-13 
   1.133 +@publishedAll
   1.134 +@released
   1.135 +*/
   1.136 +const TUint KCharacterSetIdentifierIso885913=0x10008a2c;
   1.137 +/** 
   1.138 +ISO 8859-14 
   1.139 +@publishedAll
   1.140 +@released
   1.141 +*/
   1.142 +const TUint KCharacterSetIdentifierIso885914=0x10008a2d;
   1.143 +/** 
   1.144 +ISO 8859-15 
   1.145 +@publishedAll
   1.146 +@released
   1.147 +*/
   1.148 +const TUint KCharacterSetIdentifierIso885915=0x10008a2e;
   1.149 +/** 
   1.150 +ASCII 
   1.151 +@publishedAll
   1.152 +@released
   1.153 +*/
   1.154 +const TUint KCharacterSetIdentifierAscii=0x10004cc6;
   1.155 +/** 
   1.156 +SMS 7-bit 
   1.157 +@publishedAll
   1.158 +@released
   1.159 +*/
   1.160 +const TUint KCharacterSetIdentifierSms7Bit=0x100053ab;
   1.161 +/** 
   1.162 +GB 2312 
   1.163 +@publishedAll
   1.164 +@released
   1.165 +*/
   1.166 +const TUint KCharacterSetIdentifierGb2312=0x10000fbe;
   1.167 +/** 
   1.168 +HZ-GB-2312 
   1.169 +@publishedAll
   1.170 +@released
   1.171 +*/
   1.172 +const TUint KCharacterSetIdentifierHz=0x10006065;
   1.173 +/** 
   1.174 +GB 12345 
   1.175 +@publishedAll
   1.176 +@released
   1.177 +*/
   1.178 +const TUint KCharacterSetIdentifierGb12345=0x1000401a;
   1.179 +/** 
   1.180 +GBK 
   1.181 +@publishedAll
   1.182 +@released
   1.183 +*/
   1.184 +const TUint KCharacterSetIdentifierGbk=0x10003ecb;
   1.185 +/** 
   1.186 +GB18030
   1.187 +@publishedAll
   1.188 +@released
   1.189 +*/
   1.190 +const TUint KCharacterSetIdentifierGb18030=0x10287038;
   1.191 +/** 
   1.192 +Big 5 
   1.193 +@publishedAll
   1.194 +@released
   1.195 +*/
   1.196 +const TUint KCharacterSetIdentifierBig5=0x10000fbf;
   1.197 +/** 
   1.198 +Shift-JIS 
   1.199 +@publishedAll
   1.200 +@released
   1.201 +*/
   1.202 +const TUint KCharacterSetIdentifierShiftJis=0x10000fbd;
   1.203 +/** 
   1.204 +ISO-2022-JP 
   1.205 +@publishedAll
   1.206 +@released
   1.207 +*/
   1.208 +const TUint KCharacterSetIdentifierIso2022Jp=0x100066a0;
   1.209 +/** 
   1.210 +ISO-2022-JP-1 
   1.211 +@publishedAll
   1.212 +@released
   1.213 +*/
   1.214 +const TUint KCharacterSetIdentifierIso2022Jp1=0x100066a3;
   1.215 +/** 
   1.216 +JIS Encoding 
   1.217 +@publishedAll
   1.218 +@released
   1.219 +*/
   1.220 +const TUint KCharacterSetIdentifierJis=0x10006066;
   1.221 +/** 
   1.222 +EUC-JP 
   1.223 +@publishedAll
   1.224 +@released
   1.225 +*/
   1.226 +const TUint KCharacterSetIdentifierEucJpPacked=0x10006067;
   1.227 +
   1.228 +/** 
   1.229 +JP5 
   1.230 +@publishedAll
   1.231 +@released
   1.232 +*/
   1.233 +const TUint KCharacterSetIdentifierJ5=0x1020D408;
   1.234 +/** 
   1.235 +CP850 
   1.236 +@publishedAll
   1.237 +@released
   1.238 +*/
   1.239 +const TUint KCharacterSetIdentifierCP850=0x102825AD;
   1.240 +
   1.241 +const TUint KCharacterSetIdentifierUnicodeLittle=0x101f3fae;  //Little Endian Unicode
   1.242 +const TUint KCharacterSetIdentifierUnicodeBig=0x101f4052; // Big Endian Unicode 
   1.243 +const TUint KCharacterSetIdentifierUcs2=0x101ff492; 
   1.244 +
   1.245 +
   1.246 +/** 
   1.247 +Extended SMS 7-bit 
   1.248 +@publishedAll
   1.249 +@released
   1.250 +*/
   1.251 +const TUint KCharacterSetIdentifierExtendedSms7Bit=0x102863FD;
   1.252 +
   1.253 +/** 
   1.254 +Turkish 
   1.255 +@publishedAll
   1.256 +@released
   1.257 +*/
   1.258 +const TUint KCharacterSetIdentifierTurkishSingleSms7Bit=0x102863FE;
   1.259 +const TUint KCharacterSetIdentifierTurkishLockingSms7Bit=0x102863FF;
   1.260 +const TUint KCharacterSetIdentifierTurkishLockingAndSingleSms7Bit=0x10286400;
   1.261 +
   1.262 +/** 
   1.263 +Portuguese 
   1.264 +@publishedAll
   1.265 +@released
   1.266 +*/
   1.267 +const TUint KCharacterSetIdentifierPortugueseSingleSms7Bit=0x10286407;
   1.268 +const TUint KCharacterSetIdentifierPortugueseLockingSms7Bit=0x10286408;
   1.269 +const TUint KCharacterSetIdentifierPortugueseLockingAndSingleSms7Bit=0x10286409;
   1.270 +
   1.271 +/** 
   1.272 +Spanish
   1.273 +@publishedAll
   1.274 +@released
   1.275 +*/
   1.276 +const TUint KCharacterSetIdentifierSpanishSingleSms7Bit=0x1028640A;
   1.277 +
   1.278 +
   1.279 +/**
   1.280 +code page 949
   1.281 +@publishedAll
   1.282 +@released
   1.283 +*/
   1.284 +const TUint KCharacterSetIdentifierCP949=0x200100FF;
   1.285 +
   1.286 +/**
   1.287 +Shift-JIS with Pictograph
   1.288 +@publishedAll
   1.289 +@released 
   1.290 +*/
   1.291 +const TUint KCharacterSetIdentifierShiftJisDirectmap=0x101F8691;
   1.292 +
   1.293 +/**
   1.294 +EUC-JP with direct mapped pictograph
   1.295 +@publishedAll
   1.296 +@released 
   1.297 +*/
   1.298 +const TUint KCharacterSetIdentifierEucJpDirectmap=0x101F86A6;
   1.299 +
   1.300 +/**
   1.301 +EUC-KR 
   1.302 +@publishedAll
   1.303 +@released
   1.304 +*/
   1.305 +const TUint KCharacterSetIdentifierEUCKR=0x2000E526;
   1.306 +
   1.307 +/**
   1.308 +iscii 
   1.309 +@publishedAll
   1.310 +@released
   1.311 +*/
   1.312 +const TUint KCharacterSetIdentifierIscii=0x1027508E;
   1.313 +
   1.314 +/**
   1.315 +ISO2022 Korean
   1.316 +@publishedAll
   1.317 +@released
   1.318 +*/
   1.319 +const TUint KCharacterSetIdentifierIso2022kr=0x20010101;
   1.320 +
   1.321 +/**
   1.322 +KOI8-R Russian
   1.323 +@publishedAll
   1.324 +@released
   1.325 +*/
   1.326 +const TUint KCharacterSetIdentifierKOI8R=0x101F8778;
   1.327 +
   1.328 +/**
   1.329 +KOI8-U Belorusian/Ukrainian Cyrillic
   1.330 +@publishedAll
   1.331 +@released 
   1.332 +*/
   1.333 +const TUint KCharacterSetIdentifierKOI8U=0x101F8761;
   1.334 +
   1.335 +/**
   1.336 +KSC5601 Korean
   1.337 +@publishedAll
   1.338 +@released 
   1.339 +*/
   1.340 +const TUint KCharacterSetIdentifierKsc5601=0x200113CD;
   1.341 +
   1.342 +/**
   1.343 +TIS_620 Thai
   1.344 +@publishedAll
   1.345 +@released 
   1.346 +*/
   1.347 +const TUint KCharacterSetIdentifierTIS_620=0x101F8549;
   1.348 +
   1.349 +/**
   1.350 +Code page 874 Thai
   1.351 +@publishedAll
   1.352 +@released 
   1.353 +*/
   1.354 +const TUint KCharacterSetIdentifierWin874=0x101F854A;
   1.355 +
   1.356 +/**
   1.357 +Code page 1250 Eastern European
   1.358 +@publishedAll
   1.359 +@released 
   1.360 +*/
   1.361 +const TUint KCharacterSetIdentifierWin1250=0x100059D6;
   1.362 +
   1.363 +/**
   1.364 +Code page 1251 Cyrillic
   1.365 +@publishedAll
   1.366 +@released 
   1.367 +*/
   1.368 +const TUint KCharacterSetIdentifierWin1251=0x100059D7;
   1.369 +
   1.370 +/**
   1.371 +Code page 1253 Greek
   1.372 +@publishedAll
   1.373 +@released 
   1.374 +*/
   1.375 +const TUint KCharacterSetIdentifierWin1253=0x100059D8;
   1.376 +
   1.377 +/**
   1.378 +Code page 1254 Turkish
   1.379 +@publishedAll
   1.380 +@released 
   1.381 +*/
   1.382 +const TUint KCharacterSetIdentifierWin1254=0x100059D9;
   1.383 +
   1.384 +/**
   1.385 +Code page 1255 Hebrew
   1.386 +@publishedAll
   1.387 +@released 
   1.388 +*/
   1.389 +const TUint KCharacterSetIdentifierWin1255=0x101F8547;
   1.390 +
   1.391 +/**
   1.392 +Code page 1256 Arabic
   1.393 +@publishedAll
   1.394 +@released 
   1.395 +*/
   1.396 +const TUint KCharacterSetIdentifierWin1256=0x101F8548;
   1.397 +
   1.398 +/**
   1.399 +Code page 1257 Baltic
   1.400 +@publishedAll
   1.401 +@released 
   1.402 +*/
   1.403 +const TUint KCharacterSetIdentifierWin1257=0x100059DA;
   1.404 +
   1.405 +/**
   1.406 +Windows-1258
   1.407 +@publishedAll
   1.408 +@released
   1.409 +*/ 
   1.410 +const TUint KCharacterSetIdentifierWin1258=0x102073B8;
   1.411 +
   1.412 +// note that other character sets than those listed above may be available at run-time, and also that none of the above are necessarily available at run-time
   1.413 +
   1.414 +struct SCnvConversionData;
   1.415 +class CDeepDestructingArrayOfCharactersSets;
   1.416 +class CFileReader;
   1.417 +class CStandardNamesAndMibEnums;
   1.418 +class RFs;
   1.419 +class CCharsetCnvCache;
   1.420 +/** 
   1.421 +Converts text between Unicode and other character sets. 
   1.422 +
   1.423 +The first stage of the conversion is to specify the non-Unicode character 
   1.424 +set being converted to or from. This is done by calling one of the overloads 
   1.425 +of PrepareToConvertToOrFromL().
   1.426 +
   1.427 +The second stage is to convert the text, using one of the overloads of 
   1.428 +ConvertFromUnicode() or ConvertToUnicode().
   1.429 +
   1.430 +Where possible the first documented overload of PrepareToConvertToOrFromL() 
   1.431 +should be used because the second overload panics if the specified character 
   1.432 +set is not available: the first overload simply returns whether the character 
   1.433 +set is available or not available. However if the conversions are to be 
   1.434 +performed often, or if the user must select the character set for the 
   1.435 +conversion from a list, the second overload may be more appropriate.
   1.436 +
   1.437 +The first overload is less efficient than the second, because it searches 
   1.438 +through the file system for the selected character set every time it is invoked. 
   1.439 +The second overload searches through an array of all available character sets. 
   1.440 +In this method, the file system need only be searched once - when 
   1.441 +CreateArrayOfCharacterSetsAvailableLC() or 
   1.442 +CreateArrayOfCharacterSetsAvailableL() is used to create the array.
   1.443 +
   1.444 +The conversion functions allow users of this class to perform partial 
   1.445 +conversions on an input descriptor, handling the situation where the input 
   1.446 +descriptor is truncated mid way through a multi-byte character. This means 
   1.447 +that you do not have to guess how big to make the output descriptor for a 
   1.448 +given input descriptor, you can simply do the conversion in a loop using a 
   1.449 +small output descriptor. The ability to handle truncated descriptors also 
   1.450 +allows users of the class to convert information received in chunks from an 
   1.451 +external source.
   1.452 +
   1.453 +The class also provides a number of utility functions. 
   1.454 +@publishedAll
   1.455 +@released
   1.456 +*/
   1.457 +class CCnvCharacterSetConverter : public CBase
   1.458 +	{
   1.459 +public:
   1.460 +	/** Indicates whether a character set is available or unavailable
   1.461 +	for conversion. Used by the second overload of 
   1.462 +	PrepareToConvertToOrFromL(). */
   1.463 +	enum TAvailability
   1.464 +		{
   1.465 +		/** The requested character set can be converted. */
   1.466 +		EAvailable,
   1.467 +		/** The requested character set cannot be converted. */
   1.468 +		ENotAvailable
   1.469 +		};
   1.470 +
   1.471 +	/** Conversion error flags. At this stage there is only one error 
   1.472 +	flag- others may be added in the future. */
   1.473 +	enum TError
   1.474 +		{
   1.475 +		/** The input descriptor contains a single corrupt character. This 
   1.476 +		might occur when the input descriptor only contains some of the bytes 
   1.477 +		of a single multi-byte character. */
   1.478 +		EErrorIllFormedInput=KErrCorrupt
   1.479 +		};
   1.480 +
   1.481 +	/** Specifies the default endian-ness of the current character set. 
   1.482 +	Used by SetDefaultEndiannessOfForeignCharacters(). */
   1.483 +	enum TEndianness
   1.484 +		{
   1.485 +		/** The character set is big-endian. */
   1.486 +		ELittleEndian,
   1.487 +		/** The character set is little-endian. */
   1.488 +		EBigEndian
   1.489 +		};
   1.490 +	
   1.491 +	/** Downgrade for line and paragraph separators */
   1.492 +	enum TDowngradeForExoticLineTerminatingCharacters
   1.493 +		{
   1.494 +		/** Paragraph/line separators should be downgraded (if necessary) 
   1.495 +		into carriage return and line feed pairs. */
   1.496 +		EDowngradeExoticLineTerminatingCharactersToCarriageReturnLineFeed,
   1.497 +		/** Paragraph/line separators should be downgraded (if necessary) 
   1.498 +		into a line feed only. */
   1.499 +		EDowngradeExoticLineTerminatingCharactersToJustLineFeed
   1.500 +		};
   1.501 +
   1.502 +	/** Output flag used to indicate whether or not a character in the source
   1.503 +	descriptor is the first half of a surrogate pair, but is the last
   1.504 +	character in the descriptor to convert.
   1.505 +	 
   1.506 +	Note: This enumeration can be used in the DoConvertToUnicode() and
   1.507 +	DoConvertFromUnicode() functions. These are part of the
   1.508 +	Character Conversion Plug-in Provider API and are for use by plug-in
   1.509 +	conversion libraries only.
   1.510 +	@since 6.0 */
   1.511 +	enum
   1.512 +		{
   1.513 +		/** Appends the converted text to the output descriptor.*/
   1.514 +		EInputConversionFlagAppend	=0x00010000,
   1.515 +		/** By default, when the input descriptor passed to DoConvertFromUnicode()
   1.516 +		or DoConvertToUnicode() consists of nothing but a truncated sequence, 
   1.517 +		the error-code EErrorIllFormedInput is returned. 
   1.518 +		If this behaviour is undesirable, the input flag  
   1.519 +		EInputConversionFlagAllowTruncatedInputNotEvenPartlyConsumable
   1.520 +		should be set. */
   1.521 +		EInputConversionFlagAllowTruncatedInputNotEvenPartlyConsumable	=0x00020000,
   1.522 +		/** Stops converting when the first unconvertible character is reached. */
   1.523 +		EInputConversionFlagStopAtFirstUnconvertibleCharacter			=0x00040000,
   1.524 +		/** Appends the default character set Escape sequence at end of converted text */
   1.525 +		EInputConversionFlagMustEndInDefaultCharacterSet				=0x00080000,
   1.526 +		/*defect fix: INC053609; According to RFC1468 we can assume the line starts 
   1.527 +		in ASCII so there is no need to always insert an escape sequence*/
   1.528 +		EInputConversionFlagAssumeStartInDefaultCharacterSet			=0x00100000
   1.529 +		};
   1.530 +	enum
   1.531 +		{
   1.532 +		/** Indicates whether or not the source descriptor ends in a truncated
   1.533 +		sequence, e.g. the first half only of a surrogate pair. */
   1.534 +		EOutputConversionFlagInputIsTruncated							=0x01000000
   1.535 +		};
   1.536 +
   1.537 +		/** Initial value for the state argument in a set of related calls to
   1.538 +		ConvertToUnicode(). */
   1.539 +	enum {KStateDefault=0};
   1.540 +	enum 
   1.541 +		{
   1.542 +		/** The lowest confidence value for a character set accepted by 
   1.543 +		Autodetect*/
   1.544 +		ELowestThreshold = 25
   1.545 +		};
   1.546 +		
   1.547 +	/** Stores information about a non-Unicode character set. The information 
   1.548 +	is used	to locate the conversion information required by 
   1.549 +	ConvertFromUnicode() and ConvertToUnicode().
   1.550 +
   1.551 +	An array of these structs that contain all available character sets 
   1.552 +	can be generated by CreateArrayOfCharacterSetsAvailableLC() and 
   1.553 +	CreateArrayOfCharacterSetsAvailableL(), and is used by one of the 
   1.554 +	overloads of PrepareToConvertToOrFromL(). */
   1.555 +	struct SCharacterSet
   1.556 +		{
   1.557 +		/** Gets the character sets UID.
   1.558 +	
   1.559 +		@return The UID of the character set. */
   1.560 +		inline TUint Identifier() const {return iIdentifier;}
   1.561 +
   1.562 +		/** Tests whether a filename given by the function SCharacterSet::Name() 
   1.563 +		is a real file name (i.e. conversion is provided by a plug in DLL), or 
   1.564 +		just the character set name (i.e. conversion is built into Symbian OS).
   1.565 +		
   1.566 +		Note: If the function returns ETrue then the path and filename can be 
   1.567 +		parsed using TParse or TParsePtrC functions to obtain just the filename.
   1.568 +		
   1.569 +		@return ETrue if the name is a real filename. EFalse if it is just the 
   1.570 +		character set name. */
   1.571 +		inline TBool NameIsFileName() const {return iFlags&EFlagNameIsFileName;}
   1.572 +
   1.573 +		/** Gets the full path and filename of the DLL which implements 
   1.574 +		conversion for the character set. 
   1.575 +		
   1.576 +		If the character set is one for which conversion is built into Symbian 
   1.577 +		OS rather than implemented by a plug in DLL, the function just returns 
   1.578 +		the name of the character set. The NameIsFileName() function can be 
   1.579 +		used to determine whether or not it is legal to create a TParsePtrC 
   1.580 +		object over the descriptor 	returned by Name().
   1.581 +		
   1.582 +		Notes:
   1.583 +		
   1.584 +		The name returned cannot be treated as an Internet-standard name, it 
   1.585 +		is locale-independent and should be mapped to the locale-dependent name 
   1.586 +		by software at a higher level before being shown to the user. Conversion 
   1.587 +		from Internet-standard names of character sets to the UID identifiers 
   1.588 +		is provided by the member function 
   1.589 +		ConvertStandardNameOfCharacterSetToIdentifierL().
   1.590 +		
   1.591 +		Typically, to find the user-displayable name (as opposed to the 
   1.592 +		internet-standard name) of a character set, you would do something 
   1.593 +		like this:
   1.594 +		
   1.595 +		@code
   1.596 +		const CCnvCharacterSetConverter::SCharacterSet& characterSet=...;
   1.597 +		const TPtrC userDisplayable(characterSet.NameIsFileName()? TParsePtrC(characterSet.Name()).Name(): 
   1.598 +		characterSet.Name()); 
   1.599 +		@endcode
   1.600 +
   1.601 +		@return Full path and filename of the character set converter plug in 
   1.602 +		DLL, or just the name of the character set. */
   1.603 +		inline TPtrC Name() const {return *iName;}
   1.604 +	private:
   1.605 +		enum
   1.606 +			{
   1.607 +			EFlagNameIsFileName					=0x00000001,
   1.608 +			EFlagFileIsConversionPlugInLibrary	=0x00000002
   1.609 +			};
   1.610 +	private:
   1.611 +		inline TBool FileIsConversionPlugInLibrary() const {return iFlags&EFlagFileIsConversionPlugInLibrary;}
   1.612 +	private:
   1.613 +		TUint iIdentifier;
   1.614 +		TUint iFlags;
   1.615 +		HBufC* iName;
   1.616 +	private:
   1.617 +		friend class CCnvCharacterSetConverter;
   1.618 +		friend class CDeepDestructingArrayOfCharactersSets;
   1.619 +		}; //SCharacterSet
   1.620 +	
   1.621 +
   1.622 +	/** 
   1.623 +	Holds an ascending array of the indices of the characters in the 
   1.624 +	source Unicode text which could not be converted by 
   1.625 +	CCnvCharacterSetConverter::ConvertFromUnicode() into the foreign 
   1.626 +	character set 
   1.627 +	@publishedAll
   1.628 +	@released
   1.629 +	*/
   1.630 +	class TArrayOfAscendingIndices
   1.631 +		{
   1.632 +	public:
   1.633 +		/** The return value of CCnvCharacterSetConverter::AppendIndex(). */
   1.634 +		enum TAppendResult
   1.635 +			{
   1.636 +			/** The append failed. */
   1.637 +			EAppendFailed,
   1.638 +			/** The append succeeded. */
   1.639 +			EAppendSuccessful
   1.640 +			};
   1.641 +	public:
   1.642 +		/** C++ constructor. The array is initialised to be of length zero. */
   1.643 +		inline TArrayOfAscendingIndices() :iArrayOfIndices(0) {}
   1.644 +	
   1.645 +		IMPORT_C TAppendResult AppendIndex(TInt aIndex);
   1.646 +		
   1.647 +		/** Deletes a single index from the array.
   1.648 +		
   1.649 +		@param aIndexOfIndex The index of the index to delete. Must not be 
   1.650 +		negative and must not be greater than the length of the array, or a 
   1.651 +		panic occurs. */
   1.652 +		inline void Remove(TInt aIndexOfIndex) {iArrayOfIndices.Delete(aIndexOfIndex, 1);}
   1.653 +		
   1.654 +		/** Deletes all indices from the array. */
   1.655 +		inline void RemoveAll() {iArrayOfIndices.SetLength(0);}
   1.656 +
   1.657 +		/** Returns the number of indices in the array.
   1.658 +	
   1.659 +		@return The number of indices in the array. */
   1.660 +		inline TInt NumberOfIndices() const {return iArrayOfIndices.Length();}
   1.661 +
   1.662 +		/** Gets the value of the specified index.
   1.663 +	
   1.664 +		@param aIndexOfIndex Index into the array.
   1.665 +		@return The value of the index. */
   1.666 +		inline TInt operator[](TInt aIndexOfIndex) const {return iArrayOfIndices[aIndexOfIndex];}
   1.667 +	private:
   1.668 +		enum {KMaximumNumberOfIndices=25};
   1.669 +	private:
   1.670 +		TBuf16<KMaximumNumberOfIndices> iArrayOfIndices;
   1.671 +		};
   1.672 +public:
   1.673 +	IMPORT_C static CCnvCharacterSetConverter* NewL();
   1.674 +	IMPORT_C static CCnvCharacterSetConverter* NewLC();
   1.675 +	IMPORT_C virtual ~CCnvCharacterSetConverter();
   1.676 +	IMPORT_C static CArrayFix<SCharacterSet>* CreateArrayOfCharacterSetsAvailableL(RFs& aFileServerSession);
   1.677 +	IMPORT_C static CArrayFix<SCharacterSet>* CreateArrayOfCharacterSetsAvailableLC(RFs& aFileServerSession);
   1.678 +	IMPORT_C TUint ConvertStandardNameOfCharacterSetToIdentifierL(const TDesC8& aStandardNameOfCharacterSet, RFs& aFileServerSession);
   1.679 +	IMPORT_C HBufC8* ConvertCharacterSetIdentifierToStandardNameL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
   1.680 +	IMPORT_C TUint ConvertMibEnumOfCharacterSetToIdentifierL(TInt aMibEnumOfCharacterSet, RFs& aFileServerSession);
   1.681 +	IMPORT_C TInt ConvertCharacterSetIdentifierToMibEnumL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
   1.682 +	IMPORT_C void PrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, RFs& aFileServerSession);
   1.683 +	IMPORT_C TAvailability PrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
   1.684 +	// the following attribute-setting functions should be called (if at all) after calling PrepareToConvertToOrFromL and before calling ConvertFromUnicode and/or ConvertToUnicode
   1.685 +	IMPORT_C void SetDefaultEndiannessOfForeignCharacters(TEndianness aEndianness);
   1.686 +	IMPORT_C void SetDowngradeForExoticLineTerminatingCharacters(TDowngradeForExoticLineTerminatingCharacters aDowngradeForExoticLineTerminatingCharacters); // by default this attribute is set to EDowngradeExoticLineTerminatingCharactersToCarriageReturnLineFeed
   1.687 +	IMPORT_C void SetReplacementForUnconvertibleUnicodeCharactersL(const TDesC8& aReplacementForUnconvertibleUnicodeCharacters); // must be a single character preceded by its escape sequence (if any), and must be little-endian if the endianness of the character-set is unspecified, otherwise in the same endianness as the character-set
   1.688 +	
   1.689 +	// the conversion functions return either one of the TError values above, or the number of unconverted elements left at the end of the input descriptor
   1.690 +	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode) const;
   1.691 +	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TInt& aNumberOfUnconvertibleCharacters) const;
   1.692 +	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstUnconvertibleCharacter) const;
   1.693 +	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters) const;
   1.694 +	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState) const;
   1.695 +	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState, TInt& aNumberOfUnconvertibleCharacters) const;
   1.696 +	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter) const;
   1.697 +	IMPORT_C static void AutoDetectCharacterSetL(TInt& aConfidenceLevel, TUint& aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
   1.698 +	IMPORT_C void AutoDetectCharSetL(TInt& aConfidenceLevel, TUint& aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
   1.699 +	IMPORT_C static void ConvertibleToCharacterSetL(TInt& aConfidenceLevel, const TUint aCharacterSetIdentifier,const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
   1.700 +    IMPORT_C void ConvertibleToCharSetL(TInt& aConfidenceLevel, const TUint aCharacterSetIdentifier,const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
   1.701 +	IMPORT_C void SetMaxCacheSize(TInt aSize);
   1.702 +	// the following functions are only to be called by conversion plug-in libraries
   1.703 +	IMPORT_C static TInt DoConvertFromUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
   1.704 +	IMPORT_C static TInt DoConvertFromUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters, TUint& aOutputConversionFlags, TUint aInputConversionFlags);
   1.705 +	IMPORT_C static TInt DoConvertToUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, TDes16& aUnicode, const TDesC8& aForeign, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
   1.706 +	IMPORT_C static TInt DoConvertToUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, TDes16& aUnicode, const TDesC8& aForeign, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter, TUint& aOutputConversionFlags, TUint aInputConversionFlags);
   1.707 +	IMPORT_C static const SCnvConversionData& AsciiConversionData();
   1.708 +	inline TDowngradeForExoticLineTerminatingCharacters GetDowngradeForExoticLineTerminatingCharacters () 
   1.709 +		{
   1.710 +		return iDowngradeForExoticLineTerminatingCharacters ;
   1.711 +		} ; 
   1.712 +
   1.713 +private:
   1.714 +	enum
   1.715 +		{
   1.716 +		EStoredFlagOwnsConversionData				=0x00000001,
   1.717 +		EStoredFlagConversionPlugInLibraryIsLoaded	=0x00000002
   1.718 +		};
   1.719 +	enum TCharacterSetSearch
   1.720 +		{
   1.721 +		EStopCharacterSetSearch,
   1.722 +		EContinueCharacterSetSearch
   1.723 +		};
   1.724 +	enum TConversionPlugInFunctionOrdinals
   1.725 +		{
   1.726 +		EReplacementForUnconvertibleUnicodeCharacters=1,
   1.727 +		EConvertFromUnicode=2,
   1.728 +		EConvertToUnicode=3,
   1.729 +		EIsInThisCharacterSet=4
   1.730 +		};
   1.731 +		
   1.732 +private:
   1.733 +	CCnvCharacterSetConverter();
   1.734 +	void ConstructL();
   1.735 +	static CArrayFix<SCharacterSet>* DoCreateArrayOfCharacterSetsAvailableLC(RFs& aFileServerSession, TUint aIdentifierOfOnlyCharacterSetOfInterest);
   1.736 +	static TCharacterSetSearch AppendHardCodedCharacterSetIfRequiredL(CArrayFix<SCharacterSet>& aArrayOfCharacterSets, TUint aIdentifierOfOnlyCharacterSetOfInterest, TUint aIdentifierOfHardCodedCharacterSet, const TDesC& aNameOfHardCodedCharacterSet);
   1.737 +	void ScanForStandardNamesAndMibEnumsL(RFs& aFileServerSession);
   1.738 +	void ScanForStandardNamesAndMibEnumsROMOnlyL(RFs& aFileServerSession);
   1.739 +	TAvailability DoPrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, const CArrayFix<SCharacterSet>* aArrayOfCharacterSetsAvailable, RFs& aFileServerSession);
   1.740 +	static void DeleteConversionData(const SCnvConversionData* aConversionData);
   1.741 +	static void DeleteConversionData(TAny* aConversionData);
   1.742 +	static TEndianness EndiannessOfForeignCharacters(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters);
   1.743 +
   1.744 +private:
   1.745 +	TUint iStoredFlags;
   1.746 +	TUint iCharacterSetIdentifierOfLoadedConversionData; // 0 or a UID of the loaded plugin
   1.747 +	const SCnvConversionData* iConversionData;
   1.748 +	TEndianness iDefaultEndiannessOfForeignCharacters;
   1.749 +	TDowngradeForExoticLineTerminatingCharacters iDowngradeForExoticLineTerminatingCharacters;
   1.750 +	TBuf8<KMaximumLengthOfReplacementForUnconvertibleUnicodeCharacters> iReplacementForUnconvertibleUnicodeCharacters;
   1.751 +	CStandardNamesAndMibEnums* iStandardNamesAndMibEnums;
   1.752 +	TBool iTlsDataConstructed;
   1.753 +	CCharsetCnvCache* iCharsetCnvCache;
   1.754 +	TBool iIsSystemStandardNamesAndMibEnumsScanned;
   1.755 +	};
   1.756 +
   1.757 +#endif
   1.758 +