本文整理汇总了C++中TDes::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::Delete方法的具体用法?C++ TDes::Delete怎么用?C++ TDes::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::Delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyClientUid
// -----------------------------------------------------------------------------
// ModifyClientUid
// -----------------------------------------------------------------------------
//
void CHssIapHandler::ModifyClientUid( TDes& aUid )
{
DEBUG("CHssIapHandler::ModifyClientUid");
TInt indx = aUid.Find( KMark1 );
if ( KErrNotFound != indx )
{
aUid.Delete( indx, 1 );
indx = aUid.Find( KMark2 );
if ( KErrNotFound != indx )
{
aUid.Delete( indx, 1 );
}
}
}
示例2: StripSpaces
void CUtils::StripSpaces(TDes& aText)
{
TInt i;
for (i=0; i<aText.Length(); i++)
if (aText[i] != ' ')
break;
if (i)
aText.Delete(0,i);
for (i=aText.Length()-1; i>=0; i--)
if (aText[i] != ' ')
break;
if (i != aText.Length()-1)
aText.Delete(i+1,aText.Length()-1-i);
}
示例3: ModifyClientUid
// -----------------------------------------------------------------------------
// ModifyClientUid
// -----------------------------------------------------------------------------
//
void CHotSpotSession::ModifyClientUid( TDes& aUid )
{
DEBUG("CHotSpotSession::ModifyClientUid");
TInt indx = aUid.Find( KMark1 );
if ( KErrNotFound != indx )
{
aUid.Delete( indx, 1 );
indx = aUid.Find( KMark2 );
if ( KErrNotFound != indx )
{
aUid.Delete( indx, 1 );
}
}
}
示例4: ValidateId
void CXmppChannelIdUtilities::ValidateId(TDes& aId) {
aId.LowerCase();
// Remove non-ascii characters
for(TInt i = aId.Length() - 1; i >= 0; i--) {
if(aId[i] >= 123) {
aId[i] = (aId[i] % 26) + 97;
}
else if(aId[i] != 32 && aId[i] != 95 && aId[i] != 45 &&
(aId[i] <= 47 || (aId[i] >= 57 && aId[i] <= 64) ||
(aId[i] >= 91 && aId[i] <= 96))) {
aId.Delete(i, 1);
}
}
// Trim whitespace
aId.Trim();
// Add hyphens
for(TInt i = 0; i < aId.Length(); i++) {
if(aId[i] == 32 || aId[i] == 95) {
aId[i] = 45;
}
}
}
示例5:
void CntFilterDetail::TMatch::stripOutNonDigitChars(TDes& text)
{
for (TInt chrPos = 0; chrPos < text.Length(); ++chrPos) {
TChar chr = text[chrPos];
if (!chr.IsDigit()) {
text.Delete(chrPos, 1);
--chrPos;
}
}
}
示例6:
/**
Strip out any non-digit characters before we convert the phone number to an
integer.
@param aText Phone number which on return will have any non-digit characters
removed.
*/
void CPplCommAddrTable::TMatch::StripOutNonDigitChars(TDes& aText)
{
for(TInt chrPos = 0; chrPos < aText.Length(); ++chrPos)
{
TChar chr = aText[chrPos];
if (!chr.IsDigit() )
{
aText.Delete(chrPos, 1);
--chrPos;
}
}
}
示例7: GetUniqueRuleId
// ---------------------------------------------------------------------------
// CPresenceXDM::GetUniqueRuleId()
// ---------------------------------------------------------------------------
//
void CPresenceXDM::GetUniqueRuleId(TDes& aRuleId)
{
OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetUniqueRuleId" ));
aRuleId.Copy(KPresRuleIDPrefix);
TInt myNumber;
// make sure that newly created rule id doesnt exist in the document
while (IsRuleExist(aRuleId))
{
aRuleId.Delete(KPresRuleIDPrefixLength, KPresRuleIDNumLength);
myNumber = Math::Random() - KPresRuleIdCalc;
aRuleId.AppendNumFixedWidth(myNumber,EDecimal,KPresRuleIDNumLength);
}
OPENG_DP(D_OPENG_LIT( " aRuleId = %S" ), &aRuleId);
}
示例8: RemoveNoDirMarkers
/**
Removes no dir markers from source text.
*/
void CResourceLoader::RemoveNoDirMarkers(TDes& aText)
{
TInt nextkey(0);
while (nextkey < aText.Length())
{
nextkey = aText.Locate(KDirNotFound);
if (nextkey != KErrNotFound)
{
aText.Delete(nextkey, 1);
nextkey++;
}
else
{
break;
}
}
}
示例9: 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 );
}
}
}
}
示例10: Formater
/**
Finds the keystring from the source string and replaces it with the
replacement string. The formated string is stored in the destination
descriptor.
*/
TInt CResourceLoader::Formater(TDes& aDest, const TDesC& aSource, const TDesC& aKey, const TDesC& aSubs, TBidiText::TDirectionality aDirectionality)
{
// substitute string must not contain KSubStringSeparator,
// or results will be unpredictable
__ASSERT_DEBUG(aSubs.Locate(KSubStringSeparator) == KErrNotFound,
User::Panic(KPanicCategory, EInvalidSubstitute));
TInt keylength(aKey.Length());
//aDest must be empty.
aDest.Zero();
// offset indicates end of last handled key in source
TInt offset(0);
// offset in destination string
TInt desOffset(0);
// Substring directionalities are adjusted after all changes are done.
TBool checkSubstringDirectionalities(EFalse);
// count is the position in the source from which the substring starts
TInt count(0);
// Replaced parameters count
TInt replaceCount(0);
while (count != KErrNotFound)
{
// desCount is the position of the substring starts in destination.
TInt desCount(0);
TPtrC remainder = aSource.Right(aSource.Length() - offset);
count = remainder.Find(aKey);
TInt maxSubLength = -1;
if (count != KErrNotFound)
{
replaceCount++;
desOffset += count;
offset += count;
count = offset;
desCount = desOffset;
// copy source to destination if first time
if (aDest.Length() == 0)
aDest.Append(aSource);
// delete found key from destination
aDest.Delete(desCount, keylength);
offset += keylength; // increase offset by key length
if (count + keylength < (aSource.Length()-1)) // aKey is not at the end of string
{
if (aSource[count+keylength] == '[') // Key includes max datalength
{
maxSubLength = 10*(aSource[count+keylength+1]-'0')
+ (aSource[count+keylength+2]-'0');
aDest.Delete(desCount,4); // Length information stored->delete from descriptor
offset += 4; // increase offset by max sub length indicator
}
}
aDest.Insert(desCount, aSubs);
desOffset = desCount + aSubs.Length();
if (maxSubLength > 0 && aSubs.Length() > maxSubLength)
{
aDest.Delete(desCount+maxSubLength-1, aSubs.Length()+1-maxSubLength);
TText ellipsis(KEllipsis);
aDest.Insert(desCount+maxSubLength-1, TPtrC(&ellipsis,1));
desOffset = desCount + maxSubLength;
}
TBidiText::TDirectionality subsDir =
TBidiText::TextDirectionality(aDest.Mid(desCount, desOffset - desCount));
// If inserted string has different directionality,
// insert directionality markers so that bidi algorithm works in a desired way.
if (aDirectionality != subsDir)
{
checkSubstringDirectionalities = ETrue;
TInt freeSpace = aDest.MaxLength() - aDest.Length();
// Protect the directionality of the inserted string.
if (freeSpace >= KExtraSpaceForSubStringDirMarkers)
{
TBuf<1> subsMarker;
subsMarker.Append(subsDir == TBidiText::ELeftToRight ?
KLRMarker : KRLMarker);
aDest.Insert(desOffset, subsMarker);
//.........这里部分代码省略.........
示例11: ResolveDirectionality
/**
Resolves directionality of the given source text.
Place-holder strings are removed so that they don't affect the result.
*/
TBidiText::TDirectionality CResourceLoader::ResolveDirectionality(TDes& aText, TBool* aFound)
{
TInt i = 0;
// Remove place-holders from string so they don't affect directionality
// length parameters e.g. "[29]" do not contain strongly directional
// characters so can ignore them.
while (i < aText.Length())
{
TPtrC remainder = aText.Right(aText.Length() - i);
TInt nextKey = remainder.Locate(KKeyPrefix);
i += nextKey;
if (nextKey != KErrNotFound && i < aText.Length() - 1)
{
TInt lastCharInKey = i + 1;
// skip possible key index
TText t = aText[lastCharInKey];
if (t >= '0' && t <= '9')
{
lastCharInKey++;
if (lastCharInKey < aText.Length())
{
t = aText[lastCharInKey];
if (t >= '0' && t <= '9')
{
lastCharInKey++;
}
}
}
// lastCharInKey is now the index of 'N' or 'U' in the key
if (lastCharInKey < aText.Length())
{
TText t = aText[lastCharInKey];
if (t == 'U' || t == 'N')
{
// found key, delete it and continue loop to
// search for the next key
aText.Delete(i, lastCharInKey - i + 1);
}
// This was not a proper key - check the remaining string
else
{
i = lastCharInKey + 1;
}
}
// end of string encountered - stop
else
{
break;
}
}
// no key found - stop
else
{
break;
}
}
return TBidiText::TextDirectionality(aText, aFound);
}
示例12: CorrectFilePathL
/*
-------------------------------------------------------------------------------
Class: TStifUtil
Method: CorrectFilePath
Description: Checks if file path contains drive letter. If not file is serched
on all drives and first hit is added to file name.
Parameters: TDes& aFilePath: in/out: file path to correct
Return Values: None
Errors/Exceptions: Leaves if some of called leaving methods leaves
-------------------------------------------------------------------------------
*/
EXPORT_C void TStifUtil::CorrectFilePathL( TDes& aFilePath )
{
_LIT( KDriveSelector, ":\\" );
_LIT( KDriveSelectorFormat_1, "%c:" );
_LIT( KDriveSelectorFormat_2, "%c:\\" );
TChar KDriveZ = EDriveZ;//'Z';
_LIT( KBackslash, "\\" );
TInt length = aFilePath.Length();
if (length == 0 )
{
return;
}
if (length > 2 )
{
// Check if file path contains drive selector
if ( aFilePath.Mid( 1, 2 ) == KDriveSelector )
{
// File path contains selector letter so we have nothing to do here
return;
}
}
// Check if file path contains backslash at the begining and
// select proper drive selector format according to this information
TInt driveSelectorFormat = 2;
if ( aFilePath.Mid( 0, 1 ) == KBackslash )
{
driveSelectorFormat = 1;
}
RFs rfs;
if ( rfs.Connect() != KErrNone )
{
return;
}
// Get available drives list, revers it order and move z drive at
// the end of the list.
TDriveList drivesList;
rfs.DriveList(drivesList);
// Set drive variable to last drive (except for Z, which will be checked at the end)
char drive = 'Y' ;
// Loop through all the drives in following order: YX..CBAZ
while(drive >= 'A' && drive <= 'Z')
{
// Do further action only if drive exists
TInt driveint;
rfs.CharToDrive(drive, driveint);
if(drivesList[driveint])
{
//further checking (drive selector and file existence)
// Prepare drive selector
TBuf<3> driveSelector;
if ( driveSelectorFormat == 1 )
{
driveSelector.Format( KDriveSelectorFormat_1, drive );
}
else if ( driveSelectorFormat == 2 )
{
driveSelector.Format( KDriveSelectorFormat_2, drive );
}
aFilePath.Insert( 0, driveSelector );
TEntry entry;
if ( rfs.Entry(aFilePath, entry) == KErrNone )
{
rfs.Close();
return;
}
// File does not exists on selected drive. Restoring orginal file path
aFilePath.Delete( 0, driveSelector.Length() );
}//if(drivesList[driveint])
// Select next drive
//.........这里部分代码省略.........