本文整理汇总了C++中TDes::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::Left方法的具体用法?C++ TDes::Left怎么用?C++ TDes::Left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::Left方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Construct
void CIntRangeTestParameter::Construct(TDes& aValue)
{
if(aValue.Find(_L("..")) != KErrNotFound)
{
TInt pos = aValue.Find(_L(".."));
TLex startLex(aValue.Left(pos));
TLex endLex(aValue.Mid(pos+2));
if(startLex.Val(iStart)!=KErrNone)
return;
// checks if startLex is at end of string, if not there was garbage in the string so throw it out
else if(!startLex.Eos())
return;
if(endLex.Val(iFinish)!=KErrNone)
return;
// checks if startLex is at end of string, if not there was garbage in the string so throw it out
else if(!endLex.Eos())
return;
// checks if range is doable
if(iStart > iFinish)
return;
}
else
return;
iValid = ETrue;
}
示例2: MakeNameUniqueL
// Make profile name unique. Must already be a legal filename
void CProfileListDialog::MakeNameUniqueL(TDes &aName) {
HBufC *fileNameBuf = HBufC::NewLC(KMaxFileName);
TPtr fileName = fileNameBuf->Des();
HBufC *newNameBuf = HBufC::NewLC(KMaxFileName);
TPtr newName = newNameBuf->Des();
newName = aName;
TBool done = EFalse;
TInt num = 2;
while ( !done ) {
fileName = iProfileDirectory;
fileName.Append(newName);
TEntry dummy;
TInt err = CEikonEnv::Static()->FsSession().Entry(fileName, dummy);
if ( err == KErrNotFound ) {
// Have a unique name
aName = newName;
break;
}
User::LeaveIfError(err);
// Start adding numbers to the end of the name
if ( aName.Length() > (KMaxFileName + 14) ) {
aName = aName.Left(KMaxFileName + 14);
}
newName.Format(KUniqueProfileFormat, &aName, num);
num++;
}
CleanupStack::PopAndDestroy(2); //fileNameBuf, newNameBuf;
}
示例3: readConsoleLineBuf
LOCAL_C TInt readConsoleLineBuf(const TDesC& aPrompt, TDes& aBuf)
{
test.Printf(_L("\n "));
TBool quit = EFalse;
_LIT(KDeleteChar, "\b \b");
test.Printf(aPrompt);
while (!quit)
{
TKeyCode k = test.Getch();
TChar key = k;
switch (key)
{
case EKeyBackspace:
if (aBuf.Length() > 0)
{
test.Printf(KDeleteChar);
aBuf = aBuf.Left(aBuf.Length() - 1);
}
break;
case EKeyEnter:
if (aBuf.Length())
quit = ETrue;
else
test.Printf(_L("\nLogin, password and server address cannot be zero length "));
break;
default:
test.Printf(_L("%c"), key);
aBuf.Append(key);
break;
}
}
return(KErrNone);
}
示例4: GetItem
// ---------------------------------------------------------------------------
// CAknMemorySelectionModelMultiDrive::GetItem
// ---------------------------------------------------------------------------
//
void CAknMemorySelectionModelMultiDrive::GetItem( TInt aIndex, TDes& aItem )
{
aItem = iListBoxArray[ aIndex ]->Des();
if( iLayout == ELayoutPopupMenu || iLayout == ELayoutDoublePopup )
{
// On layout with graphic, delete image index.
_LIT( KTab, "\t" );
TInt tabIndex( aItem.Find( KTab ) );
if( tabIndex >= 0 )
{
aItem.Delete( 0, tabIndex + 1 );
}
if( iLayout == ELayoutDoublePopup )
{
tabIndex = aItem.Find( KTab );
if( tabIndex >= 0 )
{
aItem = aItem.Left( tabIndex );
}
}
}
}