本文整理汇总了C++中VString::Printf方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::Printf方法的具体用法?C++ VString::Printf怎么用?C++ VString::Printf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::Printf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Stop
VError VRIAServerSolution::Stop()
{
if (!fState.started)
return VE_OK;
StUseLogger logger;
VMicrosecondsCounter usCounter;
usCounter.Start();
logger.Log( fLoggerID, eL4JML_Information, L"Stopping the solution");
VRIAServerApplication::Get()->SetDataCacheFlushEnabled( false);
// sc 21/01/2010, to avoid dead locks, never lock the applications mutex during the applications stopping.
for (VectorOfApplication_iter iter = fApplicationsCollection.begin() ; iter != fApplicationsCollection.end() ; ++iter)
{
(*iter)->OnStop();
}
VJSWorker::TerminateAll();
for (VectorOfApplication_iter iter = fApplicationsCollection.begin() ; iter != fApplicationsCollection.end() ; ++iter)
{
(*iter)->Stop();
}
fState.started = false;
VString logMsg;
logMsg.Printf( "Solution stopped (duration: %i ms)", usCounter.Stop()/1000);
logger.Log( fLoggerID, eL4JML_Information, logMsg);
return VE_OK;
}
示例2: Put
void VSysLogOutput::Put( std::vector< const XBOX::VValueBag* >& inValuesVector)
{
for (std::vector< const XBOX::VValueBag* >::iterator bagIter = inValuesVector.begin() ; bagIter != inValuesVector.end() ; ++bagIter)
{
EMessageLevel bagLevel = ILoggerBagKeys::level.Get( *bagIter);
if ((fFilter & (1 << bagLevel)) != 0)
{
VString logMsg;
VError errorCode = VE_OK;
ILoggerBagKeys::error_code.Get( *bagIter, errorCode);
VString loggerID;
ILoggerBagKeys::source.Get( *bagIter, loggerID);
OsType componentSignature = 0;
if (!ILoggerBagKeys::component_signature.Get( *bagIter, componentSignature))
componentSignature = COMPONENT_FROM_VERROR( errorCode);
if (componentSignature != 0)
{
if (!loggerID.IsEmpty())
loggerID.AppendUniChar( L'.');
loggerID.AppendOsType( componentSignature);
}
if (!loggerID.IsEmpty())
logMsg.Printf( "[%S]", &loggerID);
// build message string
VString message;
if (errorCode != VE_OK)
message.AppendPrintf( "error %d", ERRCODE_FROM_VERROR( errorCode));
VString bagMsg;
if (ILoggerBagKeys::message.Get( *bagIter, bagMsg))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( bagMsg);
}
sLONG taskId=-1;
if (ILoggerBagKeys::task_id.Get( *bagIter, taskId))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( L"task #");
message.AppendLong( taskId);
}
VString taskName;
if (!ILoggerBagKeys::task_name.Get( *bagIter, taskName))
VTask::GetCurrent()->GetName( taskName);
if (!taskName.IsEmpty())
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( taskName);
}
sLONG socketDescriptor=-1;
if (ILoggerBagKeys::socket.Get( *bagIter, socketDescriptor))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( L"socket ");
message.AppendLong(socketDescriptor);
}
VString localAddr;
if (ILoggerBagKeys::local_addr.Get( *bagIter, localAddr))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( L"local addr is ");
message.AppendString( localAddr);
}
VString peerAddr;
if (ILoggerBagKeys::peer_addr.Get( *bagIter, peerAddr))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( L"peer addr is ");
message.AppendString( peerAddr);
}
bool exchangeEndPointID=false;
if (ILoggerBagKeys::exchange_id.Get( *bagIter, exchangeEndPointID))
{
if (!message.IsEmpty())
message.AppendString( L", ");
message.AppendString( (exchangeEndPointID) ? L"exchange endpoint id" : L"do not exchange endpoint id");
}
bool isBlocking=false;
if (ILoggerBagKeys::is_blocking.Get( *bagIter, isBlocking))
{
//.........这里部分代码省略.........
示例3: _Open
//.........这里部分代码省略.........
VErrorBase *errBase = CreateErrorBase( VE_RIA_CANNOT_OPEN_PROJECT, &name, NULL);
logger.LogMessageFromErrorBase( fLoggerID, errBase);
ReleaseRefCountable( &errBase);
if (!fState.inMaintenance)
{
if (application != NULL)
application->Close();
if (ignoreProjectOpeningErrors)
err = VE_OK;
else
err = VE_RIA_CANNOT_OPEN_PROJECT;
}
}
ReleaseRefCountable( &application);
}
}
if (!hasAdmin && !fState.inMaintenance && (err == VE_OK))
{
VFile file( serverAdminProjectPath);
if (file.Exists())
{
VURL url( serverAdminProjectPath);
fDesignSolution->AddExistingProject( url, false);
VProject *designProject = fDesignSolution->GetProjectFromFilePathOfProjectFile( serverAdminProjectPath);
if (designProject != NULL)
{
VRIAServerProject *application = NULL;
// Create opening parameters
VRIAServerProjectOpeningParameters *projectOpeningParams = new VRIAServerProjectOpeningParameters();
if (projectOpeningParams != NULL)
{
projectOpeningParams->SetOpeningMode( ePOM_FOR_RUNNING);
sLONG defaultAdminPort = 0;
if (fOpeningParameters->GetCustomAdministratorHttpPort( defaultAdminPort))
projectOpeningParams->SetCustomHttpPort( defaultAdminPort);
application = VRIAServerProject::OpenProject( err, this, designProject, projectOpeningParams);
if (application != NULL && err == VE_OK)
{
VUUID uuid;
xbox_assert(application->GetUUID( uuid));
fApplicationsCollection.push_back( VRefPtr<VRIAServerProject>(application));
fApplicationsMap[uuid] = VRefPtr<VRIAServerProject>(application);
}
ReleaseRefCountable( &projectOpeningParams);
}
else
{
err = ThrowError( VE_MEMORY_FULL);
}
if (err != VE_OK)
{
VString name;
designProject->GetName( name);
VErrorBase *errBase = CreateErrorBase( VE_RIA_CANNOT_OPEN_PROJECT, &name, NULL);
logger.LogMessageFromErrorBase( fLoggerID, errBase);
ReleaseRefCountable( &errBase);
if (application != NULL)
application->Close();
if (ignoreProjectOpeningErrors)
err = VE_OK;
else
err = VE_RIA_CANNOT_OPEN_PROJECT;
}
ReleaseRefCountable( &application);
}
}
}
fApplicationsMutex.Unlock();
}
}
logger.LogMessagesFromErrorContext( fLoggerID, errContext.GetContext());
if (err == VE_OK)
{
VString logMsg;
logMsg.Printf( "Solution opened (duration: %i ms)", usCounter.Stop()/1000);
logger.Log( fLoggerID, eL4JML_Information, logMsg);
}
}
}
fState.opened = true;
return err;
}
示例4: Start
VError VRIAServerSolution::Start()
{
if (!fState.opened || fState.started || fState.inMaintenance)
return VE_OK;
VError err = VE_OK;
StUseLogger logger;
VMicrosecondsCounter usCounter;
usCounter.Start();
logger.Log( fLoggerID, eL4JML_Information, L"Starting the solution");
if (fApplicationsMutex.Lock())
{
bool ignoreProjectStartingErrors = !fSettings.GetStopIfProjectFails();
fGarbageCollect = fSettings.GetGarbageCollect();
for (VectorOfApplication_iter iter = fApplicationsCollection.begin() ; iter != fApplicationsCollection.end() && err == VE_OK ; ++iter)
{
err = (*iter)->Start();
if (err != VE_OK)
{
VString name;
(*iter)->GetName( name);
VErrorBase *errBase = CreateErrorBase( VE_RIA_CANNOT_START_PROJECT, &name, NULL);
logger.LogMessageFromErrorBase( fLoggerID, errBase);
ReleaseRefCountable( &errBase);
VJSWorker::TerminateAll();
(*iter)->Stop(); // sc 19/01/2011 if the project started with errors, the project must be stopped
if (ignoreProjectStartingErrors)
err = VE_OK;
else
err = VE_RIA_CANNOT_START_PROJECT;
}
}
for (VectorOfApplication_iter iter = fApplicationsCollection.begin() ; iter != fApplicationsCollection.end() && err == VE_OK ; ++iter)
{
if ((*iter)->IsStarted())
{
err = (*iter)->OnStartup();
if (err != VE_OK)
{
VString name;
(*iter)->GetName( name);
VErrorBase *errBase = CreateErrorBase( VE_RIA_CANNOT_START_PROJECT, &name, NULL);
logger.LogMessageFromErrorBase( fLoggerID, errBase);
ReleaseRefCountable( &errBase);
VJSWorker::TerminateAll();
(*iter)->Stop(); // sc 19/01/2011 if the bootstrap cannot be executed, the project must be stopped
if (ignoreProjectStartingErrors)
err = VE_OK;
else
err = VE_RIA_CANNOT_START_PROJECT;
}
}
}
fApplicationsMutex.Unlock();
}
VRIAServerApplication::Get()->SetDataCacheFlushEnabled( true);
if (err == VE_OK)
{
//TEST_RegisterDebuggerUAGCallback ( );
#if defined(WKA_USE_CHR_REM_DBG)
#else
xbox_assert ( fDebuggerSettings == NULL );
fDebuggerSettings = new VJSDebuggerSettings ( this );
err = fDebuggerSettings-> Init ( );
if ( err == VE_OK )
{
JSWDebuggerFactory fctry;
IJSWDebugger* jswDebugger = fctry. Get ( );
if ( jswDebugger != 0 )
jswDebugger-> SetSettings ( fDebuggerSettings );
}
#endif
}
if (err == VE_OK)
{
VString logMsg;
logMsg.Printf( "Solution started (duration: %i ms)", usCounter.Stop()/1000);
logger.Log( fLoggerID, eL4JML_Information, logMsg);
}
fState.started = true;
return err;
//.........这里部分代码省略.........
示例5: Close
VError VRIAServerSolution::Close()
{
if (!fState.opened || fState.started)
return VE_OK;
StUseLogger logger;
VMicrosecondsCounter usCounter;
usCounter.Start();
logger.Log( fLoggerID, eL4JML_Information, L"Closing the solution");
for (VectorOfApplication_iter iter = fApplicationsCollection.begin() ; iter != fApplicationsCollection.end() ; ++iter)
{
(*iter)->Close();
}
if (fApplicationsMutex.Lock())
{
fApplicationsCollection.clear();
fApplicationsMap.clear();
fApplicationsMutex.Unlock();
}
xbox_assert(fUAGDirectory->GetRefCount() == 1);
ReleaseRefCountable( &fUAGDirectory);
if (fDesignSolution != NULL)
{
VSolutionManager::Get()->CloseSolution( fDesignSolution);
delete fDesignSolution;
fDesignSolution = NULL;
}
#if defined(WKA_USE_CHR_REM_DBG)
#else
JSWDebuggerFactory fctry;
IJSWDebugger* jswDebugger = fctry. Get ( );
if ( jswDebugger != 0 )
jswDebugger-> SetSettings ( NULL );
delete fDebuggerSettings;
fDebuggerSettings = NULL;
#endif
VString logMsg;
logMsg.Printf( "Solution closed (duration: %i ms)", usCounter.Stop()/1000);
logger.Log( fLoggerID, eL4JML_Information, logMsg);
if (fLogger != NULL)
{
if (fLogReader != NULL)
{
fLogger->DetachReader( fLogReader);
}
fLogger->Flush();
fLogger->Stop();
ILogger *appLogger = VRIAServerApplication::Get()->RetainLogger();
if (appLogger == fLogger)
VRIAServerApplication::Get()->SetLogger( NULL);
ReleaseRefCountable( &appLogger);
}
ReleaseRefCountable( &fLogger);
ReleaseRefCountable( &fLogReader);
fName.Clear();
fLoggerID.Clear();
fSettings.Clear();
delete fJSContextPool;
fJSContextPool = NULL;
delete fJSRuntimeDelegate;
fJSRuntimeDelegate = NULL;
ReleaseRefCountable( &fOpeningParameters);
fState.opened = false;
fState.inMaintenance = false;
return VE_OK;
}
示例6: _OpenUAGDirectory
CUAGDirectory* VRIAServerSolution::_OpenUAGDirectory( VError& outError)
{
outError = VE_OK;
CUAGDirectory *directory = nil;
CUAGManager *uag = VComponentManager::RetainComponentOfType<CUAGManager>();
if (uag != NULL)
{
if (testAssert(fDesignSolution != NULL))
{
StUseLogger logger;
VMicrosecondsCounter usCounter;
VProjectItem *dirItem = fDesignSolution->GetProjectItemFromTag( kUAGDirectoryTag);
if (dirItem != NULL)
{
VFilePath directoryPath;
dirItem->GetFilePath( directoryPath);
usCounter.Start();
logger.Log( fLoggerID, eL4JML_Information, L"Opening the users and groups directory");
VFile file( directoryPath);
directory = uag->RetainDirectory( file, FA_READ_WRITE, NULL, NULL, &outError);
}
if (directory == NULL && outError == VE_OK)
{
VFilePath solpath;
fDesignSolution->GetSolutionFilePath(solpath);
solpath.SetExtension(RIAFileKind::kDirectoryFileExtension);
VFile defaultDirFile(solpath);
directory = uag->RetainDirectory( defaultDirFile, FA_READ_WRITE, NULL, NULL, &outError, NULL, true);
}
if (directory != NULL && outError == VE_OK)
{
// Create an "admin" user if needed
CUAGGroup *adminGroup = directory->RetainSpecialGroup( CUAGDirectory::AdminGroup);
CUAGGroup *debuggerGroup = directory->RetainSpecialGroup( CUAGDirectory::DebuggerGroup);
if ((adminGroup != NULL) && (debuggerGroup != NULL))
{
StErrorContextInstaller errorContext( VE_UAG_USERNAME_DOES_NOT_EXIST, VE_OK);
CUAGUser *adminUser = directory->RetainUser( L"admin");
if (adminUser == NULL)
adminUser = directory->AddOneUser( L"admin", L"", L"", outError);
if ((outError == VE_OK) && (adminUser != NULL))
{
VUUID adminUserID, userID;
adminUser->GetID( adminUserID);
CUAGUserVector users;
adminGroup->RetainUsers( users);
bool hasAdminUser = false;
for (CUAGUserVector::iterator userIter = users.begin() ; (userIter != users.end()) && !hasAdminUser ; ++userIter)
{
(*userIter)->GetID( userID);
hasAdminUser = (adminUserID == userID);
}
if (!hasAdminUser)
outError = adminUser->PutIntoGroup( adminGroup);
if (outError == VE_OK)
{
users.clear();
debuggerGroup->RetainUsers( users);
hasAdminUser = false;
for (CUAGUserVector::iterator userIter = users.begin() ; (userIter != users.end()) && !hasAdminUser ; ++userIter)
{
(*userIter)->GetID( userID);
hasAdminUser = (adminUserID == userID);
}
if (!hasAdminUser)
outError = adminUser->PutIntoGroup( debuggerGroup);
}
}
ReleaseRefCountable( &adminUser);
}
QuickReleaseRefCountable( adminGroup);
QuickReleaseRefCountable( debuggerGroup);
}
if (directory != NULL && outError == VE_OK)
{
VString logMsg;
logMsg.Printf( "Users and groups directory opened (duration: %i ms)", usCounter.Stop()/1000);
logger.Log( fLoggerID, eL4JML_Information, logMsg);
}
}
uag->Release();
//.........这里部分代码省略.........