os/kernelhwsrv/kernel/eka/include/kernel/localise.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/kernel/localise.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,547 @@
     1.4 +// Copyright (c) 1994-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 "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.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 +// e32\include\kernel\localise.h
    1.18 +// 
    1.19 +// WARNING: This file contains some APIs which are internal and are subject
    1.20 +//          to change without notice. Such APIs should therefore not be used
    1.21 +//          outside the Kernel and Hardware Services package.
    1.22 +//
    1.23 +
    1.24 +/**
    1.25 + @file
    1.26 + @publishedPartner
    1.27 + @released
    1.28 +*/
    1.29 +
    1.30 +#ifndef __K32LOCL_H__
    1.31 +#define __K32LOCL_H__
    1.32 +#include <u32std.h>
    1.33 +
    1.34 +class TDesC16;
    1.35 +class TDes16;
    1.36 +
    1.37 +#ifdef _UNICODE
    1.38 +#define TLocaleText TText16
    1.39 +#else
    1.40 +#define TLocaleText TText8
    1.41 +#endif
    1.42 +
    1.43 +/**
    1.44 +It is a container for functions to convert from a 8-bit string to a 16-bit(UNICODE) string and vice-versa, and to check
    1.45 +whether a character is a legal short character or not.
    1.46 +It declares pointers to functions that accomplishes the above tasks.  
    1.47 +
    1.48 +The functions are to be implemented by the locale-DLLs.
    1.49 +*/
    1.50 +struct TFatUtilityFunctions // functions to be implemented by locale-DLLs
    1.51 +	{
    1.52 +	/**
    1.53 +	Specifies the action to be taken if an overflow occurs. It can either Leave or Truncate the overflow part.
    1.54 +	*/
    1.55 +	enum TOverflowAction
    1.56 +		{
    1.57 +		/**
    1.58 +		Will leave if an overflow occurs.
    1.59 +		*/
    1.60 +		EOverflowActionLeave,
    1.61 +		/** 
    1.62 +		Will truncate the data if an overflow occurs.
    1.63 +		*/
    1.64 +		EOverflowActionTruncate
    1.65 +		};
    1.66 +	/**
    1.67 +	Function to convert a string from unicode(16-bit)format to a (8-bit) format.
    1.68 +	
    1.69 +	@param  aForeign  										8-bit descriptor that will contain the converted string.
    1.70 +	@param  aUnicode  										16-bit descriptor which contains the string to be converted.
    1.71 +	@param  aReplacementForUnconvertibleUnicodeCharacters	Any default 8-bit character that will replace any non convertible 16-bit unicode character.
    1.72 +	@param  aOverFlowAction									Enum value specifying action to be taken in case of overflow.
    1.73 +	
    1.74 +	@see TOverflowAction.	
    1.75 +	*/
    1.76 +	typedef void (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TOverflowAction aOverflowAction);
    1.77 +	
    1.78 +	/**
    1.79 +	Function to convert a string from (8-bit) format to unicode(16-bit)format.
    1.80 +	
    1.81 +	@param  aUnicode  										16-bit descriptor which will contain the converted string.
    1.82 +	@param  aForeign  										8-bit descriptor which contains the string to be converted.
    1.83 +	@param  aOverFlowAction									Enum value specifying action to be taken in case of overflow. 
    1.84 +	
    1.85 +	@see TOverflowAction.
    1.86 +	*/
    1.87 +	typedef void (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction);
    1.88 +	
    1.89 +	/**
    1.90 +	Function to check whether a character is a legal short name character or not.
    1.91 +	
    1.92 +	@param aCharacter The character to apply the check on.
    1.93 +	
    1.94 +	@return TBool True  If it is a legal short name character
    1.95 +				  False otherwise.
    1.96 +	*/
    1.97 +	typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter);
    1.98 +	
    1.99 +	/** 
   1.100 +	A pointer to a function TConvertFromUnicodeL. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
   1.101 +	
   1.102 +	@see TConvertFromUnicodeL.
   1.103 +	*/
   1.104 +	TConvertFromUnicodeL iConvertFromUnicodeL;
   1.105 +	
   1.106 +	/** 
   1.107 +	A pointer to a function TConvertToUnicodeL. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
   1.108 +	
   1.109 +	@see TConvertToUnicodeL.
   1.110 +	*/
   1.111 +	TConvertToUnicodeL iConvertToUnicodeL;
   1.112 +	
   1.113 +	/** 
   1.114 +	A pointer to a function TIsLegalShortNameCharacter. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
   1.115 +	
   1.116 +	@see TIsLegalShortNameCharacter.
   1.117 +	*/
   1.118 +	TIsLegalShortNameCharacter iIsLegalShortNameCharacter;
   1.119 +	};
   1.120 +
   1.121 +/**
   1.122 +A data structure containing the system's locale settings.
   1.123 +The data must be identical to that in TLocale.
   1.124 +*/
   1.125 +struct SLocaleData
   1.126 +	{
   1.127 +	/** 
   1.128 +	Integer value specifying country code.
   1.129 +	The country code is the code used as the international dialling prefix. 
   1.130 +	This code is also used to identify a country by the dialling software.
   1.131 +	*/
   1.132 +	TInt iCountryCode;
   1.133 +	
   1.134 +	/**
   1.135 +	The locale's universal time offset. Offset in seconds from universal time.
   1.136 +	Time zones east of universal time have positive offsets. 
   1.137 +	Time zones west of universal time have negative offsets.
   1.138 +	*/
   1.139 +	TInt iUniversalTimeOffset;
   1.140 +	
   1.141 +	/**
   1.142 +	The date format of the Locale. It can be either of the three formats American,European or Japanese.
   1.143 +    */
   1.144 +	TDateFormat iDateFormat;
   1.145 +	
   1.146 +	/**
   1.147 +	The time formats as either 12 hour or 24 hour.
   1.148 +	*/ 
   1.149 +    TTimeFormat iTimeFormat;
   1.150 +    
   1.151 +    /**
   1.152 +    The currency symbol is located before or after the currency amount.
   1.153 +    */
   1.154 +	TLocalePos iCurrencySymbolPosition;
   1.155 +	
   1.156 +	/**
   1.157 +	Whether or not a space is inserted between the currency symbol and the currency value.
   1.158 +	True if a space exists, False otherwise.
   1.159 +    */
   1.160 +	TBool iCurrencySpaceBetween;
   1.161 +	
   1.162 +	/** The number of decimal places to which currency values are set.*/
   1.163 +	TInt iCurrencyDecimalPlaces;
   1.164 +	
   1.165 +	/**
   1.166 +	Indicates how negative currency values are formatted. 
   1.167 +	*/
   1.168 +	TNegativeCurrencyFormat iNegativeCurrencyFormat;
   1.169 +	
   1.170 +	/**
   1.171 +	Sets whether triads are allowed in currency values.
   1.172 +	True if Triads are allowed, False otherwise.
   1.173 +	*/
   1.174 +	TBool iCurrencyTriadsAllowed;
   1.175 +	
   1.176 +	/**
   1.177 +	The character to be used to separate groups of three digits to the left of the decimal separator.
   1.178 +	A thousands separator character is only displayed in currency values if currency triads are allowed.
   1.179 +	*/
   1.180 +	TChar iThousandsSeparator;
   1.181 +	
   1.182 +	/**
   1.183 +	The character used to separate a whole number from its fractional part.
   1.184 +	*/
   1.185 +	TChar iDecimalSeparator;
   1.186 +	
   1.187 +	/**
   1.188 +	An array containing the four characters used to separate the day, month and year components of the date.
   1.189 +	If the four separators are represented by S0, S1, S2 and S3 
   1.190 +	and the three date components are represented by XX, YY and ZZ,
   1.191 +	then the separators are located: S0 XX S1 YY S2 ZZ S3.
   1.192 +    */
   1.193 +	TChar iDateSeparator[KMaxDateSeparators];
   1.194 +	
   1.195 +	/**
   1.196 +    An array containing the four characters used to separate the hour, second and minute components of the time.
   1.197 +	If the four separators are represented by S0, S1, S2 and S3 
   1.198 +	and the three time components are represented by XX, YY and ZZ, 
   1.199 +	then the separators are located: S0 XX S1 YY S2 ZZ S3.
   1.200 +	*/
   1.201 +	TChar iTimeSeparator[KMaxTimeSeparators];
   1.202 +	
   1.203 +	/**
   1.204 +    Defines whether the am/pm text is located before or after the time.
   1.205 +    */
   1.206 +	TLocalePos iAmPmSymbolPosition;
   1.207 +	
   1.208 +	/**
   1.209 +	Whether or not a space is inserted between the time and the preceding or trailing am/pm text.
   1.210 +	True if a space exists, False otherwise.
   1.211 +	*/
   1.212 +	TBool iAmPmSpaceBetween;
   1.213 +	
   1.214 +	/**
   1.215 +	The zones in which daylight saving is in effect.
   1.216 +
   1.217 +	If daylight saving is in effect, one hour is added to the time.
   1.218 +
   1.219 +	A bit mask in which the three least significant bits are defined, 
   1.220 +	indicating which of the three daylight saving zones are adjusted for daylight saving. 
   1.221 +	These bits represent: Northern (non-European countries in the northern hemisphere), 
   1.222 +						  Southern (southern hemisphere), 
   1.223 +						  and European. see TDaylightSavingZone.
   1.224 +						  
   1.225 +	@see TDaylightSavingZone.
   1.226 +	*/
   1.227 +	TUint iDaylightSaving;
   1.228 +	
   1.229 +	/**
   1.230 +	The daylight saving zone in which the home city is located.
   1.231 +	*/
   1.232 +	TDaylightSavingZone iHomeDaylightSavingZone;
   1.233 +	
   1.234 +	/**
   1.235 +	A bit mask representing the days of the week which are considered as working days.
   1.236 +	
   1.237 +	A bit mask of seven bits indicating (by being set) which days are workdays. 
   1.238 +	The least significant bit corresponds to Monday, the next bit to Tuesday and so on. 
   1.239 +	*/
   1.240 +	TUint iWorkDays;
   1.241 +	
   1.242 +	/**
   1.243 +	The day which is considered to be the first day of the week.
   1.244 +		
   1.245 +	The enumerator symbol names correspond with the days of the week, i.e. EMonday refers to Monday etc. 
   1.246 +	*/
   1.247 +	TDay iStartOfWeek;
   1.248 +	
   1.249 +	/**
   1.250 +	The clock display format as either analog or digital. 
   1.251 +	*/
   1.252 +	TClockFormat iClockFormat;
   1.253 +	
   1.254 +	/**
   1.255 +	
   1.256 +	The general units of measurement.
   1.257 +
   1.258 +	This should be used when both short and long distances use the same units of measurement.
   1.259 +    */
   1.260 +	TUnitsFormat iUnitsGeneral;
   1.261 +	
   1.262 +	/**
   1.263 +	The units of measurement for short distances.
   1.264 +
   1.265 +	Short distances are those which would normally be represented by either metres and centimetres or feet and inches.
   1.266 +	*/
   1.267 +	TUnitsFormat iUnitsDistanceShort;
   1.268 +	
   1.269 +	/**
   1.270 +	The units of measurement for long distances.
   1.271 +
   1.272 +	Long distances are those which would normally be represented by either miles or kilometres.
   1.273 +	*/
   1.274 +	TUnitsFormat iUnitsDistanceLong;
   1.275 +	
   1.276 +	/**
   1.277 +	Flags for negative currency values formatting.
   1.278 +
   1.279 +	EFlagNegativeLoseSpace 			  		If this flag is set and the currency value being formatted is negative,
   1.280 +						 					if there is a space between the currency symbol and the value, that space is lost.
   1.281 + 
   1.282 +	EFlagNegativeCurrencySymbolOpposite 	If this flag is set and the currency value being formatted is negative, 
   1.283 +											the position of the currency symbol is placed in the opposite direction 
   1.284 +											from the position set for the positive currency value.
   1.285 + 	*/
   1.286 +	TUint iExtraNegativeCurrencyFormatFlags;
   1.287 +	
   1.288 +	
   1.289 +	/**
   1.290 +	An array which contains customisable part of the language downgrade path.
   1.291 +	*/
   1.292 +	TUint16 iLanguageDowngrade[3];
   1.293 +	
   1.294 +	TUint16 iSpare16;
   1.295 +	
   1.296 +	/**
   1.297 +	The number mode stored in the locale.
   1.298 +	*/
   1.299 +	TDigitType iDigitType;
   1.300 +	
   1.301 +	/**
   1.302 +	The device time state.
   1.303 +	*/
   1.304 + 	TDeviceTimeState iDeviceTimeState;
   1.305 + 	
   1.306 + 	TInt iSpare[0x1E];
   1.307 +	};
   1.308 +
   1.309 +/**
   1.310 +An interface defined to provide support for localisation for components 
   1.311 +that are too low-level to participate in the normal EPOC localisation 
   1.312 +mechanisms.
   1.313 +*/
   1.314 +class Locl
   1.315 +	{
   1.316 +public:
   1.317 +	/**
   1.318 +	Returns the Language type.
   1.319 +	
   1.320 +	@return The value corresponding to a particular language as specified in TLanguage.
   1.321 +	*/
   1.322 +	IMPORT_C static TLanguage Language();
   1.323 +	
   1.324 +	/**
   1.325 +	Returns whether it is a Unicode Build or not.
   1.326 +	
   1.327 +	@return True 	If it is a Unicode Build.
   1.328 +	@return False	Otherwise.
   1.329 +	*/
   1.330 +	IMPORT_C static TBool UniCode();
   1.331 +	
   1.332 +	/**
   1.333 +	Create the Localisation Table.
   1.334 +	
   1.335 +	@param aLocale a pointer to a structure of type SLocaleData. 
   1.336 +	*/
   1.337 +	IMPORT_C static void LocaleData(SLocaleData *aLocale);
   1.338 +	
   1.339 +	/**
   1.340 +	Returns the address of the Currency Symbol.
   1.341 +	
   1.342 +	@return const TText16 * Address of the Currency Symbol.
   1.343 +	*/
   1.344 +	IMPORT_C static const TLocaleText* CurrencySymbol();
   1.345 +	
   1.346 +	/**
   1.347 +	Returns the address of the short date format.
   1.348 +	
   1.349 +	@return  const TText16 * Address of the Short date format.
   1.350 +	*/
   1.351 +	IMPORT_C static const TLocaleText* ShortDateFormatSpec();
   1.352 +	
   1.353 +	/**
   1.354 +	Returns the address of the long date format.
   1.355 +	
   1.356 +	@return  const TText16 * Address of the Long date format. 
   1.357 +	*/
   1.358 +	IMPORT_C static const TLocaleText* LongDateFormatSpec();
   1.359 +	
   1.360 +	/**
   1.361 +	Returns the address of the time format.
   1.362 +	
   1.363 +	@return  const TText16 * Address of the time format. 
   1.364 +	*/
   1.365 +	IMPORT_C static const TLocaleText* TimeFormatSpec();
   1.366 +	
   1.367 +	/**
   1.368 +	Returns the addresses of the FAT utility functions.
   1.369 +	
   1.370 +	@return  const TFatUtilityFunctions * Addresses of the FAT utility functions.
   1.371 +	*/
   1.372 +	IMPORT_C static const TFatUtilityFunctions* FatUtilityFunctions();
   1.373 +	
   1.374 +	/**
   1.375 +	Returns the address of the data suffix table.
   1.376 +	
   1.377 +	@return  const TText16 * Address of the Date Suffix Table.
   1.378 +	*/
   1.379 +	IMPORT_C static const TLocaleText* const *DateSuffixTable();
   1.380 +	
   1.381 +	/**
   1.382 +	Returns the address of the day table.
   1.383 +	
   1.384 +	@return  const TText16 * Address of the Day table.
   1.385 +	*/
   1.386 +	IMPORT_C static const TLocaleText* const *DayTable();
   1.387 +	
   1.388 +	/**
   1.389 +	Returns the address of the abbreviated day table.
   1.390 +	
   1.391 +	@return  const TText16 * Address of the abbreviated day table.
   1.392 +	*/
   1.393 +	IMPORT_C static const TLocaleText* const *DayAbbTable();
   1.394 +	
   1.395 +	/**
   1.396 +	Returns the address of the month table.
   1.397 +	
   1.398 +	@return  const TText16 * Address of the month table.
   1.399 +	*/
   1.400 +	IMPORT_C static const TLocaleText* const *MonthTable();
   1.401 +	
   1.402 +	/**
   1.403 +	Returns the address of the abbreviated month table.
   1.404 +	
   1.405 +	@return  const TText16 * Address of the abbreviated month table.
   1.406 +	*/
   1.407 +	IMPORT_C static const TLocaleText* const *MonthAbbTable();
   1.408 +	
   1.409 +	/**
   1.410 +	Returns the address of the ampm table.
   1.411 +	
   1.412 +	@return  const TText16 * Address of the ampm table.
   1.413 +	*/
   1.414 +	IMPORT_C static const TLocaleText* const *AmPmTable();
   1.415 +	
   1.416 +	/**
   1.417 +	Returns the address of the message table.
   1.418 +	
   1.419 +	@return  const TText16 * Address of the message table.
   1.420 +	*/
   1.421 +	IMPORT_C static const TLocaleText* const *MsgTable();
   1.422 +	
   1.423 +	/**
   1.424 +	Returns the address of the locale character set object: contains collation rules etc.
   1.425 +	
   1.426 +	@return	 const LCharSet * Address of the locale character set if its a UNICODE build; NULL otherwise.
   1.427 +	*/
   1.428 +	IMPORT_C static const LCharSet *CharSet();
   1.429 +	
   1.430 +	/**
   1.431 +	Returns the address of the character type conversion table.
   1.432 +	
   1.433 +	@return  const TUint8 * Address of the character type conversion table if its a NON-UNICODE build;NULL otherwise
   1.434 +	*/
   1.435 +	IMPORT_C static const TUint8 *TypeTable();
   1.436 +	
   1.437 +	/**
   1.438 +	Returns the address of the uppercase table.
   1.439 +	
   1.440 +	@return  const TText16 * Address of the uppercase table if its a NON-UNICODE build;NULL otherwise
   1.441 +	
   1.442 +	*/
   1.443 +	IMPORT_C static const TLocaleText* UpperTable();
   1.444 +	
   1.445 +	/**
   1.446 +	Returns the address of the lowercase table.
   1.447 +	
   1.448 +	@return  const TText16 * Address of the lowercase table if its a NON-UNICODE build;NULL otherwise
   1.449 +
   1.450 +	
   1.451 +	*/
   1.452 +	IMPORT_C static const TLocaleText* LowerTable();
   1.453 +	
   1.454 +	/**
   1.455 +	Returns the address of the fold table.
   1.456 +	
   1.457 +	@return  const TText16 * Address of the fold table if its a NON-UNICODE build;NULL otherwise
   1.458 +	
   1.459 +	*/
   1.460 +	IMPORT_C static const TLocaleText* FoldTable();
   1.461 +	
   1.462 +	/**
   1.463 +	Returns the address of the collate table.
   1.464 +	
   1.465 +	@return  const TText16 * Address of the fold table if its a NON-UNICODE build;NULL otherwise
   1.466 +	
   1.467 +	*/
   1.468 +	IMPORT_C static const TLocaleText* CollTable();
   1.469 +	};
   1.470 +
   1.471 +/**
   1.472 +@internalTechnology
   1.473 +@deprecated
   1.474 +*/
   1.475 +class LCountry
   1.476 +	{
   1.477 +public:
   1.478 +	static const TLanguage Language;
   1.479 +	static const TInt CountryCode;
   1.480 +	static const TInt UniversalTimeOffset;
   1.481 +	static const TDateFormat DateFormat;
   1.482 +	static const TTimeFormat TimeFormat;
   1.483 +	static const TLocaleText * const CurrencySymbol;
   1.484 +	static const TLocalePos CurrencySymbolPosition;
   1.485 +	static const TBool CurrencySpaceBetween;
   1.486 +	static const TInt CurrencyDecimalPlaces;
   1.487 +	static const TBool CurrencyNegativeInBrackets;
   1.488 +	static const TBool CurrencyTriadsAllowed;
   1.489 +	static const TLocaleText* const ShortDateFormatSpec;
   1.490 +	static const TLocaleText* const LongDateFormatSpec;
   1.491 +	static const TLocaleText* const TimeFormatSpec;
   1.492 +	static const TFatUtilityFunctions* const FatUtilityFunctions;
   1.493 +	static const TLocaleText * const ThousandsSeparator;
   1.494 +	static const TLocaleText * const DecimalSeparator;
   1.495 +	static const TLocaleText * const DateSeparator[KMaxDateSeparators];
   1.496 +	static const TLocaleText * const TimeSeparator[KMaxTimeSeparators];
   1.497 +	static const TLocalePos AmPmSymbolPosition;
   1.498 +	static const TBool AmPmSpaceBetween;
   1.499 +//	static const TUint DaylightSaving;
   1.500 +	static const TDaylightSavingZone HomeDaylightSavingZone;
   1.501 +	static const TUint WorkDays;
   1.502 +	static const TDay StartOfWeek;
   1.503 +	static const TClockFormat ClockFormat;
   1.504 +	static const TUnitsFormat UnitsGeneral;
   1.505 +	static const TUnitsFormat UnitsDistanceLong;
   1.506 +	static const TUnitsFormat UnitsDistanceShort;
   1.507 +	};
   1.508 +
   1.509 +
   1.510 +/**
   1.511 +Settings for the locale language. They are some text tables of 
   1.512 +day names, month names etc.
   1.513 +*/
   1.514 +class LLanguage
   1.515 +	{
   1.516 +public:
   1.517 +	/** Text table containing the suffix strings of all days in a month. */
   1.518 +	static const TLocaleText * const DateSuffixTable[KMaxSuffixes];
   1.519 +	/** Text table containing the names of days in a week. */
   1.520 +	static const TLocaleText * const DayTable[KMaxDays];
   1.521 +	/** Text table containing the abbreviated names of days in a week. */
   1.522 +	static const TLocaleText * const DayAbbTable[KMaxDays];
   1.523 +	/** Text table containing the month names. */
   1.524 +	static const TLocaleText * const MonthTable[KMaxMonths];
   1.525 +	/** Text table containing the abbreviated month names. */
   1.526 +	static const TLocaleText * const MonthAbbTable[KMaxMonths];
   1.527 +	/** Text table containing the am/pm strings. */
   1.528 +	static const TLocaleText * const AmPmTable[KMaxAmPms];
   1.529 +	};
   1.530 +
   1.531 +class LMessages
   1.532 +	{
   1.533 +public:
   1.534 +	/** Text table containing the default messages for File Server, Sound Driver, and Media Drivers. */
   1.535 +	static const TLocaleText * const MsgTable[ELocaleMessages_LastMsg];
   1.536 +	};
   1.537 +
   1.538 +/*
   1.539 + * The LAlphabet class has been abolished in the Unicode build.
   1.540 + * Locale-specific character set information is kept in a unique LCharSet
   1.541 + * structure (defined in U32STD.H; used by the Exec, Locl, and K classes).
   1.542 + * The reason for having an actual object (rather than a class with no
   1.543 + * instances but with static members) is so that its address can be
   1.544 + * returned by the new Exec function GetLocaleCharSet().
   1.545 + */
   1.546 +extern const LCharSet TheCharSet;	// the one and only LCharSet object
   1.547 +
   1.548 +#undef TLocaleText
   1.549 +
   1.550 +#endif