本文整理汇总了C++中TBuf8::Insert方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::Insert方法的具体用法?C++ TBuf8::Insert怎么用?C++ TBuf8::Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::Insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Next
void RLog::Next(const TDesC &aHeading)
{
// Logs in the file and calls the "Next" function from RTest
TBuf8 <256> Buffer;
TBuf8 <1024> pHeading;
pHeading.Copy(aHeading);
if(aHeading.Length()){
Buffer.Copy(aHeading);
if(pHeading.Mid(pHeading.Length() - 1, 1) == _L8("\n")){
Buffer.Insert(pHeading.Length() - 1, _L8("\r"));
}
else
{
Buffer.Append(_L("\r\n"));
}
file.Write(Buffer);
}
test->Next(aHeading);
}
示例2: GetGroup
//------------------------------------------------------------------------------
// CAddBuffer::AddNodeToBuffer()
//------------------------------------------------------------------------------
TInt CAddBuffer::GetGroup( const TDesC8& aRoot, RPointerArray<CConnMoNodeElement>* aGroup )
{
OstTraceExt1( TRACE_NORMAL, CADDBUFFER_GETGROUP_ENTRY, "ENTRY: CAddBuffer::GetGroup;aRoot=%s", aRoot );
iCache.Reset();
TInt retval( KErrNotFound );
TBool first = ETrue;
TBuf8<KSmlMaxURISegLen> groupTag;
groupTag.Copy( aRoot );
groupTag.Append( KChildNodeWildCardPattern );
for ( TInt i = 0; i < iBuffer.Count(); ++i )
{
if ( iBuffer[i]->iUri.Match( groupTag ) != KErrNotFound
&& !iBuffer[i]->iProcessed )
{
if ( first )
{
groupTag.Insert( aRoot.Length(), KNodeSeparator );
groupTag.Insert( aRoot.Length() + 1, CUtils::GetSecondURISeg( iBuffer[i]->iUri ) );
first = EFalse;
retval = 0;
}
TInt err = KErrNone;
TRAP(err,aGroup->AppendL(iBuffer[i]));
if(err != KErrNone)
{
retval = err;
break;
}
TRAP(err,iCache.AppendL(iBuffer[i]));
if(err != KErrNone)
{
TInt indx = aGroup->Find(iBuffer[i]);
if(indx != KErrNotFound)
aGroup->Remove(indx);
retval = err;
break;
}
retval++;
}
}
OstTrace1( TRACE_NORMAL, CADDBUFFER_GETGROUP_EXIT, "EXIT: CAddBuffer::GetGroup;retval=%d", retval );
return retval;
}
示例3: CheckSubjectNameSyntaxL
//.........这里部分代码省略.........
{
equalSignArr->AppendL(i);
equalArrItemCount++;
}
if ( aSubj.Mid(i, 1)== KCommaSign )
{
commaSignArr->AppendL(i);
commaArrItemCount++;
}
}
CleanupStack::PushL(updateArr);
TInt i=0;
TInt j=0;
// At least one comma required. Otherwise there is no chance for extra commas
if ( commaArrItemCount )
{
while ( i< equalArrItemCount )
{
//advance starting position for every iteration
TInt eqSignStartIndex=i;
TInt cmCount=0;
//check wether there is more than one comma between two adjacent fields.
while ( commaSignArr->At(j)< equalSignArr->At(eqSignStartIndex) )
{
cmCount++;
j++;
if ( j==commaArrItemCount )
break;
}
//at least one extra comma character found. Mark positions for mofifications.
if (cmCount>1)
{
TInt equalPos=equalSignArr->At(eqSignStartIndex-1) + 1;
updateArr->AppendL(equalPos);
TInt commaPos=commaSignArr->At(j-1);
updateArr->AppendL(commaPos);
updateArrCount++;
updateArrCount++;
}
i++;
}
}
//Checking also last attribute of Subject Name string
if ( j<commaArrItemCount )
{
updateArr->AppendL(equalSignArr->At(equalArrItemCount-1) + 1);
updateArr->AppendL(subjLth);
updateArrCount++;
updateArrCount++;
}
TBuf8<256> resultBuf;
resultBuf.Copy(aSubj);
i=0;
//update subjectname acoording to updateArr array.
if ( updateArr->Count()>0 )
{
while (i<updateArrCount)
{
if ( resultBuf.Length()<256 )
resultBuf.Insert(updateArr->At(i) + i, KReplacementChar);
else
User::Leave(KErrNotSupported);
i++;
}
}
CleanupStack::Pop(updateArr);
CleanupStack::Pop(commaSignArr);
CleanupStack::Pop(equalSignArr);
delete equalSignArr;
equalSignArr=NULL;
delete commaSignArr;
commaSignArr=NULL;
delete updateArr;
updateArr=NULL;
HBufC8* resultHeap = resultBuf.AllocL();
return resultHeap;
}
示例4: ReadFromFile
// ----------------------------------------------------------------------------------------
// CFMSServer::ReadFromFile()
// ----------------------------------------------------------------------------------------
TBool CFMSServer::ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize
, TInt& aWcdmaBearer )
{
TInt err = iFile.Open(iFs,KFotaInterruptFileName,EFileRead);
FLOG(_L("CFMSServer::ReadFromFile() error as %d"),err);
if(err == KErrNone)
{
TInt size = KErrNone;
err = iFile.Size(size);
if(size == 0) //file empty
{
FLOG(_L("CFMSServer::ReadFromFile() file size is empty"));
iFile.Close();
return EFalse;
}
TBuf8<30> data;
iFile.Read(data);
iFile.Close();
TBuf8<30> data1;
if(data.Length()>0)
{
TInt len =0 ;
if((len=data.LocateF(',')) > 0)
{
TLex8 value( data.Left(len));
value.Val(aReason);
FLOG(_L("CFMSServer::ReadFromFile() retrieving reason as %d"),aReason);
data1.Insert(0,data.Right(data.Length()-(len+1)));
data.Zero();
// len=data1.LocateF(',');
if( data1.Length() > 0 && (len=data1.LocateF(',')) > 0)
{
value=data1.Left(len);
value.Val(aBearer);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aBearer as %d"),aBearer);
data.Insert(0,data1.Right(data1.Length()-(len+1)));
data1.Zero();
// len=data.LocateF(',');
if(data.Length() > 0 && ( len=data.LocateF(','))> 0)
{
value=data.Left(len);
value.Val(aDrive);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aDrive as %d"),aDrive);
data1.Insert(0,data.Right(data.Length()-(len+1)));
data.Zero();
if(data1.Length() > 0 && ( len=data1.LocateF(','))> 0 )
{
value=data1.Left(len);
value.Val(aSize);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aSize as %d"),aSize);
data.Insert(0,data1.Right(data1.Length()-len-1));
data1.Zero();
if(data.Length() > 0 )
{
value=data;
value.Val(aWcdmaBearer);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aWcdmaBearer as %d"),aWcdmaBearer);
}
}
}
}
}
}
}
else
{
return EFalse;
}
return ETrue;
}