|
1 /* |
|
2 * Copyright (c) 2000 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 the License "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 |
|
20 |
|
21 #include <kernel/localise.h> |
|
22 #include "t_tlocl32_complocl.h" |
|
23 #include "t_tlocl32_unicodeconv.h" |
|
24 #include "t_tlocl32_shiftjis.h" |
|
25 |
|
26 class ShiftJis |
|
27 { |
|
28 public: |
|
29 static void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TFatUtilityFunctions::TOverflowAction aOverflowAction); |
|
30 static void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TFatUtilityFunctions::TOverflowAction aOverflowAction); |
|
31 static TBool IsLegalShortNameCharacter (TUint aCharacter); |
|
32 }; |
|
33 |
|
34 |
|
35 void ShiftJis::ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& /*aReplacementForUnconvertibleUnicodeCharacters*/, TFatUtilityFunctions::TOverflowAction aOverflowAction) |
|
36 { |
|
37 TInt err = KErrNone; |
|
38 aForeign.Zero(); |
|
39 TRAP(err, UnicodeConv::ConvertFromUnicodeL(aForeign, aUnicode)); |
|
40 |
|
41 // Ignore overflow errors if you're allowed to truncate the string |
|
42 // if (aOverflowAction == TFatUtilityFunctions::EOverflowActionTruncate && err == KErrOverflow) |
|
43 if (aOverflowAction == TFatUtilityFunctions::EOverflowActionTruncate && err == KErrBadName) |
|
44 { |
|
45 err = KErrNone; |
|
46 } |
|
47 |
|
48 User::LeaveIfError(err); |
|
49 } |
|
50 |
|
51 void ShiftJis::ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TFatUtilityFunctions::TOverflowAction aOverflowAction) |
|
52 { |
|
53 TInt err = KErrNone; |
|
54 aUnicode.Zero(); |
|
55 TRAP(err, UnicodeConv::ConvertToUnicodeL(aUnicode, aForeign)); |
|
56 |
|
57 // Ignore overflow errors if you're allowed to truncate the string |
|
58 // if (aOverflowAction == TFatUtilityFunctions::EOverflowActionTruncate && err == KErrOverflow) |
|
59 if (aOverflowAction == TFatUtilityFunctions::EOverflowActionTruncate && err == KErrBadName) |
|
60 { |
|
61 err = KErrNone; |
|
62 } |
|
63 |
|
64 User::LeaveIfError(err); |
|
65 } |
|
66 |
|
67 |
|
68 TBool ShiftJis::IsLegalShortNameCharacter (TUint aCharacter) |
|
69 { |
|
70 return UnicodeConv::IsLegalShortNameCharacter (aCharacter); |
|
71 } |
|
72 |
|
73 |
|
74 const TFatUtilityFunctions shiftJisFatUtilityFunctions= |
|
75 { |
|
76 ShiftJis::ConvertFromUnicodeL, |
|
77 ShiftJis::ConvertToUnicodeL, |
|
78 ShiftJis::IsLegalShortNameCharacter |
|
79 }; |
|
80 |
|
81 |
|
82 // The japanese configuration data |
|
83 |
|
84 const TLanguage LLocaleData::Language = ELangJapanese; |
|
85 const TInt LLocaleData::CountryCode = 81; |
|
86 const TInt LLocaleData::UniversalTimeOffset = 9*3600; |
|
87 const TDateFormat LLocaleData::DateFormat = EDateJapanese; |
|
88 const TTimeFormat LLocaleData::TimeFormat = ETime24; |
|
89 const TLocalePos LLocaleData::CurrencySymbolPosition = ELocaleBefore; |
|
90 const TBool LLocaleData::CurrencySpaceBetween = EFalse; |
|
91 const TInt LLocaleData::CurrencyDecimalPlaces = 0; |
|
92 const TLocale::TNegativeCurrencyFormat LLocaleData::NegativeCurrencyFormat=TLocale::TNegativeCurrencyFormat(0); |
|
93 const TBool LLocaleData::CurrencyTriadsAllowed = ETrue; |
|
94 const TText * const LLocaleData::ThousandsSeparator = _S(","); |
|
95 const TText * const LLocaleData::DecimalSeparator = _S("."); |
|
96 const TText * const LLocaleData::DateSeparator[KMaxDateSeparators] = {_S(""),_S("/"),_S("/"),_S("")}; |
|
97 const TText * const LLocaleData::TimeSeparator[KMaxTimeSeparators] = {_S(""),_S(":"),_S(":"),_S("")}; |
|
98 const TLocalePos LLocaleData::AmPmSymbolPosition = ELocaleAfter; |
|
99 const TBool LLocaleData::AmPmSpaceBetween = EFalse; |
|
100 //const TUint LLocaleData::DaylightSaving = EDstNone; |
|
101 const TDaylightSavingZone LLocaleData::HomeDaylightSavingZone = EDstNone; |
|
102 const TUint LLocaleData::WorkDays = 0x1f; |
|
103 const TText * const LLocaleData::CurrencySymbol = _S("\x00a5"); |
|
104 const TText* const LLocaleData::ShortDateFormatSpec = _S("%F%*D/%*M/%Y"); |
|
105 const TText* const LLocaleData::LongDateFormatSpec = _S("%F%Y\x5e74%*M\x6708%*D\x65e5"); |
|
106 const TText* const LLocaleData::TimeFormatSpec = _S("%F%*I:%T:%S %*A"); |
|
107 const TFatUtilityFunctions* const LLocaleData::FatUtilityFunctions = &shiftJisFatUtilityFunctions; |
|
108 const TDay LLocaleData::StartOfWeek = ESunday; |
|
109 const TClockFormat LLocaleData::ClockFormat = EClockDigital; |
|
110 const TUnitsFormat LLocaleData::UnitsGeneral = EUnitsMetric; |
|
111 const TUnitsFormat LLocaleData::UnitsDistanceShort = EUnitsMetric; |
|
112 const TUnitsFormat LLocaleData::UnitsDistanceLong = EUnitsMetric; |
|
113 const TUint LLocaleData::ExtraNegativeCurrencyFormatFlags = 0; |
|
114 //const TLanguage LLocaleData::LanguageDowngrade[3] = {ELangNone, ELangNone, ELangNone}; |
|
115 //const TDigitType LLocaleData::DigitType = EDigitTypeWestern; |
|
116 |
|
117 // End of file |