本文整理汇总了C++中TName::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ TName::Format方法的具体用法?C++ TName::Format怎么用?C++ TName::Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TName
的用法示例。
在下文中一共展示了TName::Format方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TESTL
/**
* Load network iformation (hosts names) from ini file.
*
* @param aNetworkInfo ref. to the TNetworkInfo structure, which will be populated
*/
void CTestStepLLMNR_Init::LoadNetworkConfigFromIniL(TNetworkInfo& aNetworkInfo)
{
TName tmpBuf;
TInt nRes;
//-- get number of hosts which are supposed to be running
//-- there should be at last 2 host names in the list
TESTL(GetIntFromConfig(KNodesSection, _L("NumNodes"), nRes) && nRes >= KMinNodes);
const TInt numNodes = nRes;
//-- get maximal number of trials of host hame resolution
TESTL(GetIntFromConfig(KNodesSection, _L("ConnectTrials"), nRes) && nRes >= 1);
const TInt maxTrials = nRes;
//-- populate NetworkInfo array with information from ini file.
TNodeInfo nodeInfo;
for(TInt i=0; i<numNodes; ++i)
{
//-- get host name from ini file
tmpBuf.Format(_L("HostName%d"),i+1);
if(!GetIniFileString(KNodesSection, tmpBuf, nodeInfo.iHostName))
continue;
//-- put host info to the array
nodeInfo.iCntTrials = maxTrials;
aNetworkInfo.AppendNode(nodeInfo);
}
//-- check number of hosts to communicate with.
TESTL(aNetworkInfo.NodesCount() >= KMinNodes);
}
示例2: SelectedL
void CTestList::SelectedL(TInt aIndex)
{
#if USE_PROCESS
TThreadParams params;
params.iIndex=aIndex;
TName name;
name.Format(_L("TimeTest-%x"),iCount++);
params.iGroupId=Client()->iGroup->GroupWin()->Identifier();
User::LeaveIfError(iTimeTest.Create(name,TimeThread,KDefaultStackSize*2,KHeapSize,KHeapSize,¶ms,EOwnerThread));
TRequestStatus status;
iTimeTest.Logon(status);
__PROFILE_RESET(8);
iTimeTest.Resume();
User::WaitForRequest(status);
#else
TThreadParams params;
params.iIndex=aIndex;
TimeThread(¶ms);
#endif
TBuf<64> buf;
TBuf<64> buf2;
TBuf<64> buf3;
CResultDialog *dialog=new(ELeave) CResultDialog(Client()->iGroup, iGc);
dialog->ConstructLD();
#if USE_PROCESS
if (status.Int()==KErrNone)
{
#endif
#if !defined(__PROFILING__)
buf=_L("Profiling information not available");
#else
TProfile profile[6];
__PROFILE_DISPLAY(6);
for (TInt index=1; index<6; index++)
AppendProfileNum(buf2,profile[index].iTime);
for (TInt index2=1; index2<6; index2++)
AppendProfileCount(buf3,profile[index2].iCount);
buf.Format(_L("Time=%d.%2d"),profile[0].iTime/1000000,(profile[0].iTime%1000000)/10000);
#endif
dialog->SetTitle(buf);
#if USE_PROCESS
}
else
{
dialog->SetTitle(_L("Error in test"));
buf.Format(_L("Error=%d"),status.Int());
buf2=iTimeTest.ExitCategory();
}
#endif
dialog->SetLine1(buf2);
dialog->SetLine2(buf3);
dialog->SetNumButtons(1);
dialog->SetButtonText(0,_L("Okay"));
if (dialog->Display()!=0)
Panic(0);
}
示例3: ConstructServerName
// ---------------------------------------------------------------------------
// Creates server name
// ---------------------------------------------------------------------------
//
EXPORT_C void RAlfClientBase::ConstructServerName( TName& aServerName,
TUid aAppServerUid,
TUint aServerDifferentiator )
{
_LIT(KServerNameFormat, "%08x_%08x_AppServer");
aServerName.Format(
KServerNameFormat,
aServerDifferentiator,
aAppServerUid.iUid );
}
示例4: ContentionTestL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1191
@SYMTestCaseDesc Lock out of dictionary files test
@SYMTestPriority High
@SYMTestActions Attempt for opening of same dictionary file.Tests for file in use error
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void ContentionTestL()
{
test.Start(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1191 Contention tests "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse testIniFile;
testIniFile.Set(drive.Name(), &KTestIniFile, NULL);
CDictionaryStore* dict=CDictionaryFileStore::OpenLC(TheFs,testIniFile.FullName(),KTestUid);
TIniData data;
data.SaveL(*dict);
CleanupStack::PopAndDestroy(); // dict
test.Next(_L("Lock-out test"));
CDictionaryFileStore::OpenLC(TheFs,testIniFile.FullName(),KTestUid);
TUint tick=User::TickCount();
TRAPD(r,CDictionaryFileStore::OpenL(TheFs,testIniFile.FullName(),KTestUid));
tick=User::TickCount()-tick;
test (r==KErrInUse);
test.Printf(_L("Lock-out discovered: %d ticks\r\n"),tick);
CleanupStack::PopAndDestroy();
test.Next(_L("Creating threads"));
RThread threads[KNumThreads];
TRequestStatus status[KNumThreads];
TInt ii;
for (ii=0;ii<KNumThreads;++ii)
{
TName name;
name.Format(_L("Test_%d"),ii);
test (threads[ii].Create(name,ThreadTest,KThreadStack,KThreadHeap,KThreadHeapMax,(TAny*)ii,EOwnerThread)==KErrNone);
threads[ii].SetPriority(EPriorityLess);
threads[ii].Logon(status[ii]);
test (status[ii]==KRequestPending);
}
for (ii=0;ii<KNumThreads;++ii)
threads[ii].Resume();
test.Next(_L("Waiting for completion"));
for (ii=0;ii<KNumThreads;++ii)
User::WaitForAnyRequest();
TInt success=0;
for (ii=0;ii<KNumThreads;++ii)
{
test (status[ii]!=KRequestPending);
if (status[ii].Int()==KErrNone)
++success;
}
test.Printf(_L("Thread success: %d of %d\r\n"),success,KNumThreads);
test.End();
}
示例5: ListInterfacesL
/**
* List existing network interfaces, IP addresses bound to them
* and fill up array of IP addresses for all interfaces.
*/
void CTestStepLLMNR_Init::ListInterfacesL()
{
RSocket socket;
TInt nRes;
TInt exceed;
TInt idx;
TName tmpBuf;
TName tmpBuf1;
nRes = socket.Open(ipTestServer->iSocketServer, KAfInet, KSockStream, KProtocolInetTcp);
TESTL(nRes == KErrNone);
TUint bufsize = 2048;
HBufC8 *buffer =NULL;
buffer = GetBuffer(buffer, bufsize);
TESTL(buffer != NULL);
TPtr8 bufdes = buffer->Des();
//-- reset array of local addresses
ipTestServer->iLocalAddrs.Reset();
//-- list all available network interfaces
INFO_PRINTF1(KNewLine);
INFO_PRINTF1(_L("--- available network interfaces:"));
do
{//-- get list of network interfaces
// if exceed>0, all interface could not fit into the buffer.
// In that case allocate a bigger buffer and retry.
// There should be no reason for this while loop to take more than 2 rounds.
bufdes.Set(buffer->Des());
exceed = socket.GetOpt(KSoInetInterfaceInfo, KSolInetIfQuery, bufdes);
if(exceed > 0)
{
bufsize += exceed * sizeof(TInetInterfaceInfo);
buffer = GetBuffer(buffer, bufsize);
TESTL(buffer != NULL);
}
} while (exceed > 0);
if (exceed < 0)
{
INFO_PRINTF1(_L("socket.GetOpt() error!"));
TESTL(EFalse);
}
TOverlayArray<TInetInterfaceInfo> infoIface(bufdes);
for(idx=0; idx < infoIface.Length(); ++idx)
{
TInetInterfaceInfo& iface = infoIface[idx];
tmpBuf.Format(_L("index:%d, name: "),iface.iIndex);
tmpBuf.Append(iface.iName );
tmpBuf.AppendFormat(_L(" state:%d"), iface.iState);
INFO_PRINTF1(tmpBuf);
}
//-- list all IP addresses, bound to the interfaces
//-- and append this address to the array of host-local addresses
INFO_PRINTF1(KNewLine);
INFO_PRINTF1(_L("--- IP addresses bound to the interfaces:"));
do
{
// if exceed>0, all interface could not fit into the buffer.
// In that case allocate a bigger buffer and retry.
// There should be no reason for this while loop to take more than 2 rounds.
bufdes.Set(buffer->Des());
exceed = socket.GetOpt(KSoInetAddressInfo, KSolInetIfQuery, bufdes);
if(exceed > 0)
{
bufsize += exceed * sizeof(TInetAddressInfo);
buffer = GetBuffer(buffer, bufsize);
}
} while (exceed > 0);
if (exceed < 0)
{
INFO_PRINTF1(_L("socket.GetOpt() error!"));
TESTL(EFalse);
}
//-- print out IP addresses
TOverlayArray<TInetAddressInfo> infoAddr(bufdes);
TInetAddr inetAddr;
for(idx=0; idx < infoAddr.Length(); ++idx)
{
TInetAddressInfo& addr = infoAddr[idx];
tmpBuf.Format(_L("iface index: %d, scopeID: %d, state: %d, IP addr: "), addr.iInterface, addr.iScopeId, addr.iState);
//.........这里部分代码省略.........
示例6: doTestStepPreambleL
TVerdict CUpsClientStep::doTestStepPreambleL()
/**
* @return - TVerdict code
* Override of base class virtual
*/
{
__UHEAP_MARK;
// Read values to config servers from INI file. (ARRAY of values)
// Read how many times the test step needs to be repeated.
TName fStepRepeat(_L("StepRepeat"));
TInt repeats;
if(GetIntFromConfig(ConfigSection(),fStepRepeat,repeats))
{
iStepRepeat=repeats;
}
else
{
iStepRepeat=1;
}
// Read values for test sequence from INI file. (ARRAY of values)
TInt index=0;
TName fUseServiceUID;
fUseServiceUID.Format(_L("UseServiceUID_%d"),index);
TName fUseServerName;
fUseServerName.Format(_L("UseServerName_%d"),index);
TName fDestination;
fDestination.Format(_L("Destination_%d"),index);
TName fExpectedError;
fExpectedError.Format(_L("ExpectedError_%d"),index);
TName fUseOpaqueData;
fUseOpaqueData.Format(_L("UseOpaqueData_%d"),index);
TName fSelectDialogOption;
fSelectDialogOption.Format(_L("SelectDialogOption_%d"),index);
TName fButtonsDisplayed;
fButtonsDisplayed.Format(_L("ButtonsDisplayed_%d"),index);
TName fDialogCreatorInvoked;
fDialogCreatorInvoked.Format(_L("DialogCreatorInvoked_%d"),index);
TName fPolicyEvaluatorInvoked;
fPolicyEvaluatorInvoked.Format(_L("PolicyEvaluatorInvoked_%d"),index);
TName fAccessGranted;
fAccessGranted.Format(_L("AccessGranted_%d"), index);
TName fCloseSession;
fCloseSession.Format(_L("CloseSession_%d"), index);
TName fHoldEvaluatorOpen;
fHoldEvaluatorOpen.Format(_L("HoldEvaluatorOpen_%d"), index);
TName fHoldPrepareDialogOpen;
fHoldPrepareDialogOpen.Format(_L("HoldPrepareDialogOpen_%d"), index);
TName fHoldDisplayDialogOpen;
fHoldDisplayDialogOpen.Format(_L("HoldDisplayDialogOpen_%d"), index);
TName fRequestDurationThreshold;
fRequestDurationThreshold.Format(_L("RequestDurationThreshold_%d"), index);
TName fLeaveDialog;
fLeaveDialog.Format(_L("LeaveDialog_%d"), index);
TName fLeaveEvaluator;
fLeaveEvaluator.Format(_L("LeaveEvaluator_%d"), index);
TName fCancelUpsRequest;
fCancelUpsRequest.Format(_L("CancelUpsRequest_%d"), index);
TName fPlatSecPass;
fPlatSecPass.Format(_L("PlatSecPass_%d"), index);
TName fForcePrompt;
fForcePrompt.Format(_L("ForcePrompt_%d"), index);
TName fExpectedEvaInfo;
fExpectedEvaInfo.Format(_L("ExpectedEvaluatorInfo_%d"), index);
TName fSelectFingerprint;
fSelectFingerprint.Format(_L("SelectFingerprint_%d"), index);
TName fWaitUntilFileAppears;
fWaitUntilFileAppears.Format(_L("WaitUntilFileAppears_%d"), index);
TInt useServiceUID;
TPtrC useServerName;
TPtrC destination;
TInt expectedError;
TPtrC useOpaqueData;
TPtrC selectDialogOption;
TInt buttonsDisplayed;
TInt dialogCreatorInvoked;
TInt policyEvaluatorInvoked;
TPtrC accessGranted;
TBool closeSession;
TBool holdEvaluatorOpen;
TBool holdPrepareDialogOpen;
TBool holdDisplayDialogOpen;
TInt requestDurationThreshold;
TBool leaveDialog;
TBool leaveEvaluator;
TBool cancelUpsRequest;
TBool platSecPass;
TBool forcePrompt;
TInt expectedEvaInfo;
TInt selectFingerprint;
TPtrC waitUntilFileAppears;
while (GetHexFromConfig(ConfigSection(), fUseServiceUID,useServiceUID)
&& GetStringFromConfig(ConfigSection(),fUseServerName,useServerName)
&& GetStringFromConfig(ConfigSection(),fDestination,destination)
//.........这里部分代码省略.........
示例7: ConstructL
/**
Second phase constructor
@internalComponent
*/
void CVideoRenderer::ConstructL()
{
User::LeaveIfError(iSurfaceManager.Open());
User::LeaveIfError(iWsSession.Connect());
CResourceFileReader* reader = CResourceFileReader::NewLC(KResourceFileName);
reader->ReadSupportedFormatL(iSupportedFormat);
if (iTimed)
{
// Create a high priority thread for timed mode
// get timer info for timed mode
TInt64 defaultDelay;
TInt64 maxDelay;
reader->ReadTimerInfoL(defaultDelay, maxDelay);
//Get a reference to this thread's heap
RHeap& thisHeap = User::Heap();
//Parameters to send to the sub thread
TThreadRelayParam param;
param.iObserver = &iObserver;
param.iThreadRelay = &iRendererRelay; // return pointer to allow direct calls
//Get the id of this thread
RThread thisThread;
TThreadId thisThreadId = thisThread.Id();
param.iMainThreadId = thisThreadId;
//Get a request to signal for setup completion
TRequestStatus setupComplete = KRequestPending;
param.iSetupComplete = &setupComplete;
//current time and the "this" pointer for a unique key
_LIT(KFormatString,"%S.%020Lu.%08X");
TName threadName;
TTime now;
now.UniversalTime();
threadName.Format(KFormatString, &KVideoRendererThreadName, now.Int64(), reinterpret_cast<TUint>(this));
//Create a new thread using the same heap as this thread
TInt result = iRendererThread.Create(threadName,
ThreadCreateFunction,
KSubThreadStackSize,
&thisHeap,
¶m);
User::LeaveIfError(result);
//Run the thread under high priority
iRendererThread.SetPriority(KSubThreadPriority);
//Wait for thread startup to complete
TRequestStatus threadStatus = KRequestPending;
iRendererThread.Logon(threadStatus);
//Start the thread
iRendererThread.Resume();
User::WaitForRequest(threadStatus, setupComplete);
if(threadStatus != KRequestPending)
{
//Thread creation failed
TInt reason = iRendererThread.ExitReason();
DEBUGPRINT3(_L("Renderer thread died with type=%d, reason=%d"), iRendererThread.ExitType(), reason);
User::Leave(reason);
}
// Thread creation was successfull
TInt error = iRendererThread.LogonCancel(threadStatus);
User::LeaveIfError(error); // There is no outstanding request
User::WaitForRequest(threadStatus); // Consume the signal
__ASSERT_DEBUG(iRendererRelay != NULL, User::Panic(_L("CVR::ConstructL"), KErrCorrupt));
iRendererRelay->SetRendererThread(&iRendererThread);
iRendererRelay->SetTimerInfo(defaultDelay, maxDelay);
iThreadCreated = ETrue;
User::LeaveIfError(setupComplete.Int());
//Create a listener that will monitor the thread
iRendererThreadUndertaker = CThreadUndertaker::NewL(iRendererThread);
}
else
{
iRendererRelay = CRendererRelay::NewL(iObserver);
}
CleanupStack::PopAndDestroy(reader);
}
示例8: doTestStepPreambleL
TVerdict CUPSDbManagementStep::doTestStepPreambleL()
/**
* @return - TVerdict code
* Override of base class virtual
*/
{
__UHEAP_MARK;
INFO_PRINTF2(_L("START CELLS: %d"), User::CountAllocCells());
// reads client name and SID
TParse clientFullName;
RThread client;
clientFullName.Set(client.FullName(),NULL, NULL);
iTEFServerName=clientFullName.Name();
iExpectedClientSid = client.SecureId() ;
client.Close();
// Read how many times the test step needs to be repeated.
TName fStepRepeat(_L("StepRepeat"));
TInt repeats;
if(GetIntFromConfig(ConfigSection(),fStepRepeat,repeats))
{
iStepRepeat=repeats;
}
else
{
iStepRepeat=1;
}
// Read values for test sequence from INI file. (ARRAY of values)
TInt index=0;
TName fOperation;
fOperation.Format(_L("Operation_%d"), index);
TName fClientSid;
fClientSid.Format(_L("ClientSid_%d"),index);
TName fEvaluatorId;
fEvaluatorId.Format(_L("EvaluatorId_%d"),index);
TName fServiceId;
fServiceId.Format(_L("ServiceId_%d"),index);
TName fServerSid;
fServerSid.Format(_L("ServerSid_%d"),index);
TName fFingerprint;
fFingerprint.Format(_L("Fingerprint_%d"),index);
TName fClientEntity;
fClientEntity.Format(_L("ClientEntity_%d"),index);
TName fDescription;
fDescription.Format(_L("Description_%d"),index);
TName fDecisionResult;
fDecisionResult.Format(_L("DecisionResult_%d"),index);
TName fMajorPolicyVersion;
fMajorPolicyVersion.Format(_L("MajorPolicyVersion_%d"),index);
TName fRecordId;
fRecordId.Format(_L("RecordId_%d"),index);
TName fEvaluatorInfo;
fEvaluatorInfo.Format(_L("EvaluatorInfo_%d"),index);
TName fExpectedDecisionCount;
fExpectedDecisionCount.Format(_L("ExpectedDecisionCount_%d"),index);
TPtrC operation;
TInt clientSid;
TInt evaluatorId;
TInt serviceId;
TInt serverSid;
TPtrC fingerprint;
TPtrC clientEntity;
TPtrC description;
TPtrC decisionResult;
TInt majorPolicyVersion;
TInt recordId;
TInt evaluatorInfo;
TInt expectedDecisionCount;
while (GetStringFromConfig(ConfigSection(),fOperation,operation))
{
// Create an instance of a new request
CUpsDbRequest* newRequest = CUpsDbRequest::NewL();
CleanupStack::PushL(newRequest);
// Set the operation to be performed
newRequest->iOperation = operation;
if(GetHexFromConfig(ConfigSection(),fClientSid,clientSid))
{
newRequest->iClientSid = clientSid;
newRequest->iDecisionFilter->SetClientSid(TSecureId(clientSid),EEqual);
}
if(GetHexFromConfig(ConfigSection(),fEvaluatorId,evaluatorId))
{
newRequest->iEvaluatorId = evaluatorId;
newRequest->iDecisionFilter->SetEvaluatorId(TUid::Uid(evaluatorId),EEqual);
}
if(GetHexFromConfig(ConfigSection(),fServiceId,serviceId))
{
newRequest->iServiceId = serviceId;
newRequest->iDecisionFilter->SetServiceId(TUid::Uid(serviceId),EEqual);
//.........这里部分代码省略.........
示例9: DoTests
LOCAL_C void DoTests()
//
// multiple threads
//
{
TInt r=KErrNone;
test.Next(_L("Start continuous file Write/Read/Verify operation"));
RThread t[KMaxNumberThreads];
TRequestStatus tStat[KMaxNumberThreads];
TInt i=0;
TName threadName;
TRequestStatus kStat=KRequestPending;
test.Console()->Read(kStat);
for (i=0;i<KMaxNumberThreads;i++)
{
ThreadTestInfo[i].iCycles=0;
ThreadTestInfo[i].iErrors=0;
ThreadTestInfo[i].iSizeArrayPos=(i%KMaxSizeArray);
ThreadTestInfo[i].iErrorInfo=0;
if (i<(KMaxNumberThreads-1))
{
threadName.Format(_L("MakeAndDeleteFiles%d"),i);
r=t[i].Create(threadName,MakeAndDeleteFilesThread,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)i);
}
else
{
// Last thread fills/empties disk
threadName.Format(_L("FillAndEmptyDisk%d"),i);
r=t[i].Create(threadName,FillAndEmptyDiskThread,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)i);
}
if (r!=KErrNone)
test.Printf(_L("Error(%d) creating thread(%d)\r\n"),r,i);
test(r==KErrNone);
t[i].Logon(tStat[i]);
t[i].Resume();
}
CurrentlyFillingDisk=ETrue;
FillDiskCount=0;
TInt totalTime = 0;
TTime cycleTime;
TTime startTime;
TTime time;
startTime.UniversalTime();
cycleTime.UniversalTime();
TVolumeInfo v;
r=TheFs.Volume(v,gDriveNumber);
test(r==KErrNone);
// TInt initialFreeSpace = I64LOW(v.iFree / 1024);
#ifdef __LIMIT_EXECUTION_TIME__
RTimer timer;
timer.CreateLocal();
TRequestStatus reqStat;
timer.After(reqStat,60000000); // After 60 secs
#endif
#ifdef REUSE_THREAD
RTimer displayTimer;
displayTimer.CreateLocal();
TRequestStatus displayStat;
displayTimer.After(displayStat, KNotificationInterval); // after 10 secs
#endif
TInt ypos=test.Console()->WhereY();
FOREVER
{
User::WaitForAnyRequest();
if (kStat!=KRequestPending)
{
// user requested to end - let threads die
#ifdef REUSE_THREAD
gRequestEnd = ETrue;
#endif
for (i=0;i<KMaxNumberThreads;i++)
{
User::WaitForRequest(tStat[i]);
}
break;
}
#ifdef __LIMIT_EXECUTION_TIME__
else if (reqStat != KRequestPending)
{
// max execution exceeded - wait for threads to die
TInt totalCycles = 0;
for (i=0;i<KMaxNumberThreads;i++)
{
totalCycles+= ThreadTestInfo[i].iCycles;
}
test.Printf(_L("Total cycles = %d\r\n"), totalCycles);
test.Printf(_L("Waiting for thread death...\r\n"));
for (i=0;i<KMaxNumberThreads;i++)
{
User::WaitForRequest(tStat[i]);
}
break;
//.........这里部分代码省略.........