本文整理汇总了C++中TDes::AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::AppendFormat方法的具体用法?C++ TDes::AppendFormat怎么用?C++ TDes::AppendFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::AppendFormat方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AppendScheduleTimeL
EXPORT_C TInt CMsvTestUtils::AppendScheduleTimeL(TMsvId aEntryId, TDes& rOutput)
{
TTime entryTime, schTime;
TTaskInfo info;
TInt err = ScheduleTime(aEntryId, entryTime, schTime, info);
if (!err)
{
TBuf<128> dateString;
entryTime.FormatL(dateString, _L("\tEntry: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
rOutput.Append(dateString);
schTime.FormatL(dateString, _L("\n\tSched: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
rOutput.Append(dateString);
rOutput.AppendFormat(_L(" (taskId %d)\n"), info.iTaskId);
}
else
{
rOutput.AppendFormat(_L("\tError %d: Cannot read schedule time for msg %d\n"), err, aEntryId);
}
return err;
}
示例2: AppendFileLength
EXPORT_C void TSTStringFormatter::AppendFileLength(TInt64 aLength, TDes &aLengthStr)
{
if (aLength<0) return;
TInt range;
for (range=0;range<3;++range)
{
if (aLength<1000*1000) break; // keep some digits from fraction
aLength/=1000;
}
#ifdef EKA2
TReal len=aLength;
#else
TReal len=aLength.GetTInt();
#endif
if (len>1000) { len/=1000; ++range; }
if (range==0)
aLengthStr.AppendFormat(_L("%.0f"),len);
else
aLengthStr.AppendFormat(_L("%.1f"),len);
switch (range)
{
case 0: aLengthStr.Append(_L(" B")); break;
case 1: aLengthStr.Append(_L(" kB")); break;
case 2: aLengthStr.Append(_L(" MB")); break;
case 3: aLengthStr.Append(_L(" GB")); break;
case 4: aLengthStr.Append(_L(" TB")); break;
default: __ASSERT_DEBUG(false,User::Panic(_L("#TStringFormatter"),0));
}
}
示例3: StatusDump
void CWsWindow::StatusDump(TDes &aBuf)
{
_LIT(KStatusString1,"CWsWindow[0x%x]RWindow[0x%x,%d],Pos(%d,%d),Size(%d,%d)");
_LIT(KStatusString3,",Mode=%d");
_LIT(KStatusInvisible,",Inv");
aBuf.AppendFormat(KStatusString1,this,iClientHandle,LogHandle(),iRel.iTl.iX,iRel.iTl.iY,Size().iWidth,Size().iHeight);
aBuf.AppendFormat(KStatusString3,(TInt)iScreen->DisplayMode());
if (!IsVisible())
aBuf.Append(KStatusInvisible);
}
示例4: getCpuCount
// Gets the CPU count of all threads in process aproc
//and returns the hour minute second in the references passed
//If CPU count cant be obtained returns -1
int getCpuCount(TFileName& apname,TDes& aResult)
{
TInt64 proctime=0;
int res;
RThread thrd;
TTimeIntervalMicroSeconds cputime(0);
TBool notime;
TFileName aprocname(apname);
aprocname.Append('*');
TFindThread tfinder(aprocname);
notime=false;
while(1)
{
res = tfinder.Next(aprocname);
if(res!=KErrNone)
{
break;
}
res=thrd.Open(tfinder);
if(res!=KErrNone)
{
notime=true;
continue;
}
res=thrd.GetCpuTime(cputime);
if(res!=KErrNone)
{
// GetCpuTime() not supported.
//kernel doesn't support this
}
proctime+=cputime.Int64();
thrd.Close();
}
TTime time(proctime);
TDateTime date=time.DateTime();
if(date.Day()==0)
{
aResult.AppendFormat(_L(" %02d:%02d:%02d "),date.Hour(),date.Minute(),date.Second());
}
else
{
aResult.AppendFormat(_L(" %d-%02d:%02d:%02d "),date.Day(),date.Hour(),date.Minute(),date.Second());
}
if(notime)
{
aResult.Append(_L("?"));
}
if(!notime)
return 0;
else
return -1;
}
示例5: getMemoryInfo
// Gets memory information of the process aproc
int getMemoryInfo(RProcess& aproc,TDes& aResult)
{
int res=KErrNone;
#ifdef __WINSCW__
aResult.AppendFormat(_L(" ? ? "));
#else
TModuleMemoryInfo mem;
res=aproc.GetMemoryInfo(mem);
aResult.AppendFormat(_L("%-11u %-10u"),mem.iCodeBase,(mem.iCodeSize + mem.iInitialisedDataSize+mem.iConstDataSize + mem.iUninitialisedDataSize)/512);
#endif
return res;
}
示例6: ConvertBinToText
/**
This function is used by RMobileSmartCardEap::Open() to convert the
TAID (which is binary data) to a string that can be passed through
ETel. The conversion changes the binary data to a string of
hexadecimal semi-octets.
@param aBinData Buffer containing the binary data to be converted.
@param aText Buffer will contain the text representation of aBinData on
return.
@see RMobileSmartCardEap::Open()
*/
void RMobileSmartCardEap::ConvertBinToText(const TDesC8& aBinData, TDes& aText)
{
TInt binLength = aBinData.Length();
for (TInt pos = 0; pos < binLength; pos++)
{
_LIT(format, "%02X");
aText.AppendFormat(format, aBinData[pos]);
}
}
示例7: AppendInterfaceProperties
void AppendInterfaceProperties(TDes& aDes, const SCdlInterface& aInterface)
{
aDes.AppendFormat(_L("%S\nUid: 0x%08x\nMajorVer: %d\nMinorVer: %d\nFlags: 0x%08x\nAPI size: %d\nEng major: %d\nEng minor: %d"),
aInterface.iName,
aInterface.iUid,
aInterface.iMajorVer,
aInterface.iMinorVer,
aInterface.iFlags,
aInterface.iApiSize,
aInterface.iMajorEngVer,
aInterface.iMinorEngVer
);
}
示例8: ToStr
void TEventEntry::ToStr(TDes& aStr)
{
if (IsEvent()) // Event or Action
{
aStr.Append(KLitEvent);
}
else
{
aStr.Append(KLitAction);
}
if (iSequenceNumber>=0)
{
aStr.AppendFormat(KLit02D, iSequenceNumber);
}
aStr.Append(KLitColon);
if (iType!=EActionUserWait)
{
aStr.AppendFormat(KLitA02D, iAlarmIdx); // Alarm idx
}
aStr.AppendFormat(KLitS, &TypeToStr()); // Event name
if (iType==EEventVisible) // Visibility
{
aStr.AppendFormat(KLitS, &BoolToStr(iVisible));
}
if (iType==EEventSetState) // State flags
{
aStr.AppendFormat(KLitFlags, iAltSFlags);
}
if (iType==EActionUserWait)
{
aStr.AppendFormat(KLitDSec, iPeriod);
if (iAlarmIdx==KBogusAlarmIdx) aStr.AppendFormat(KLitCompleted);
}
if (iType==EActionSnooze || iType==EActionPauseSound)
{
aStr.AppendFormat(KLitForDMinutes, iPeriod/60);
}
}
示例9: MakeLocaleSpecificExtension
void CHlpFileEntry::MakeLocaleSpecificExtension(TDes& aNameToAppendTo, TLanguage aLanguage) const
{
_LIT(KLocaleExtensionFormat, ".H%02d");
aNameToAppendTo.AppendFormat(KLocaleExtensionFormat, aLanguage);
}
示例10: AppendProfileCount
void CTestList::AppendProfileCount(TDes &aDes, TInt aNum)
{
aDes.AppendFormat(_L("%d, "),aNum);
}
示例11: AppendProfileNum
void CTestList::AppendProfileNum(TDes &aDes, TInt aNum)
{
aDes.AppendFormat(_L("%d.%02d, "),aNum/1000000,(aNum%1000000)/10000);
}