本文整理汇总了C++中TLocale::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TLocale::Set方法的具体用法?C++ TLocale::Set怎么用?C++ TLocale::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLocale
的用法示例。
在下文中一共展示了TLocale::Set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: setDateFormat
/*!
*/
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: setStartOfWeek
/*!
Sets the start of week value selected by the user.
\param index The index of the selected value.
*/
void SettingsUtility::setStartOfWeek(int index)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETSTARTOFWEEK_ENTRY );
TLocale locale;
TDay day = (TDay)index;
locale.SetStartOfWeek(day);
locale.Set();
OstTraceFunctionExit0( SETTINGSUTILITY_SETSTARTOFWEEK_EXIT );
}
示例4: setDateSeparator
/*!
*/
void SettingsUtility::setDateSeparator(const QString &separator)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETDATESEPARATOR_ENTRY );
TLocale locale;
locale.SetDateSeparator(
TChar(separator.unicode()->unicode()), 1);
locale.SetDateSeparator(
TChar(separator.unicode()->unicode()), 2);
locale.Set();
OstTraceFunctionExit0( SETTINGSUTILITY_SETDATESEPARATOR_EXIT );
}
示例5: setTimeSeparator
/*!
*/
void SettingsUtility::setTimeSeparator(const QString &separator)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETTIMESEPARATOR_ENTRY );
if (mTimeSeparatorList.contains(separator)) {
TLocale locale;
locale.SetTimeSeparator(TChar(separator.unicode()->unicode()), 1);
locale.SetTimeSeparator(TChar(separator.unicode()->unicode()), 2);
locale.Set();
}
OstTraceFunctionExit0( SETTINGSUTILITY_SETTIMESEPARATOR_EXIT );
}
示例6: setTimeFormat
/*!
*/
void SettingsUtility::setTimeFormat(const QString& format)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETTIMEFORMAT_ENTRY );
TLocale locale;
if (format == mTimeFormatList.at(0)) {
locale.SetTimeFormat(ETime24);
} else if (format == mTimeFormatList.at(1)) {
locale.SetTimeFormat(ETime12);
} else {
// Nothing to do.
}
locale.Set();
OstTraceFunctionExit0( SETTINGSUTILITY_SETTIMEFORMAT_EXIT );
}
示例7: 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();
}
示例8: new
/**
@SYMTestCaseID SYSLIB-LOGENG-CT-0883
@SYMTestCaseDesc Tests for CLogClient::ClearLog() function
@SYMTestPriority High
@SYMTestActions Change locale settings,call up ClearLog and try to retrieve event,test for count of number of events in the view.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void TestClearLog2L(CLogClient& aClient)
{
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0883 "));
CLogEvent* event = CLogEvent::NewL();
CleanupStack::PushL(event);
event->SetEventType(KLogCallEventTypeUid);
CTestActive* active = new(ELeave)CTestActive();
CleanupStack::PushL(active);
CLogViewEvent* view = CLogViewEvent::NewL(aClient);
CleanupStack::PushL(view);
// change Locale
TLocale locale;
locale.SetCountryCode(47);//Norway
locale.SetDateFormat(EDateEuropean);
locale.SetTimeFormat(ETime12);
for (int i=0; i<4; i++)
{
locale.SetTimeSeparator(TChar('.'),i);
locale.SetDateSeparator(TChar(':'),i);
}
locale.Set();
// change the log duration settings to 1 day
TLogConfig config;
active->StartL();
aClient.GetConfig(config, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNone);
config.iMaxLogSize = KTestEventAge * 2;
config.iMaxEventAge = 86400;
active->StartL();
aClient.ChangeConfig(config, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNone);
// add a call event
active->StartL();
aClient.AddEvent(*event, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNone);
User::After(1000000);
TTime now;
now.HomeTime();
event->SetTime(now);
active->StartL();
aClient.ChangeEvent(*event, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNone);
// forward two days
now+=(TTimeIntervalDays )2;
User::SetHomeTime(now);
active->StartL();
aClient.ClearLog(now, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNone);
// try to retrieve event
active->StartL();
aClient.GetEvent(*event, active->iStatus);
CActiveScheduler::Start();
TEST2(active->iStatus.Int(), KErrNotFound);;
TEST(view->CountL() == 0);
CleanupStack::PopAndDestroy(3); // view, active, event
}