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