本文整理汇总了C++中TLocale类的典型用法代码示例。如果您正苦于以下问题:C++ TLocale类的具体用法?C++ TLocale怎么用?C++ TLocale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLocale类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initialiseTimeFormat
static void initialiseTimeFormat()
{
if(timeFormat.Length())
return;
TLocale locale;
//Separator 1 is used between 1st and 2nd components of the time
//Separator 2 is used between 2nd and 3rd components of the time
//Usually they are the same, but they are allowed to be different
TChar s1 = locale.TimeSeparator(1);
TChar s2 = locale.TimeSeparator(2);
switch(locale.TimeFormat()) {
case ETime12:
timeFormat.Append(_L("%I"));
break;
case ETime24:
default:
timeFormat.Append(_L("%H"));
break;
}
timeFormat.Append(s1);
timeFormat.Append(_L("%T"));
timeFormat.Append(s2);
timeFormat.Append(_L("%S"));
#ifdef _DEBUG
RDebug::Print(_L("Time Format \"%S\""), &timeFormat);
#endif
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:29,代码来源:qlocale_3_1.cpp
示例2: OstTraceFunctionEntry0
/*!
*/
void SettingsUtility::setDateFormat(const QString &format)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETDATEFORMAT_ENTRY );
TLocale locale;
int index;
for (index = 0; index < mDisplayDateFormatList.count(); ++index) {
if (format == mDisplayDateFormatList.at(index)) {
break;
}
}
switch (index) {
case 0:
locale.SetDateFormat(EDateEuropean);
break;
case 1:
locale.SetDateFormat(EDateAmerican);
break;
case 2:
locale.SetDateFormat(EDateJapanese);
break;
default:
//Nothing to do.
break;
}
locale.Set();
OstTraceFunctionExit0( SETTINGSUTILITY_SETDATEFORMAT_EXIT );
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:33,代码来源:settingsutility.cpp
示例3: symbianGroupSeparator
/*!
Retrieves Symbian locale group separator.
*/
static QString symbianGroupSeparator()
{
TLocale *locale = _s60Locale.GetLocale();
TChar grpSep = locale->ThousandsSeparator();
int val = grpSep;
return QChar(val);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:11,代码来源:qlocale_symbian.cpp
示例4: symbianDecimalPoint
/*!
Retrieves Symbian locale decimal separator.
*/
static QString symbianDecimalPoint()
{
TLocale *locale = _s60Locale.GetLocale();
TChar decPoint = locale->DecimalSeparator();
int val = decPoint;
return QChar(val);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:11,代码来源:qlocale_symbian.cpp
示例5: symbianZeroDigit
/*!
Retrieves Symbian locale zero digit.
*/
static QString symbianZeroDigit()
{
TLocale *locale = _s60Locale.GetLocale();
// TDigitType enumeration value returned by TLocale
// will always correspond to zero digit unicode value.
TDigitType digit = locale->DigitType();
return QChar(digit);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:12,代码来源:qlocale_symbian.cpp
示例6: toLocal
/*
Intended Usage: Utility routine for converting from UTC to localtime.
*/
inline time_t toLocal (const time_t aUniversalTime)
{
#ifndef __SERIES60_MRT_1_0
TTimeIntervalSeconds offset = User::UTCOffset();
return aUniversalTime + offset.Int();
#else
TLocale locale;
return aUniversalTime + locale.UniversalTimeOffset().Int();
#endif //__SERIES60_MRT_1_0
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:13,代码来源:time.cpp
示例7: InitialiseData
void TCalRRule::InitialiseData()
{
iBuffer = 0;
iCount = 0;
iUntil.SetTimeUtcL(Time::NullTTime()); // this can't leave
iInterval = 1;
TLocale locale;
iWkSt = locale.StartOfWeek();
iReserved = 0;
iReserved2 = 0;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:11,代码来源:calrrule.cpp
示例8: OPENG_DP
// ---------------------------------------------------------------------------
// TPresCondValidity::ConvertToLocal()
// ---------------------------------------------------------------------------
//
void TPresCondValidity::ConvertToLocal(TTime& aDateTime)
{
OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ConvertToLocal()" ) );
OPENG_DP(D_OPENG_LIT( " ConvertToLocal aDateTime:"));
LogDateTime(aDateTime.DateTime());
TLocale myLocale;
myLocale.Refresh();
// getting UTC difference
TTimeIntervalSeconds uTCseconds = myLocale.UniversalTimeOffset();
aDateTime = aDateTime + uTCseconds;
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:17,代码来源:prescondvalidity.cpp
示例9:
RtoB_TEST::RtoB_TEST()
{
num=0.0;
format.iType=KRealFormatGeneral;
format.iWidth=KDefaultRealWidth;
format.iPlaces=0;
TLocale locale;
format.iPoint=locale.DecimalSeparator();
format.iTriad=locale.ThousandsSeparator();
format.iTriLen=1;
res=_S("0");
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:13,代码来源:t_fltcl.cpp
示例10: SetLanguage
/**
Sets up the system-wide locale and language downgrade path for the new locale model.
*/
void REComLanguagePluginTest::SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3])
{
TLocale locale;
TExtendedLocale extendedLocale;
TInt loadval = 0;
extendedLocale.LoadSystemSettings();
loadval = extendedLocale.LoadLocale(aLanguage,aReg,aColl);
TEST(loadval==KErrNone, __LINE__);
extendedLocale.SaveSystemSettings();
locale.SetLanguageDowngrade(0, aLang[0]);
locale.SetLanguageDowngrade(1, aLang[1]);
locale.SetLanguageDowngrade(2, aLang[2]);
locale.Set();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:19,代码来源:t_language.cpp
示例11:
/**
This routine is used to check if conversion of digits is needed.
Conversion is needed if user language is
- Arabic, Urdu or Farsi and if digit type is Arabic-Indic
- Urdu or Farsi and digit type is Eastern Arabic_indic
- Hindi and digit type is Devanagari.
@return ETrue if conversion is needed, EFalse if not
*/
TBool CResourceLoader::LanguageSpecificNumberConverter::IsConversionNeeded()
{
TLocale locale;
locale.Refresh();
const TLanguage language = User::Language();
const TDigitType digitType = locale.DigitType();
if ( ( ( language == ELangArabic || language == ELangUrdu || language == ELangFarsi ) &&
digitType == EDigitTypeArabicIndic )
|| ( ( language == ELangUrdu || language == ELangFarsi ) &&
digitType == EDigitTypeEasternArabicIndic )
|| ( language == ELangHindi && digitType == EDigitTypeDevanagari )
)
{
return ETrue;
}
return EFalse;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:28,代码来源:basepluginresourceloader.cpp
示例12: GetIsDst
bool_t GetIsDst(datetime_t UNUSED_PARAM(t))
{
#ifndef SYMBIAN90
TLocale locale;
return locale.QueryHomeHasDaylightSavingOn();
#else
TBool IsDst=EFalse;
RTz TzServer;
if (TzServer.Connect()==KErrNone)
{
CTzConverter* Converter = CTzConverter::NewL(TzServer);
CTzId* TzId = CTzId::NewL(Converter->CurrentTzId());
IsDst = TzServer.IsDaylightSavingOnL(*TzId);
delete TzId;
delete Converter;
TzServer.Close();
}
return IsDst;
#endif
}
开发者ID:ViFork,项目名称:ResInfo,代码行数:20,代码来源:date_symbian.cpp
示例13: testChangeLocale
void testChangeLocale(TInt isrom)
{
TLocale locale;
#ifdef __WINS__
//We get a power-change notification 1 second after switch-on
//So we wait for a second on WINS.
//Should we fix this bug??
User::After(1000000);
#endif
RChangeNotifier notifier;
TInt res=notifier.Create();
test(res==KErrNone);
TRequestStatus stat;
res=notifier.Logon(stat);
test(res==KErrNone);
//initial pattern of stat is already tested by t_chnot
res=notifier.Logon(stat);
test(res==KErrNone);
test(stat==KRequestPending);
if (isrom == 0)
{
test.Printf(_L("Change to RAM US Locale\n"));
res=UserSvr::ChangeLocale(ELOCLUS);
}
else
{
test.Printf(_L("Change to ROM US Locale\n"));
res=UserSvr::ChangeLocale(ELOCLUS_ROM);
}
test.Printf(_L("res=%d\n"),res);
test(res==KErrNone);
test(stat.Int() & EChangesLocale);
res=notifier.Logon(stat);
test(res==KErrNone);
test(stat==KRequestPending);
locale.Refresh();
testUS(locale);
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:41,代码来源:t_pagemove.cpp
示例14: initialiseDateFormat
static void initialiseDateFormat()
{
if(dateFormat.Length())
return;
TLocale locale;
//Separator 1 is used between 1st and 2nd components of the date
//Separator 2 is used between 2nd and 3rd components of the date
//Usually they are the same, but they are allowed to be different
TChar s1 = locale.DateSeparator(1);
TChar s2 = locale.DateSeparator(2);
dateFormat=KLocaleIndependent;
switch(locale.DateFormat()) {
case EDateAmerican:
dateFormat.Append(KMonth);
dateFormat.Append(s1);
dateFormat.Append(KDay);
dateFormat.Append(s2);
dateFormat.Append(KYear);
break;
case EDateEuropean:
dateFormat.Append(KDay);
dateFormat.Append(s1);
dateFormat.Append(KMonth);
dateFormat.Append(s2);
dateFormat.Append(KYear);
break;
case EDateJapanese:
default: //it's closest to ISO format
dateFormat.Append(KYear);
dateFormat.Append(s1);
dateFormat.Append(KMonth);
dateFormat.Append(s2);
dateFormat.Append(KDay);
break;
}
#ifdef _DEBUG
RDebug::Print(_L("Date Format \"%S\""), &dateFormat);
#endif
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:41,代码来源:qlocale_3_1.cpp
示例15: GetDatePacked
bool_t GetDatePacked(datetime_t t, datepack_t *tp, bool_t Local)
{
TDateTime Date;
TTime ot;
if (!tp || t == INVALID_DATETIME_T) return 0;
ot = DateTimeToSymbian(t);
if (Local)
{
#ifndef SYMBIAN90
TLocale locale;
TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset());
ot += universalTimeOffset;
if (locale.QueryHomeHasDaylightSavingOn())
{
TTimeIntervalHours daylightSaving(1);
ot += daylightSaving;
}
#else
RTz TzServer;
if (TzServer.Connect()==KErrNone)
{
CTzConverter* Converter = CTzConverter::NewL(TzServer);
Converter->ConvertToLocalTime(ot);
delete Converter;
TzServer.Close();
}
#endif
}
Date = ot.DateTime();
tp->Year = Date.Year();
tp->Month = (int)Date.Month() + 1;
tp->Day = Date.Day()+1;
tp->Hour = Date.Hour();
tp->Minute = Date.Minute();
tp->Second = Date.Second();
return 1;
}
开发者ID:ViFork,项目名称:ResInfo,代码行数:40,代码来源:date_symbian.cpp
示例16: switch
/**
This routine is used to convert between European digits and
Arabic-Indic, Eastern Arabic-Indic, Devanagari or Thai digits
based on existing digit type setting.
@param aDes Parameter to change
*/
void CResourceLoader::LanguageSpecificNumberConverter::Convert( TDes &aDes )
{
TLocale locale;
locale.Refresh();
const TDigitType digitType = locale.DigitType();
TChar toArea = 0x030;
switch( digitType )
{
case EDigitTypeWestern:
case EDigitTypeArabicIndic:
case EDigitTypeEasternArabicIndic:
case EDigitTypeDevanagari:
case EDigitTypeThai:
toArea = digitType;
break;
case EDigitTypeUnknown:
case EDigitTypeAllTypes:
return;
}
const TInt length = aDes.Length();
for( TInt i = 0; i < length; i++ )
{
TChar character = aDes[i];
TChar fromArea = NumberToBase( character );
TChar::TBdCategory cat = character.GetBdCategory();
switch( cat )
{
case TChar::EArabicNumber:
case TChar::EEuropeanNumber:
character += toArea;
character -= fromArea;
aDes[i] = TUint16( character );
break;
default:
break;
}
}
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:46,代码来源:basepluginresourceloader.cpp
示例17: TimePackToRel
datetime_t TimePackToRel(const datepack_t *tp, bool_t Local)
{
TDateTime Date;
TTime ot;
if (!tp) return INVALID_DATETIME_T;
Date.SetYear(tp->Year);
Date.SetMonth((TMonth)(tp->Month-1));
Date.SetDay(tp->Day-1);
Date.SetHour(tp->Hour);
Date.SetMinute(tp->Minute);
Date.SetSecond(tp->Second);
ot = TTime(Date);
if (Local)
{
#ifndef SYMBIAN90
TLocale locale;
TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset());
ot -= universalTimeOffset;
if (locale.QueryHomeHasDaylightSavingOn())
{
TTimeIntervalHours daylightSaving(1);
ot -= daylightSaving;
}
#else
RTz TzServer;
if (TzServer.Connect()==KErrNone)
{
CTzConverter* Converter = CTzConverter::NewL(TzServer);
Converter->ConvertToUniversalTime(ot);
delete Converter;
TzServer.Close();
}
#endif
}
return SymbianToDateTime(ot);
}
开发者ID:ViFork,项目名称:ResInfo,代码行数:39,代码来源:date_symbian.cpp
示例18: reorderingNeeded
/**
* Current implementation of this should work for any RTL language if it sets the
* digit type to digit types checked for below
*
* It is meant as a patch for S60 2.0, not as a complete solution to the problem of date
* presentation.
*/
TBool AknDateFormatUtils::DateFieldReOrderingNeeded(TLanguage* aForceLanguage )
{
TBool reorderingNeeded(EFalse);
TLocale locale;
TLanguage language = (aForceLanguage != NULL) ? *aForceLanguage : AknLangUtils::UserLanguage();
// Reordering needed in case of RTL language, we have arabic digits and if the separator is not
// numeric separator.
if ( TBidiText::ScriptDirectionality( language ) == TBidiText::ERightToLeft )
{
TInt digitType = locale.DigitType();
if ( digitType == EDigitTypeArabicIndic ||
digitType == EDigitTypeEasternArabicIndic )
{
TChar sep( locale.DateSeparator(1) );
if ( sep.GetBdCategory() != TChar::ECommonNumberSeparator )
{
reorderingNeeded = ETrue;
}
}
}
return reorderingNeeded;
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:31,代码来源:AknDateFormatUtils.cpp
示例19: DaylightSavingsAppliesL
TBool Util::DaylightSavingsAppliesL(const TTime& utc)
{
// This algorithm needs the first day of the week to be monday
TDay oldStart;
TLocale set;
oldStart = set.StartOfWeek();
set.SetStartOfWeek(EMonday);
set.Set();
TBuf<9> min;
TBuf<9> max;
utc.FormatL(min, KDaylightSavingsMinFormat);
utc.FormatL(max, KDaylightSavingsMaxFormat);
// Get times representing the first/last possible day of this
// year that daylight savings time change could change on
TTime timeMin;
User::LeaveIfError(timeMin.Set(min));
TTime timeMax;
User::LeaveIfError(timeMax.Set(max));
// Find the last sunday in the respective months
TTimeIntervalDays addMin(6 - timeMin.DayNoInWeek());
TTimeIntervalDays addMax(6 - timeMax.DayNoInWeek());
timeMin += addMin;
timeMax += addMax;
// The change happens at 1AM.
TTimeIntervalHours hour(1);
timeMin += hour;
timeMax += hour;
// Now we know which day the change occurs on.
// Compare it to what the UTC is.
TBool result = ((timeMin <= utc) && (timeMax > utc));
// reset the first week day
set.SetStartOfWeek(oldStart);
set.Set();
return result;
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:51,代码来源:util.cpp
示例20: s60ToQtFormat
/*!
Returns a Qt version of the given \a sys_fmt Symbian locale format string.
*/
static QString s60ToQtFormat(const QString &sys_fmt)
{
TLocale *locale = _s60Locale.GetLocale();
QString result;
QString other;
QString qtformatchars = QString::fromLatin1("adhmsyzAHM");
QChar c;
int i = 0;
bool open_escape = false;
bool abbrev_next = false;
bool locale_indep_ordering = false;
bool minus_mode = false;
bool plus_mode = false;
bool n_mode = false;
TTimeFormat tf = locale->TimeFormat();
while (i < sys_fmt.size()) {
c = sys_fmt.at(i);
// let formatting thru
if (c.unicode() == '%') {
// if we have gathered string, concat it
if (!other.isEmpty()) {
result += other;
other.clear();
}
// if we have open escape, end it
if (open_escape) {
result += QLatin1Char('\'');
open_escape = false;
}
++i;
if (i >= sys_fmt.size())
break;
c = sys_fmt.at(i);
// process specials
abbrev_next = c.unicode() == '*';
plus_mode = c.unicode() == '+';
minus_mode = c.unicode() == '-';
if (abbrev_next || plus_mode || minus_mode) {
++i;
if (i >= sys_fmt.size())
break;
c = sys_fmt.at(i);
if (plus_mode || minus_mode) {
// break on undefined plus/minus mode
if (c.unicode() != 'A' && c.unicode() != 'B')
break;
}
}
switch (c.unicode()) {
case 'F':
{
// locale indep mode on
locale_indep_ordering = true;
break;
}
case '/':
{
// date sep 0-3
++i;
if (i >= sys_fmt.size())
break;
c = sys_fmt.at(i);
if (c.isDigit() && c.digitValue() <= 3) {
TChar s = locale->DateSeparator(c.digitValue());
TUint val = s;
// some indexes return zero for empty
if (val > 0)
result += QChar(val);
}
break;
}
case 'D':
{
if (!locale_indep_ordering)
break;
if (!abbrev_next)
result += QLatin1String("dd");
else
result += QLatin1Char('d');
break;
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:101,代码来源:qlocale_symbian.cpp
注:本文中的TLocale类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论