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