kerneltest/f32test/locl/localeutils/t_tls_table.cpp
changeset 15 4122176ea935
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
       
     1 // Copyright (c) 2007-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"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <kernel/localise.h>
       
    17 #include "complocl.h"
       
    18 
       
    19 //	This UK locale dll is created only for the purpose of instantiating FatUtilityFunctions
       
    20 
       
    21 /**
       
    22 Gets the current language type.
       
    23 @return language type.
       
    24 */
       
    25 EXPORT_C TLanguage Locl::Language()
       
    26 	{
       
    27 
       
    28 	return(LLocaleData::Language);
       
    29 	}
       
    30 
       
    31 /**
       
    32 Creates the localisation table.
       
    33 @param aLocale A pointer to the structure to be created. It holds 
       
    34 the system's locale settings.
       
    35 */
       
    36 EXPORT_C void Locl::LocaleData(SLocaleData *aLocale)
       
    37 	{
       
    38 
       
    39 	aLocale->iCountryCode=LLocaleData::CountryCode;
       
    40 	aLocale->iUniversalTimeOffset=LLocaleData::UniversalTimeOffset;
       
    41 	aLocale->iDateFormat=LLocaleData::DateFormat;
       
    42 	aLocale->iTimeFormat=LLocaleData::TimeFormat;
       
    43 	aLocale->iCurrencySymbolPosition=LLocaleData::CurrencySymbolPosition;
       
    44 	aLocale->iCurrencySpaceBetween=LLocaleData::CurrencySpaceBetween;
       
    45 	aLocale->iCurrencyDecimalPlaces=LLocaleData::CurrencyDecimalPlaces;
       
    46 	aLocale->iNegativeCurrencyFormat=TNegativeCurrencyFormat(LLocaleData::NegativeCurrencyFormat); // replaces iCurrencyNegativeInBrackets
       
    47 	aLocale->iCurrencyTriadsAllowed=LLocaleData::CurrencyTriadsAllowed;
       
    48 	aLocale->iThousandsSeparator=*LLocaleData::ThousandsSeparator;
       
    49 	aLocale->iDecimalSeparator=*LLocaleData::DecimalSeparator;
       
    50 	TInt i=0;
       
    51 	for(;i<KMaxDateSeparators;i++)
       
    52 		aLocale->iDateSeparator[i]=*LLocaleData::DateSeparator[i];
       
    53 	for(i=0;i<KMaxTimeSeparators;i++)
       
    54 		aLocale->iTimeSeparator[i]=*LLocaleData::TimeSeparator[i];
       
    55 	aLocale->iAmPmSymbolPosition=LLocaleData::AmPmSymbolPosition;
       
    56 	aLocale->iAmPmSpaceBetween=LLocaleData::AmPmSpaceBetween;
       
    57 //	aLocale->iDaylightSaving=LLocaleData::DaylightSaving;
       
    58 	aLocale->iHomeDaylightSavingZone=LLocaleData::HomeDaylightSavingZone;
       
    59 	aLocale->iWorkDays=LLocaleData::WorkDays;
       
    60 	aLocale->iStartOfWeek=LLocaleData::StartOfWeek;
       
    61 	aLocale->iClockFormat=LLocaleData::ClockFormat;
       
    62 	aLocale->iUnitsGeneral=LLocaleData::UnitsGeneral;
       
    63 	aLocale->iUnitsDistanceLong=LLocaleData::UnitsGeneral;
       
    64 	aLocale->iUnitsDistanceShort=LLocaleData::UnitsGeneral;
       
    65 	aLocale->iExtraNegativeCurrencyFormatFlags=LLocaleData::ExtraNegativeCurrencyFormatFlags;
       
    66 	aLocale->iLanguageDowngrade[0] = static_cast<TUint16>(LLocaleData::LanguageDowngrade[0]);
       
    67 	aLocale->iLanguageDowngrade[1] = static_cast<TUint16>(LLocaleData::LanguageDowngrade[1]);
       
    68 	aLocale->iLanguageDowngrade[2] = static_cast<TUint16>(LLocaleData::LanguageDowngrade[2]);
       
    69 	}
       
    70 
       
    71 /**
       
    72 Gets the address of the currency symbol, e.g. '$' for US dollar.
       
    73 @return The address of the currency symbol.
       
    74 */
       
    75 EXPORT_C const TText * Locl::CurrencySymbol()
       
    76 	{
       
    77 
       
    78 	return(LLocaleData::CurrencySymbol);
       
    79 	}
       
    80 
       
    81 /**
       
    82 Gets the address of the short date format.
       
    83 @return The address of the short date format.
       
    84 */
       
    85 EXPORT_C const TText* Locl::ShortDateFormatSpec()
       
    86 	{
       
    87 
       
    88 	return(LLocaleData::ShortDateFormatSpec);
       
    89 	}
       
    90 
       
    91 /**
       
    92 Gets the address of the long date format.
       
    93 @return The address of the long date format.
       
    94 */
       
    95 EXPORT_C const TText* Locl::LongDateFormatSpec()
       
    96 	{
       
    97 
       
    98 	return(LLocaleData::LongDateFormatSpec);
       
    99 	}
       
   100 
       
   101 /**
       
   102 Gets the address of the time format.
       
   103 @return The address of the time format.
       
   104 */
       
   105 EXPORT_C const TText* Locl::TimeFormatSpec()
       
   106 	{
       
   107 
       
   108 	return(LLocaleData::TimeFormatSpec);
       
   109 	}
       
   110 
       
   111 /**
       
   112 Gets the address of the FAT utility functions.
       
   113 @return The address of the FAT utility functions.
       
   114 */
       
   115 EXPORT_C const TFatUtilityFunctions* Locl::FatUtilityFunctions()
       
   116 	{
       
   117 
       
   118 	return(LLocaleData::FatUtilityFunctions);
       
   119 	}
       
   120 
       
   121 /**
       
   122 Gets the address of the date suffix table. A date suffix table
       
   123 stores the suffix strings of the 31 days in a month, e.g. in English, 
       
   124 "st" for first day of the month, "nd" for the second day of the month.
       
   125 @return The address of the date suffix table.
       
   126 */
       
   127 EXPORT_C const TText * const * Locl::DateSuffixTable()
       
   128 	{
       
   129 
       
   130 	return(&LLanguage::DateSuffixTable[0]);
       
   131 	}
       
   132 
       
   133 /**
       
   134 Gets the address of the day table, which stores the names 
       
   135 of weekdays. In English, it starts with "Monday" and ends
       
   136 with "Sunday".
       
   137 @return The address of the day table.
       
   138 */
       
   139 EXPORT_C const TText * const * Locl::DayTable()
       
   140 	{
       
   141 
       
   142 	return(&LLanguage::DayTable[0]);
       
   143 	}
       
   144 
       
   145 /**
       
   146 Gets the address of the abbreviated day table, which stores 
       
   147 the abbreviated names of weekdays. In English, it starts
       
   148 with "Mon" and ends with "Sun".
       
   149 @return The address of the abbreviated day table.
       
   150 */
       
   151 EXPORT_C const TText * const * Locl::DayAbbTable()
       
   152 	{
       
   153 
       
   154 	return(&LLanguage::DayAbbTable[0]);
       
   155 	}
       
   156 
       
   157 /**
       
   158 Gets the address of the month table, which stores 
       
   159 the names of the months. In English, it starts with 
       
   160 "January", and ends with "December".
       
   161 @return The address of the month table.
       
   162 */
       
   163 EXPORT_C const TText * const * Locl::MonthTable()
       
   164 	{
       
   165 
       
   166 	return(&LLanguage::MonthTable[0]);
       
   167 	}
       
   168 
       
   169 /**
       
   170 Gets the address of the abbreviated month table, which stores 
       
   171 the abbreviated names of the months, In English, it starts
       
   172 with "Jan", and ends with "Dec".
       
   173 @return The address of the month table.
       
   174 */
       
   175 EXPORT_C const TText * const * Locl::MonthAbbTable()
       
   176 	{
       
   177 
       
   178 	return(&LLanguage::MonthAbbTable[0]);
       
   179 	}
       
   180 
       
   181 /**
       
   182 Gets the address of the AmPm table, which stores the expression 
       
   183 for the morning and the afternoon, in English, "am" for the
       
   184 morning and "pm" for the afternoon.
       
   185 @return The address of the AmPm table.
       
   186 */
       
   187 EXPORT_C const TText * const * Locl::AmPmTable()
       
   188 	{
       
   189 
       
   190 	return(&LLanguage::AmPmTable[0]);
       
   191 	}
       
   192 
       
   193 /**
       
   194 Gets the address of the message table. The message table contains 
       
   195 messages that the base software may need to issue without the 
       
   196 benefit of access to compiled resources.
       
   197 @return The address of the message table.
       
   198 */
       
   199 EXPORT_C const TText * const * Locl::MsgTable()
       
   200 	{
       
   201 
       
   202 	return(&LMessages::MsgTable[0]);
       
   203 	}
       
   204 
       
   205 /**
       
   206 Gets the address of the locale character set object which contains 
       
   207 collation rules etc. It is used in Unicode builds to supply 
       
   208 locale-specific character attribute and collation data.
       
   209 @return The address of the locale character set object, or NULL 
       
   210 in case of a non-UNICODE build.
       
   211 */
       
   212 EXPORT_C const LCharSet* Locl::CharSet()
       
   213 	{
       
   214 	#ifdef _UNICODE
       
   215 		return &TheCharSet;
       
   216 	#else
       
   217 		return NULL;
       
   218 	#endif
       
   219 	}
       
   220 
       
   221 /**
       
   222 Gets the address of the character type conversion table.
       
   223 The character type conversion table does not exist in 
       
   224 the Unicode build. This table has 256 items which classifies
       
   225 256 ASCII codes into: Uppercase letter, Lowercase letter, 
       
   226 Punctuation, Decimal digit etc..
       
   227 @return The address of the character type conversion table, 
       
   228 or NULL in case of a UNICODE build.
       
   229 */
       
   230 EXPORT_C const TUint8 * Locl::TypeTable()
       
   231 	{
       
   232 	#ifdef _UNICODE
       
   233 		return NULL;
       
   234 	#else
       
   235 		return(&LAlphabet::TypeTable[0]);
       
   236 	#endif 		
       
   237 	}
       
   238 
       
   239 
       
   240 /**
       
   241 Gets the address of the uppercase table. The uppercase table 
       
   242 does not exist in the Unicode build. It is used to convert 
       
   243 the letter in lowercase to uppercase.
       
   244 @return The address of the uppercase table, or NULL
       
   245 in case of a UNICODE build.
       
   246 */
       
   247 EXPORT_C const TText * Locl::UpperTable()
       
   248 	{
       
   249 	#ifdef _UNICODE
       
   250 		return NULL;
       
   251 	#else
       
   252 		return(&LAlphabet::UpperTable[0]);
       
   253 	#endif 
       
   254 
       
   255 	}
       
   256 
       
   257 /**
       
   258 Gets the address of the lowercase table. The lowercase table
       
   259 does not exist in the Unicode build. It is used to convert 
       
   260 the letter in uppercase to lowercase.
       
   261 @return The address of the lowercase table, or NULL
       
   262 in case of a UNICODE build.
       
   263 */
       
   264 EXPORT_C const TText * Locl::LowerTable()
       
   265 	{
       
   266 	#ifdef _UNICODE
       
   267 		return NULL;
       
   268 	#else
       
   269 		return(&LAlphabet::LowerTable[0]);
       
   270 	#endif 
       
   271 	}
       
   272 
       
   273 /**
       
   274 Gets the address of the fold table. The fold table does not exist 
       
   275 in the Unicode build. It is used to fold the character according
       
   276 to a specified folding method: converting characters to their 
       
   277 lower case form, if any; stripping accents; converting digits 
       
   278 representing values 0..9 to characters '0'..'9' etc..
       
   279 @return The address of the fold table, or NULL
       
   280 in case of a UNICODE build.
       
   281 */
       
   282 EXPORT_C const TText * Locl::FoldTable()
       
   283 	{
       
   284 	#ifdef _UNICODE
       
   285 		return NULL;
       
   286 
       
   287 	#else
       
   288 		return(&LAlphabet::FoldTable[0]);
       
   289 	#endif 
       
   290 	}
       
   291 
       
   292 /**
       
   293 Gets the address of the collate table. The collate table does
       
   294 not exist in the Unicode build. This table is used to collate
       
   295 strings to remove differences between characters that are deemed 
       
   296 unimportant for the purposes of ordering characters.
       
   297 @return The address of the collate table, or NULL
       
   298 in case of a UNICODE build.
       
   299 */
       
   300 EXPORT_C const TText * Locl::CollTable()
       
   301 	{
       
   302 	#ifdef _UNICODE
       
   303 		return NULL;
       
   304 	#else
       
   305 		return(&LAlphabet::CollTable[0]);
       
   306 	#endif 
       
   307 	}
       
   308 
       
   309 /**
       
   310 Check whether it is a Unicode Build.
       
   311 @return ETrue for Unicode Build, EFalse for non-Unicode Build.
       
   312 */
       
   313 EXPORT_C TBool Locl::UniCode()
       
   314 	{
       
   315 	#ifdef _UNICODE
       
   316 		return ETrue;
       
   317 	#else
       
   318 		return EFalse;
       
   319 	#endif 
       
   320 	}