本文整理汇总了C++中TBuf::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf::Append方法的具体用法?C++ TBuf::Append怎么用?C++ TBuf::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf
的用法示例。
在下文中一共展示了TBuf::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoStoreConfigL
void CMsvIndexContext::DoStoreConfigL()
{
// we only want to store the config file if it has changed,
// we also don't care about UniqueIDs for the internal drive
if(iConfig.iDebug!=iConfig.iDebugAsLoaded ||
iConfig.iDrive!=iConfig.iDriveAsLoaded ||
(iConfig.iDrive!=iServer.FileSession().GetSystemDrive() && iConfig.iUniqueID!=iConfig.iUniqueIDAsLoaded))
{
TChar driveChar= iServer.FileSession().GetSystemDriveChar();
TBuf<2> systemDrive;
systemDrive.Append(driveChar);
systemDrive.Append(KDriveDelimiter);
TPath pathName(systemDrive);
pathName.Append(KServerINIFile);
CDictionaryFileStore *store=CDictionaryFileStore::OpenLC(iServer.FileSession(),pathName,KNullUid);
RDictionaryWriteStream stream;
stream.AssignLC(*store, KUidMsvMessageDriveStream);
stream.WriteUint8L(KMsvMessageDriveStreamVersionNumber); // version number
stream << iConfig.iDrive.Name();
stream.WriteUint32L(iConfig.iUniqueID);
stream.WriteInt8L(iConfig.iDebug);
stream.CommitL();
store->CommitL();
CleanupStack::PopAndDestroy(2,store); // stream, store
}
}
示例2: Defect_DEF074278_Part2
//DEF074278: Java VM requires more command line testArguments.
void Defect_DEF074278_Part2()
{
TBuf<180> testArguments(_L("one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four "));
TBuf<210> inputArguments;
TUint testArgNo = 25;
int argc=0;
char** argv=0;
char** envp=0;
TheTest.Printf(_L("Retrieving the arguments passed in from T_UCRT0P1\n"));
__crt0(argc,argv,envp); // get args & environment from somewhere
//Get all the arguments into a descriptor, beginning at pos 1, as pos 0 contains
//the T_UCRT0P2 exe path and name.
for (TInt i=1; i < argc; i++)
{
char *str=argv[i];
while(*str)
inputArguments.Append((TChar)*str++);
inputArguments.Append(' ');
}
//tests all the arguments were passed to the new process correctly.
TheTest.Printf(_L("Checking all arguements were passed to the new process correctly... "));
TEST(testArguments == inputArguments );
TEST2(testArgNo, argc);
exit(0);
}
示例3: HandleResponseEvent
//////////////////////////////////////////////////////////////////////////
//From MHandleEventObserver
//////////////////////////////////////////////////////////////////////////
void CSearchLocalResultView::HandleResponseEvent(TInt aEvent,TInt aType)
{
if(aEvent==EHttpNoError)
{
this->iSearchList->SetEdwinVisible(ETrue);
iSearchList->InitListBox();
RemoveAndDeleteControl(iDialog);
if(iLocalSearch->GetCount()==0)
{
this->InitDialog(iMainEngine.GetDesById(ETurkeyTextRes_ListNull));
}
else
{
iSearchList->SetEdwinVisible(EFalse);
for(TInt i=0;i<iLocalSearch->GetCount();i++)
{
const CFbsBitmap* icon = NULL;
const CFbsBitmap* iconMask = NULL;
icon = iMainEngine.GetBitmapFactory().GetFileTypeIcon(GetCurType());
iconMask = iMainEngine.GetBitmapFactory().GetFileTypeIconMask(GetCurType());
iSearchList->AppendListItem(iLocalSearch->GetOneItemName(i),icon,iconMask);
}
TBuf<50> titleBuf;
titleBuf.Zero();
titleBuf.Append(*iTitle);
titleBuf.Append(_L("["));
titleBuf.AppendNum(iLocalSearch->GetCount());
titleBuf.Append(_L("]"));
iTitleBar->SetTextL(titleBuf);
iSearchList->ListBoxDraw();
}
}
}
示例4: DoTestL
/**
Begin the start-up test case. Opening the database is synchcronous as is the first
part of creating the remote view. The second part (where the view is populated
with contacts) is asynchronous and finishes when CStartUp::HandleContactViewEvent
is called. CStartUp::RunL then just cleans up once the test case is finished.
*/
void CStartUp::DoTestL(const TDesC& aDbName, TViewType aViewType, TInt& aNumMsToGet20ItemsFromView)
{
iViewType = aViewType;
iNumMsToGet20ItemsFromViewPtr = &aNumMsToGet20ItemsFromView;
_LIT(KRemoteContactViewText, "\n[Remote Contacts view]\n");
_LIT(KRemoteGroupViewText, "\n[Remote Groups view]\n");
TBuf<32> buf;
if (iViewType == ERemoteContactsView)
{
buf.Append(KRemoteContactViewText);
}
else
{
buf.Append(KRemoteGroupViewText);
}
iTest.Printf(buf);
// open database
OpenDatabaseL(aDbName);
// create view
CreateRemoteViewL();
CActiveScheduler::Start();
}
示例5: PrintHex
// -----------------------------------------------------------------------------
// COMASuplWapListener::PrintHex
//
// -----------------------------------------------------------------------------
//
void COMASuplWapListener::PrintHex(const TDesC8& aBuffer,TInt aLine)
{
TBuf<256> buffer;
TBuf<2> buff;
_LIT16(KFormat1,"%02x");
TInt len = aBuffer.Length();
//The buffer is usually larger than what can be logged in a single line in the log file. As such this should only attempt
// to log 27 hex blocks to each log line.
const TInt KNumberOfBlocks = 27;
TInt blockNumber = KNumberOfBlocks;
for(TInt i = 0 ; i <len; i++)
{
//Check to see if the buffer should be logged and then emptied
if(i == blockNumber)
{
//Trace the buffer as it currently is
iTrace->Trace(buffer, KTraceFileName, aLine);
//Reset the buffer for the next log line
buffer.Zero();
blockNumber += KNumberOfBlocks;
}
buff.Zero();
buff.Format(KFormat1,aBuffer[i]);
buffer.Append(buff);
buffer.Append(_L(" "));
}
iTrace->Trace(buffer, KTraceFileName, aLine);
}
示例6: RunTestL
void CPolicyTest::RunTestL(TRequestStatus& aStatus)
{
HBufC* hptr16;
hptr16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iNameInfo);
RDebug::Print(KFormat,hptr16);
delete hptr16;
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysDriveName (sysDrive.Name());
TBuf<128> passScriptFile (sysDriveName);
passScriptFile.Append(KPassScriptPath);
TBuf<128> failScriptFile (sysDriveName);
failScriptFile.Append(KFailScriptPath);
TPtrC script = (iTestState == ETestPass) ? passScriptFile : failScriptFile;
(iTestState == ETestPass) ? RDebug::RawPrint(KPassTestRunning) : RDebug::RawPrint(KFailTestRunning);
TBuf<128> logTmpFile (sysDriveName);
logTmpFile.Append(KLogTmpPath);
iFs.Delete(logTmpFile); // ignore errors
TBuf<128> commandLine;
commandLine.AppendFormat(_L("%S %S"), &script, &logTmpFile);
StartProcessL(iTestExeTmpNewPath, commandLine, aStatus);
}
示例7: Show
TInt CFileSelectDialog::Show()
{
_LOG(_L("CFileSelectDialog::Show()"));
TInt sel=0;
CDesCArray* itemList = new (ELeave) CDesCArrayFlat(3);
if (iCurrentPath.Compare(_L(""))!=0){if (iType==EFolder){iArray->InsertL(0,_L("Select folder"));}iArray->InsertL(0,_L("..."));}
_LOGDATA(_L("Length of array: %d"),iArray->Count());
for (TInt i=0;i<iArray->Count();i++)
{
TBuf<255> ItemTxt;
ItemTxt.Copy(_L("0\t"));
ItemTxt.Append(iArray->MdcaPoint(i));
ItemTxt.Append(_L("\t\t"));
itemList->AppendL(ItemTxt);
_LOGDATA(_L("Item: %S"),&iArray->MdcaPoint(i));
}
_LOG(_L("Will create dialog"));
SetItemTextArray(itemList);
ListBox()->HandleItemAdditionL();
Layout();
ListBox()->SetCurrentItemIndex(0);
ListBox()->DrawNow();
DrawDeferred();
}
示例8: Draw
void CTestViewControl::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetBrushColor(KRgbDitheredLightGray);
gc.DrawRect(Rect());
gc.UseFont(iEikonEnv->TitleFont());
TInt yPos = KYStart;
TInt xPos = KXStart;
gc.DrawText(APP_TEXT,TPoint(xPos,yPos));
yPos+=30;
TBuf<256> viewNameBuf;
viewNameBuf.Append(_L("View "));
TBuf<16> numBuf;
numBuf.Num((TInt)iViewId.iViewUid.iUid);
viewNameBuf.Append(numBuf);
gc.DrawText(viewNameBuf,TPoint(xPos,yPos));
}
示例9: AppendListItemL
// ---------------------------------------------------------------------------
// CGSSensorPluginContainer::AppendListItem
// ---------------------------------------------------------------------------
//
void CGSSensorPluginContainer::AppendListItemL(
const TInt aPos,
const TDesC16& aFirstLabel,
const TDesC16& aSecondLabel )
{
TBuf<KGSBufSize128> itemText;
_LIT( KSpaceAndTab, " \t" );
_LIT( KTab, "\t" );
// The format is: " \tFirstLabel\tSecondLabel\t0\t0"
// First, append space and tab
itemText.Append( KSpaceAndTab );
itemText.Append( aFirstLabel );
itemText.Append( KTab );
itemText.Append( KTab );
// Currently this is used only to show sensors active status (on/off)
itemText.Append( aSecondLabel );
// No need to add last tabs
if ( ( KErrNotFound != aPos ) && ( aPos <= iListBoxTextArray->Count() ) )
{
iListBoxTextArray->InsertL( aPos, itemText );
}
else
{
iListBoxTextArray->AppendL( itemText );
}
}
示例10: Defect_DEF068052L
/**
@SYMTestCaseID SYSLIB-BAFL-CT-1390
@SYMTestCaseDesc Tests BaflUtils::PersistScreenCalibration
@SYMTestPriority Medium
@SYMTestActions Deletes screen calibration file, calls PersistScreenCalibration()
and checks that file now exists
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void Defect_DEF068052L()
{
TheTest.Next (_L (" @SYMTestCaseID:SYSLIB-BAFL-CT-1390 Defect_DEF068052L "));
__UHEAP_MARK;
User::LeaveIfError (TheFs.Connect ());
::CleanupClosePushL (TheFs);
const TInt KDriveLength = 2;
const TInt KScreenPathLength = 26;
const TInt KScreenPathLengthTemp = 30;
_LIT (KDriveColon, ":");
_LIT (KScreen, "\\System\\Data\\Screen.DAT");
_LIT (KScreenTemp, "\\System\\Data\\ScreenTemp.DAT");
// Find the system drive
TDriveNumber systemDrive = TheFs.GetSystemDrive();
// Set up a full file path name incorporating the system drive
// (for example if system drive is EDriveC pathname will be:
// C:\System\Data\Screen.DAT)
TBuf<KDriveLength+KScreenPathLength> screenFilePath;
screenFilePath.Append(systemDrive + 'A');
screenFilePath.Append(KDriveColon);
screenFilePath.Append(KScreen);
// Set up a full file path name to make a copy of the screen.dat
// file.
TBuf<KDriveLength+KScreenPathLengthTemp> screenFilePathTemp;
screenFilePathTemp.Append(systemDrive + 'A');
screenFilePathTemp.Append(KDriveColon);
screenFilePathTemp.Append(KScreenTemp);
// Make a copy of the screen.dat file (if it exists)
BaflUtils::CopyFile(TheFs, screenFilePath, screenFilePathTemp);
// Delete the Screen.DAT file (if it exists)
BaflUtils::DeleteFile(TheFs, screenFilePath);
// Saving Screen settings - call API to write the screen
// calibration to file
TDigitizerCalibration calib;
BaflUtils::PersistScreenCalibration(calib);
// Check if screen.dat file now exists
TBool exists = BaflUtils::FileExists(TheFs, screenFilePath);
TheTest(exists);
TheTest.Printf(_L("Screen settings were saved in %S\n"), &screenFilePath);
// Cleaning up, restore files to original state
User::LeaveIfError(BaflUtils::DeleteFile(TheFs, screenFilePath));
BaflUtils::CopyFile(TheFs, screenFilePathTemp, screenFilePath);
BaflUtils::DeleteFile(TheFs, screenFilePathTemp);
CleanupStack::PopAndDestroy (&::TheFs);
__UHEAP_MARKEND;
}
示例11: TestFontHugeCharacters
void CTestHarness::TestFontHugeCharacters(TTypefaceSupport& aSupport, TInt aPointSize, TBool aItalic)
{
TBuf<50> testInfo;
testInfo.Append(_L("Testing huge characters: "));
TBuf<10> num;
num.Num(aPointSize);
testInfo.Append(num);
iStep->INFO_PRINTF1(testInfo);
TFontSpec fs;
fs.iTypeface = aSupport.iTypeface;
fs.iHeight = aPointSize * 20;
if (aItalic)
fs.iFontStyle.SetPosture(EPostureItalic);
iTestFont = NULL;
TInt error = iDev->GetNearestFontToDesignHeightInTwips((CFont*&)iTestFont,fs);
if (error)
User::Panic(_L("Could not create font"),error);
if (!iTestFont->IsOpenFont())
{
iDev->ReleaseFont(iTestFont);
iTestFont = NULL;
return;
}
PrintMetrics();
DrawHugeCharacters();
iDev->ReleaseFont(iTestFont);
}
示例12: show_presence_details_current
void CContextbookContainer::show_presence_details_current()
{
CALLSTACKITEM(_L("CContextbookContainer::show_presence_details_current"));
TInt current_index = get_current_idx();
if (current_index < 0) return;
contact * c = book->GetContact(current_index);
if (c == NULL || c->presence == NULL) return;
TBuf<128> name;
if (c->last_name) name.Append(*(c->last_name));
if (c->last_name && c->last_name->Length()>0 && c->first_name && c->first_name->Length()>0) {
name.Append(_L(" "));
}
if (c->first_name) name.Append(*(c->first_name));
if (iLog) {
iLog->write_time();
iLog->write_to_output(_L("Checking presence details of "));
iLog->write_to_output(name);
iLog->write_nl();
}
((CContextbookAppUi *)(iEikonEnv->AppUi()))->DisplayPresenceDetailsL(name, (book->GetContact(current_index))->presence);
}
示例13: AppendL
void CWordStyleGallery::AppendL(TInt aIndex)
{
TBuf<100> name;
name = (*iStyleNameList)[aIndex];
//
// truncate name if necessary
CColumnListBoxData* columnData = ListBox()->ItemDrawer()->ColumnData();
TInt columnWidth = columnData->ColumnWidthPixel(0);
const CFont* columnFont = columnData->ColumnFont(0);
if (columnFont->TextWidthInPixels(name) > columnWidth)
TextUtils::ClipToFit(name, *columnFont, columnWidth);
//
TChar key = iData.iNormalStyleHotKey;
if (name != iNormalName)
{
CParagraphStyle* pp = iData.iStyleList.PtrByName(name)->iStyle;
TInt index = iData.iStyleList.IndexByPtr(pp);
key = iData.iHotKeyList[index];
}
if (key > 0)
{
name.Append(KColumnListSeparator);
name.Append(KColumnListSeparator); // one for empty spacer column
name.Append(iHotKey);
name.Append(key);
name.Append(KColumnListSeparator);
}
iStyleNameKeyList->AppendL(name);
}
示例14: StartAlarmAlertServer
void CTestCalInterimApiInstanceSuiteServer::StartAlarmAlertServer()
{
// Start the Alarm Server
TBuf<256> buffer;
buffer.Append('p');
buffer.Append('p');
buffer.Append(EKeyEscape);
RProcess alarmServer;
// Create the Connection to the alarm alert server
alarmServer.Create(KConsoleAlarmAlertServerImg, buffer, serverUid);
TRequestStatus stat;
alarmServer.Rendezvous(stat);
if (stat != KRequestPending)
{
alarmServer.Kill(0);
}
else
{
alarmServer.Resume();
}
User::WaitForRequest(stat);
TInt result = stat.Int();
if(result != KErrNone && result != KErrAlreadyExists)
{
User::LeaveIfError(result);
}
}
示例15: CopyToPublicL
TInt CopyDataFile::CopyToPublicL(TDesC& aFileName)
{
TInt ret=KErrNone;
RFs iRFs;
User::LeaveIfError(iRFs.Connect());
CFileMan* fileMan=CFileMan::NewL(iRFs);
//get the sid and convert it to hex
TSecureId sid = RProcess().SecureId();
TBuf<20> hex;
hex.Num(sid, EHex);
hex.Append(_L("\\"));
//generate the target path - C:\\ShellPublic\\$SID
TBuf<128> path(_L("C:\\ShellPub\\"));
path.Append(hex);
//create the target directory
TBuf<128> file (path);
ret=iRFs.MkDir(path);
if(ret==KErrNone || ret==KErrAlreadyExists)
{
//generate the absolute path of the target file
file.Append(aFileName);
//copy the file
ret=fileMan->Copy(aFileName, file);
}
iRFs.Close();
delete fileMan;
return ret;
}