本文整理汇总了C++中TName::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ TName::Copy方法的具体用法?C++ TName::Copy怎么用?C++ TName::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TName
的用法示例。
在下文中一共展示了TName::Copy方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetResolverConfig
TInt CTS_MultiHomingStep::GetResolverConfig(const TInt aIndex, TName &aHostName, TInt& aProtocol,
TBool& aExpectSuccess, TBool& aExpectTimeout, TBool& aExpectNotReady,
TBool& aExplicitResolve, TConnDetails **aConnDetails)
/**
* Gets resolver configuration from file, using defaults if necessary
* @param aIndex The index for the socket configkey
* @param aHostName The host to be resolved
* @param aProtocol The protocol to be used
* @param aExpectSuccess Flag indicating if name should be resolved ok
* @param aExpectTimeout Flag indicating if name resolution should timeout
* @param aConnDetails The connection for an explicit resolver
* @return System wide error code
*/
{
TInt err=KErrNone;
TName resolverName; // Create the Key for the config lookup
resolverName = KResolver;
resolverName.AppendNum(aIndex);
TPtrC ptrBuf;
err = GetStringFromConfig(resolverName, KDestName, ptrBuf);
if (!err)
{
LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile);
iTestStepResult= EInconclusive;
return KErrNotFound;
}
aHostName.Copy(ptrBuf.Ptr(), ptrBuf.Length());
aExpectSuccess = ETrue;
GetBoolFromConfig(resolverName, KExpectSuccess, aExpectSuccess);
aExpectTimeout = EFalse;
GetBoolFromConfig(resolverName, KExpectTimeout, aExpectTimeout);
aExpectNotReady = EFalse;
GetBoolFromConfig(resolverName, KExpectNoDnsServer, aExpectNotReady);
aExplicitResolve = EFalse;
GetBoolFromConfig(resolverName, KExplicitResolve, aExplicitResolve);
err = GetStringFromConfig(resolverName, KProtocol, ptrBuf);
if (err && (ptrBuf.Compare(KTcp)==0))
aProtocol = KProtocolInetTcp;
else
aProtocol = KProtocolInetUdp;
err = GetStringFromConfig(resolverName, KConnName, ptrBuf);
if (!err)
{
return KErrNotFound;
}
*aConnDetails = iOwnerSuite->GetTConnection(ptrBuf);
return KErrNone;
}
示例2: TestAction
void CListCertificates::TestAction()
{
TInt count = iCertInfos.Count();
if (count == iExpectedLabels.Count())
{
TInt i;
for (i = 0; i < count; i++)
{
TName expected;
TName retrieved;
expected.Copy(iExpectedLabels[i].iName.Ptr());
retrieved.Copy(iCertInfos[i]->Label());
if (expected.Compare(retrieved))
{
break;
}
// this fails the test if any of the certs are marked as not
// deletable
if (iCertInfos[i]->IsDeletable() != !iExpectedLabels[i].iReadOnly)
break;
}
if (i == count)
{
iResult = ETrue;
}
else
{
iResult = EFalse;
}
}
else
{
iResult = EFalse;
}
}
示例3: WaitForMsgComplete
/**
Wait for message completion by the helper process
@param aProcessLog if ETrue, log messages from the helper process will be logged by TEF
@return error code, result of the message processing.
*/
TInt CSyncMessageSender::WaitForMsgComplete(TBool aProcessLog/*=ETrue*/)
{
if( !aProcessLog )
{ //-- don't need to process messages from the helper process
User::WaitForRequest(iMsgRqStat);
return iMsgRqStat.Int();
}
//-- wait for message completion processing logs from the helper process
TName logBuf;
for(;;)
{
iLogMsgQueue.NotifyDataAvailable(iLogRqStat);
User::WaitForRequest(iMsgRqStat, iLogRqStat);
if(iLogRqStat.Int() == KRequestPending)
{ //-- iMsgRqStat has been completed, the pessage has been processed
//-- cancel waiting for the log messages.
iLogMsgQueue.CancelDataAvailable();
User::WaitForRequest(iLogRqStat);
break;
}
else
{ //-- log message has been posted to the queue, pull all log messages up and process them
TIPLogMsg logMsg;
TInt nRes;
for(;;)
{
nRes = iLogMsgQueue.Receive(logMsg);
if(nRes != KErrNone)
break;
if(ipLogger)
{ //-- logger is available, log the message.
logBuf.Copy(_L("\t~helper: "));
logBuf.Append(logMsg.iLogMsg);
ipLogger->Write(logBuf);
}
}//for(;;)
}
}//for(;;)
return iMsgRqStat.Int();
}
示例4: ParseAndSetItemValueL
void CTestConfig::ParseAndSetItemValueL(const TDesC8& aText, const TLex8& aInput, TInt aCurrentItemStart, CTestConfigItem*& arCurrentItem)
{
if (arCurrentItem)
{
delete arCurrentItem->iValue;
arCurrentItem->iValue = NULL;
TPtrC8 val(ParseValue(aText, aInput, aCurrentItemStart));
arCurrentItem->iValue = ReplaceLC(KScriptCRLF, KScriptLF, val);
arCurrentItem->iValue->Des().Trim();
CleanupStack::Pop(arCurrentItem->iValue);
if (arCurrentItem->Item().CompareF(KScriptDefaults) == 0)
{
TName filename;
filename.Copy(arCurrentItem->Value());
CopyInDefaultsL(arCurrentItem->iParent, filename);
}
}
arCurrentItem = NULL;
}
示例5: doTestStepL
TVerdict CTestStepLLMNR_Init::doTestStepL()
{
TInt cntNode, nRes;
TName tmpBuf;
TName tmpBuf1;
SetTestStepResult(EPass);
TESTL(GetIntFromConfig(KNodesSection, _L("StartUpDelay"), nRes) && nRes > 0);
const TInt startUpDelay = nRes*KOneSecond;
INFO_PRINTF1(KNewLine);
INFO_PRINTF1(_L("Initializing LLMNR test engine..."));
//-- wait some time for settling name conflict resolution within LLMNR mechanism
User::After(ipTestServer->RandomizeNum(startUpDelay, startUpDelay));
RIPAddrArray& localAddrs = ipTestServer->iLocalAddrs;
TNetworkInfo& networkInfo = ipTestServer->iNetworkInfo;
//-- reset network information and local IP addresses table
networkInfo.Reset();
localAddrs.Reset();
//--------------------------------------------
//-- load network configuration from ini file
LoadNetworkConfigFromIniL(networkInfo);
//-- start up network layer and LLMNR engine
TESTL(StartUpLLMNR());
//-- wait some time for settling name conflict resolution within LLMNR mechanism
User::After(ipTestServer->RandomizeNum(startUpDelay));
//-- list available network interfaces and their IP addresses
ListInterfacesL();
//-- try to resolve every host name and obtain its IP address
ProbeNodes(networkInfo);
//-----------------------------------------------------------
//-- print out alive hosts names, IP addresses, etc and check the number of hosts
INFO_PRINTF1(_L("--- available hosts list:\n"));
TInt foreignNodeCnt = 0; //-- number of foreign hosts (IP addresses that not ours)
TInt localNodeCnt = 0; //-- number of local IP addresses
for(cntNode=0; cntNode < networkInfo.NodesCount(); ++cntNode)
{
TNodeInfo& currNode = networkInfo[cntNode]; //-- current node info
if(currNode.iAlive)
{
//-- print host name and its IP address
tmpBuf.Copy(currNode.iHostName);
tmpBuf.Append(_L(" "));
currNode.iAddr.Output(tmpBuf1);
tmpBuf.Append(tmpBuf1);
//-- search IP address in the array of local host addresses.
//-- if found, mark the appropriate hostInfo element as having local address.
currNode.iLocal = (ipTestServer->iLocalAddrs.Find(currNode.iAddr, TIdentityRelation<TInetAddr>(IPAddrIsEqual)) != KErrNotFound);
if(currNode.iLocal)
{
tmpBuf.Append(_L(" [local address]"));
localNodeCnt++;
}
if(currNode.iIpUnique)
tmpBuf.Append(_L(" [U]"));
if(! currNode.iLocal && currNode.iIpUnique)
foreignNodeCnt++;
INFO_PRINTF1(tmpBuf);
}
}
INFO_PRINTF1(KNewLine);
//-- check the number of nodes with local IP addresses to ensure that test config are correct
if(localNodeCnt <1)
{
INFO_PRINTF1(_L("??? Error! No nodes found with local IP. Check the test configuration.\n"));
SetTestStepResult(EInconclusive);
return TestStepResult();
}
//-- we need at least 1 other external host
if(foreignNodeCnt < 1)
{
INFO_PRINTF1(_L("Error! For successfull testing you should have at least 1 external hosts available!\n"));
SetTestStepResult(EInconclusive);
//.........这里部分代码省略.........
示例6: ProbeNodes
/**
* Tries to resolve each host name from the table loaded from ini file.
* @param aNetworkInfo ref. to the TNetworkInfo structure, which will be populated
*/
void CTestStepLLMNR_Init::ProbeNodes(TNetworkInfo& aNetworkInfo)
{
TName tmpBuf;
TInt nRes;
TNameEntry nameEntry;
//-- start name resolution for every entry in HostInfo
GetIntFromConfig(KNodesSection, _L("ScanMaxDelay"), nRes);
const TInt scanMaxDelay = nRes*KOneSecond;
for(;;)
{
TInt cntFinishedHosts = 0;
for(TInt cntNode=0; cntNode< aNetworkInfo.NodesCount(); ++cntNode)
{
TNodeInfo& currNode = aNetworkInfo[cntNode]; //-- current node info
if( ! currNode.iAlive && currNode.iCntTrials >0)
{//-- the host is worth asking its IP address
//-- a small random delay between sending queries
User::After(ipTestServer->RandomizeNum(scanMaxDelay));
INFO_PRINTF1(KNewLine);
tmpBuf.Copy(_L("- Probing host: "));
tmpBuf.Append(currNode.iHostName);
INFO_PRINTF1(tmpBuf);
nRes = ipTestServer->iHostResolver.GetByName(currNode.iHostName, nameEntry);
if(nRes == KErrNone)
{//-- current host name has been resolver successfully, mark it alive and store its IP address
//-- check if the obtained IP address is unique in TNetworkInfo
currNode.iIpUnique = (aNetworkInfo.FindIP(nameEntry().iAddr) < 0);
currNode.iAddr = nameEntry().iAddr;
currNode.iAlive = ETrue;
currNode.iAddr.Output(nameEntry().iName);
tmpBuf.Copy(_L("name resolved: "));
tmpBuf.Append(nameEntry().iName);
INFO_PRINTF1(tmpBuf);
}
else
{//-- no response
currNode.iCntTrials --; //-- decrease trials counter for this hostname
INFO_PRINTF2(_L("name resolution error: %d"), nRes);
}
}
else
cntFinishedHosts++;
}
//-- check, whether we need to continue nodes scanning
//-- if either host is alive or has trials counted down to 0, exit
if(cntFinishedHosts == aNetworkInfo.NodesCount())
break;
} //for(;;)
INFO_PRINTF1(KNewLine);
}
示例7: ConstructL
void CHlpFileEntry::ConstructL(TLanguage aLanguage)
{
_LIT(KDefaultHelpFileExtension, ".hlp");
// Decide what type of file this is....
TFileName file;
TChar driveLetter;
User::LeaveIfError(RFs::DriveToChar(iDrive, driveLetter));
file.Append(driveLetter);
file.Append(':');
file.Append(KHlpFileSearchPath);
file.Append(iFile);
TParsePtrC parser(file);
if (!parser.ExtPresent())
User::Leave(KErrCorrupt);
iName.Copy(parser.Name());
TPtrC extension(parser.Ext());
if (extension.CompareF(KDefaultHelpFileExtension) == 0)
iType = EGeneral;
else
{
TFileName idealHelpFileName(parser.DriveAndPath());
idealHelpFileName.Append(parser.Name());
MakeLocaleSpecificExtension(idealHelpFileName, aLanguage);
if (idealHelpFileName.CompareF(file) == 0)
{
// This is a primary match
iType = EPrimary;
iHelpFileLocale = aLanguage;
}
else
{
// Is it a secondary match? If it isn't then it should be discarded....
idealHelpFileName = parser.DriveAndPath();
idealHelpFileName.Append(parser.Name());
// Get the nearest secondary language
aLanguage = NextLanguage(aLanguage);
MakeLocaleSpecificExtension(idealHelpFileName, aLanguage);
if (idealHelpFileName.CompareF(file) == 0)
{
iHelpFileLocale = aLanguage;
iType = ESecondary;
}
else
{
TLex lexer(extension);
// Skip the leading .H
lexer.Inc(2);
// Lex the value, but silently ignore errors
TUint localeAsUnsignedInt = ELangOther;
lexer.Val(localeAsUnsignedInt);
iHelpFileLocale = STATIC_CAST(TLanguage, localeAsUnsignedInt);
iType = EInpropperLocale;
}
}
}
}
示例8: CleanupClosePushL
TBool CC32RunThreadStep::ThreadCreationL()
/**
* @return - TBool
* Implementation of ThreadCreationL virtual function
* This function is used to spawn each client thread and result will be logged to
* a HTML file.
* returns EFalse if a thread panics or test case fails.
*/
{
//create a global semaphore
RSemaphore clientSemaphore;
CleanupClosePushL(clientSemaphore);
TInt result = clientSemaphore.CreateGlobal(KSemaphoreName, 0);
//create threads based on the information given in ini file
for (TInt n = 0 ; n<iTaskCounter; n++ )
{
iNetPerformanceThread[n] = new(ELeave) C32PerformanceThread( *iThreadData[n] );
TName name;
name.Copy( iThreadData[n]->iThreadName );
RThread thread;
const TUint KStackSize=0x1000;
TInt nErr;
if ( (nErr = thread.Create(name, C32PerformanceThread::RunL, KStackSize, NULL, iNetPerformanceThread[n])) == KErrNone)
{
thread.SetPriority(ParseThreadPriority(iThreadData[n]->iThreadPriority));
thread.Logon(iRequestStatus[n]);
thread.Resume();
thread.Close();
}
else
{
INFO_PRINTF3(_L(" Failed to create thread = %S .Failed with error = %d "),&iThreadData[n]->iThreadName,nErr);
}
}
INFO_PRINTF1(_L("------------------------ C32 Performance Results -------------------------------- "));
for (TInt j=0 ; j<iTaskCounter; j++ )
{
//wait for the thread to complete
User::WaitForRequest( iRequestStatus[j] );
//print the results to a log file
INFO_PRINTF2(_L(" Thread Name = %S "),&iThreadData[j]->iThreadName);
INFO_PRINTF2(_L(" Task Name = %S "),&iThreadData[j]->iTaskName);
INFO_PRINTF2(_L(" Time taken to execute the thread = %ld microseconds "), iThreadData[j]->iThreadTime);
INFO_PRINTF2(_L(" Error occured in line no = %d. Expected value was 0 "), iThreadData[j]->iTestResult);
INFO_PRINTF2(_L(" Thread terminated value = %d. Expected value was 0 "),iRequestStatus[j].Int());
INFO_PRINTF1(_L("--------------------------------------------------------------------------------- "));
}
CleanupStack::PopAndDestroy();
/*
iTestResult is used to indicate the line no of the error occured in each test case.
return EFalse,if a test case failed or a thread paniced
*/
for (TInt j=0 ; j<iTaskCounter; j++ )
{
if((iThreadData[j]->iTestResult > 0) || (iRequestStatus[j].Int() > 0 ))
{
return EFalse;
}
}
return ETrue;
}
示例9: ConnectL
// -----------------------------------------------------------------------------
// CHttpConnHandler::ConnectL
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::ConnectL()
{
LOGGER_ENTERFN( "ConnectL" );
TBool doComplete( ETrue );
iShutDown->Cancel();
if( !iConnection.SubSessionHandle() )
// only the first connection request does this initialization
{
CLOG_WRITE( "No subsession" );
// forget the previous notifier
if( iConnName )
{
CLOG_WRITE_1("ConnName set: [%S]", iConnName);
TName connName;
connName.Copy( *iConnName );
User::LeaveIfError( iConnection.Open( iClientApp->Engine()->SocketServ(), connName ) );
CLOG_WRITE( "connection open" );
TNifProgress progress;
iConnection.Progress( progress );
iConnStage = progress.iStage;
CLOG_WRITE_1("Stage: %d", iConnStage);
UpdateIapId();
}
else
{
User::LeaveIfError( iConnection.Open( iClientApp->Engine()->SocketServ() ) );
CLOG_WRITE8_1( "Start: %d", iIapId );
if( iIapId )
{
iPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
iPref.SetIapId( iIapId );
}
else
{
iPref.SetDialogPreference( ECommDbDialogPrefPrompt );
}
iConnection.Start( iPref, iStatus );
// RConnection will complete us.
doComplete = EFalse;
}
iConnNotif->Start();
iNewConnection = ETrue;
}
CLOG_WRITE_1( "stage: %d", iConnStage );
if( !IsActive() )
{
CLOG_WRITE( "Not active" );
SetActive();
CLOG_WRITE_1( "doComplete: %d", doComplete );
if( doComplete )
{
TRequestStatus* dummy = &iStatus;
User::RequestComplete( dummy, KErrNone );
}
}
}
示例10: OpenNewCallL
void CTelServerProcessor::OpenNewCallL()
/**
Load the TSY and open a new call from the ETEL server
*/
{
__ASSERT_ALWAYS(!iCallOpen, NetDialPanic(EEtelCallAlreadyOpen));
__ASSERT_ALWAYS(iCallType==EUnknown, NetDialPanic(EEtelCallAlreadyOpen));
TBuf<KCommsDbSvrMaxFieldLength> newTsyName;
iDb->GetTsyNameL(newTsyName);
// Remove unnecessary .TSY extension, if found
if (newTsyName.Right(4).CompareF(KTsyNameExtension) == 0)
newTsyName = newTsyName.Left(newTsyName.Length() - 4);
TBool loaded=EFalse;
if (iTsyName.Length()!=0)
{
if (iTsyName.CompareF(newTsyName)==KErrNone) // the one we want is already loaded
loaded=ETrue;
else // unload the one we were using
{
User::LeaveIfError(iTelServer.UnloadPhoneModule(iTsyName));
iTsyLoaded=EFalse;
}
}
if (!loaded)
{
User::LeaveIfError(iTelServer.LoadPhoneModule(newTsyName));
iTsyName=newTsyName;
iTsyLoaded=ETrue;
}
if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone)
{
User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic));
}
RTelServer::TPhoneInfo info;
GetPhoneInfoL(info);
TName callName;
callName.Zero();
callName.Copy(info.iName); // phone name
callName.Append(KDoubleColon);
RPhone::TLineInfo lineInfo;
GetLineInfoL(lineInfo,info.iName,RLine::KCapsData);
callName.Append(lineInfo.iName);
callName.Append(KDoubleColon);
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_OPENNEWCALLL_1, "NetDial:\tOpening Call");
iDb->CopyIspInitStringToModemL(); // will not leave if the field is blank
// Only MultimodeV1 and greater supported!
if (info.iExtensions>=(TUint)KETelExtMultimodeV1)
{
User::LeaveIfError(iMmCall.OpenNewCall(iTelServer,callName));
iCallOpen=ETrue;
iCallType=EMmDataCall;
SetMmParametersL(); // may change call type to EMmHscsdCall
}
else
{
User::LeaveIfError(iCall.OpenNewCall(iTelServer,callName));
iCallOpen=ETrue;
iCallType=ECoreCallOnly;
}
}