本文整理汇总了C++中TLocale类的典型用法代码示例。如果您正苦于以下问题:C++ TLocale类的具体用法?C++ TLocale怎么用?C++ TLocale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLocale类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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 );
}
示例3: symbianGroupSeparator
/*!
Retrieves Symbian locale group separator.
*/
static QString symbianGroupSeparator()
{
TLocale *locale = _s60Locale.GetLocale();
TChar grpSep = locale->ThousandsSeparator();
int val = grpSep;
return QChar(val);
}
示例4: symbianDecimalPoint
/*!
Retrieves Symbian locale decimal separator.
*/
static QString symbianDecimalPoint()
{
TLocale *locale = _s60Locale.GetLocale();
TChar decPoint = locale->DecimalSeparator();
int val = decPoint;
return QChar(val);
}
示例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);
}
示例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
}
示例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;
}
示例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;
}
示例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");
}
示例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();
}
示例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;
}
示例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
}
示例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);
}
示例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
}
示例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;
}