本文整理汇总了C++中TDes::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::Format方法的具体用法?C++ TDes::Format怎么用?C++ TDes::Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::Format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeElementL
// -----------------------------------------------------------------------------
// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
// const TDesC& aDate)
// Constructs element with attributes "Version" and "Date"(eg.
// "<FW Version="2.2"/>").
// -----------------------------------------------------------------------------
//
void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
const TDesC& aDate)
{
_LIT(KFormat1, "<%S %S=\"%S\" %S=\"%S\"/>");
_LIT(KFormat2, "<%S %S=\"%S\"/>");
aText=KNullDesC;
TBuf<KTagSize> element;
TBuf<KTagSize> versionTag;
TBuf<KTagSize> dateTag;
GetTagL(element, aId);
GetTagL(versionTag, EAttVersion);
GetTagL(dateTag, EAttDate);
if (aDate.Length()>0)
{
aText.Format(KFormat1, &element, &versionTag, &aVersion, &dateTag,
&aDate);
}
else
{
aText.Format(KFormat2, &element, &versionTag, &aVersion);
}
}
示例2: SetFreeSizeText
void ScrShotsGenUtils::SetFreeSizeText(CScrShotsStrLoader* strLoader, TDes& aFreeSizeText, TInt64 aDriveFreeSize)
{
TPtr formatStrFreeSizeCell = strLoader->GetStringHBuf(EDriveListFreeSizeCellFormatString)->Des();
if((aDriveFreeSize / (KOneGB)) > 0)
aFreeSizeText.Format(formatStrFreeSizeCell, &KGBStr,aDriveFreeSize / (KOneGB));
else if((aDriveFreeSize / (KOneMB)) > 0)
aFreeSizeText.Format(formatStrFreeSizeCell, &KMBStr,aDriveFreeSize / (KOneMB));
else if((aDriveFreeSize / (KOneKB)) > 0)
aFreeSizeText.Format(formatStrFreeSizeCell,&KKBStr, aDriveFreeSize / (KOneKB));
else
aFreeSizeText.Format(formatStrFreeSizeCell, &KBytesStr,aDriveFreeSize );
}
示例3: OutputCodeSegmentsL
EXPORT_C void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter, TBool aLowerCaseSectionHeading)
{
_LIT(KHeaderLC, "Code Segments");
_LIT(KHeaderUC, "CODE SEGMENTS");
_LIT(KFmtOverflow, "Only first %d code segments displayed");
_LIT(KFmtMod, "%S%08X-%08X %S");
const TInt KMaxCount = 256;
TAny* handles[KMaxCount];
TInt c = KMaxCount;
TInt r = iEngine.Driver().GetCodeSegs(aPid, handles, c);
if ( r == KErrNone )
{
if ( c > 0 )
{
if ( aLowerCaseSectionHeading )
{
iEngine.Sink().OutputSectionHeadingL( KHeaderLC, aSectionUnderlineCharacter );
}
else
{
iEngine.Sink().OutputSectionHeadingL( KHeaderUC, aSectionUnderlineCharacter );
}
if (c > KMaxCount)
{
c = KMaxCount;
aLine.Format(KFmtOverflow, c);
iEngine.Sink().OutputLineL( aLine );
}
TBuf<KMaxFileName> path;
TMemSpyDriverCodeSegInfo info;
for (TInt i=0; i<c; i++)
{
r = iEngine.Driver().GetCodeSegInfo(handles[i], aPid, info);
//
if ( r == KErrNone )
{
path.Copy( info.iCreateInfo.iFileName );
aLine.Format(KFmtMod, &aPrefix, info.iMemoryInfo.iCodeBase,info.iMemoryInfo.iCodeBase + info.iMemoryInfo.iCodeSize, &path);
iEngine.Sink().OutputLineL( aLine );
}
}
}
}
}
示例4: LocationRequestThreadMainPartL
/**
* Connection is opened to location server,and closed
*
* If anything fails during the execution of this test, then function
* leaves with proper error code.
*
* Parameters:
**/
void LocationRequestThreadMainPartL(TDes& aErrorBuf)
{
// Open connection to Location server
RPositionServer server;
TInt err = server.Connect();
if (err != KErrNone)
{
_LIT(KErrOpen, "Server open failed with code %d\r\n");
aErrorBuf.Format(KErrOpen, err);
}
else
{
_LIT(KOkOpen, "Server open ok\r\n");
aErrorBuf.Copy(KOkOpen);
}
User::LeaveIfError(err);
CleanupClosePushL(server);
CleanupStack::PopAndDestroy(1); // server, positioner
_LIT(KInfTestComplet, "Test completed ok for this thread\r\n");
aErrorBuf.Append(KInfTestComplet);
}
示例5: FormatTimeSimple
void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime )
{
const TDateTime dt = aTime.DateTime();
//
_LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
}
示例6: GetCommandListPathL
// ---------------------------------------------------------------------------
// CSsmShutdownPolicy::GetCommandListPathL
// ---------------------------------------------------------------------------
//
void CSsmShutdownPolicy::GetCommandListPathL( TDes& aCmdListPath )
{
FUNC_LOG;
aCmdListPath.Format( KCommandListPath );
iUtil->GetCommandListPath( aCmdListPath );
}
示例7: CreateListBoxItemL
/**
* Create a list box item with the given column values.
*/
void CSettingList::CreateListBoxItemL( TDes& aBuffer,
const TDesC& aMainText,
const TDesC& aSecondaryText )
{
_LIT ( KStringHeader, "\t%S\t%S" );
aBuffer.Format( KStringHeader(), &aMainText, &aSecondaryText );
}
示例8: ClientAppFolder
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::ClientAppFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::ClientAppFolder(
const CHttpClientApp* aClientApp,
TDes& aFolder )
{
_LIT( KClientAppFolderFormat, "%S%x\\" );
aFolder.Format( KClientAppFolderFormat, &KDmDefaultDir, aClientApp->AppUid() );
}
示例9: MakeTimeStrMilli
void TAzenqosEngineUtils::MakeTimeStrMilli(TTime &time,TDes& str) //str should be at least 19 in length
{
const TInt KThousand = 1000;
TDateTime date = time.DateTime();
str.Format(KTimeStampMillisecFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second(),date.MicroSecond()*KThousand);
}
示例10: SetTotalSizeText
void CScrShotsDriveGrid::SetTotalSizeText(TDes& aTotalSizeText, TInt64 aDriveTotalSize)
{
TPtr formatStr = iParentControl->GetAppView()->GetAppUi().GetStrLoader()->GetStringHBuf(EDriveTotalSizeFormatString)->Des();
if((aDriveTotalSize / (KOneGB)) > 0){
aTotalSizeText.Format(formatStr,&KGBStr,aDriveTotalSize / (KOneGB));
}
else if((aDriveTotalSize / (KOneMB)) > 0){
aTotalSizeText.Format(formatStr,&KMBStr,aDriveTotalSize / (KOneMB));
}
else if((aDriveTotalSize / (KOneKB)) > 0){
aTotalSizeText.Format(formatStr,&KKBStr, aDriveTotalSize / (KOneKB));
}
else{
aTotalSizeText.Format(formatStr,&KBytesStr,aDriveTotalSize );
}
}
示例11: GetErrorTextL
void CPodcastAppUi::GetErrorTextL(TDes &aErrorMessage, TInt aErrorCode)
{
switch (aErrorCode)
{
case KErrNotFound:
{
HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_INVALID_ADDRESS);
aErrorMessage.Copy(*error);
CleanupStack::PopAndDestroy(error);
}
break;
case KErrDiskFull:
{
HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_DISK_FULL);
aErrorMessage.Copy(*error);
CleanupStack::PopAndDestroy(error);
}
break;
case 404:
{
HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_NOTFOUND);
aErrorMessage.Copy(*error);
CleanupStack::PopAndDestroy(error);
}
break;
default:
{
if (aErrorCode > 200)
{
HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_HTTP);
aErrorMessage.Format(*error, aErrorCode);
CleanupStack::PopAndDestroy(error);
}
else
{
HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_GENERAL);
aErrorMessage.Format(*error, aErrorCode);
CleanupStack::PopAndDestroy(error);
}
}
break;
}
}
示例12: DoOutputChunkInfoForObjectL
void CMemSpyEngineHelperChunk::DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType )
{
TFullName ownerName;
//
RArray<TAny*> handles( 128 );
CleanupClosePushL( handles );
//
GetChunkHandlesL( handles, aType, aId );
CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
//
CleanupStack::PopAndDestroy( &handles );
CleanupStack::PushL( list );
//
const TInt count = list->Count();
for (TInt i=0; i<count; i++)
{
const CMemSpyEngineChunkEntry& entry = list->At( i );
//
_LIT(KLine1, "Name");
iEngine.Sink().OutputItemAndValueL( KLine1, entry.Name() );
//
_LIT(KLine2, "Owner");
entry.OwnerName( ownerName );
iEngine.Sink().OutputItemAndValueL( KLine2, ownerName );
//
_LIT(KLine3, "Address");
_LIT(KLine3Format, "0x%08x - 0x%08x");
aLineBuffer.Format(KLine3Format, entry.BaseAddress(), entry.UpperAddress() );
iEngine.Sink().OutputItemAndValueL( KLine3, aLineBuffer );
//
_LIT(KLine4, "Size (max)");
_LIT(KLine4Format, "%d (%d)");
aLineBuffer.Format(KLine4Format, entry.Size(), entry.MaxSize());
iEngine.Sink().OutputItemAndValueL( KLine4, aLineBuffer );
//
if ( i < count - 1 )
{
iEngine.Sink().OutputBlankLineL();
}
}
//
CleanupStack::PopAndDestroy( list );
}
示例13: CodFolder
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::DownloadInfoFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::CodFolder(
const CHttpClientApp* aClientApp,
TDes& aFolder ) const
{
_LIT( KDownloadFolderFormat, "%S%x\\%S\\" );
aFolder.Format( KDownloadFolderFormat,
&KDmDefaultDir,
aClientApp->AppUid(),
&KCodsDirName );
}
示例14: ClientAppFolderWithoutDriveLetter
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::ClientAppFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::ClientAppFolderWithoutDriveLetter(
const CHttpClientApp* aClientApp,
TDes& aFolder )
{
_LIT( KClientAppFolderFormat, "%s%x\\" );
// [3] cut off the drive letter + ':\\' part
aFolder.Format( KClientAppFolderFormat,
&KDmDefaultDir()[3],
aClientApp->AppUid() );
}
示例15: GetCommandListPath
/*
Helper function to create command list path for start-up.
Implements fallback mechanism to launch 'sysstart.exe' if static command list for 'start-up' state is not found.
This temporary implementation is required during migration from existing 'sysstart' to 'ssma start-up'.
*/
void CGsaStatePolicyStartup::GetCommandListPath(TUint aBootMode, TDes& aCmdListPath)
{
aCmdListPath.Format(KCommandListPath, aBootMode);
TBool found = BaflUtils::FolderExists(iFs, aCmdListPath);
// This Fallback mechanism is used internally during migration from 'sysstart' to 'ssma start-up' and is not required otherwise.
if (!found)
{
aCmdListPath.Copy(KFallbackCmdListPath());
iLaunchSysStart = ETrue; // launch 'sysstart.exe'
}
}