当前位置: 首页>>代码示例>>C++>>正文


C++ VString::ToCString方法代码示例

本文整理汇总了C++中VString::ToCString方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::ToCString方法的具体用法?C++ VString::ToCString怎么用?C++ VString::ToCString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VString的用法示例。


在下文中一共展示了VString::ToCString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _BuildArrayArguments

void XPosixProcessLauncher::_BuildArrayArguments(char **&outArrayArg)
{	
	sLONG nbArguments = (sLONG) fArrayArg.size();
	
	// Dispose the previous array of arguments if not NULL
	_Free2DCharArray(outArrayArg);
	
	if(nbArguments < 1)
		return;
	
	size_t outArrayArgLength = (nbArguments + 1 ) * sizeof(char*);
	outArrayArg = (char **) gMemory->NewPtr(outArrayArgLength, 0);
	
	if(testAssert(outArrayArg != NULL))
	{
		for(sLONG i = 0; i < nbArguments; ++i)
		{
			VString		*currentArgPtr = &fArrayArg[i];
			size_t		argFullLength = currentArgPtr->GetLength() * 2;// + 1;
			char		*newArgPtr = new char[argFullLength];
			
			if(newArgPtr != NULL)
				currentArgPtr->ToCString(newArgPtr, argFullLength);
			
			outArrayArg[i] = newArgPtr;
		}
		outArrayArg[nbArguments] = NULL;
	}
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:29,代码来源:XPosixProcessLauncher.cpp

示例2: EncodeDNSName

VError Bonjour::EncodeDNSName (uBYTE *outBuffer, uLONG *ioSize, const VString &inString)
{
	xbox_assert(outBuffer != NULL && ioSize != NULL);
	
	VError	error;	
	uBYTE	buffer[kMaximumNameLength + 2];
		
	error = VE_OK;	
		
	buffer[kMaximumNameLength + 1] = 0xff;
	inString.ToCString((char * ) buffer, kMaximumNameLength + 2);
	if (buffer[kMaximumNameLength + 1] != 0xff)
		
		return VE_SRVR_BONJOUR_NAME_TOO_LONG;
	
	if (!buffer[0]) {
	
		outBuffer[0] = 0;
		*ioSize = 1;
		return VE_OK;
		
	}
	
	uBYTE	*p, *q, *r;
	uLONG	size;
		
	p = q = buffer;
	r = outBuffer;
	size = 0;
	for ( ; ; ) {
		
		while (*p && *p != '.') 
			
			p++;
		
		size += p - q + 1;
		if (size + 1 > *ioSize) {
			
			error = VE_SRVR_BONJOUR_CANT_FIT_PACKET;
			break;
			
		}
		
		*r++ = p - q;		
		while (*p != *q)
			
			*r++ = *q++;
		
		if (*p) {
			
			p++;
			q++;
			
		} else {
			
			*r++ = 0;
			*ioSize = size + 1;
			error = VE_OK;
			break;
			
		}
		
	}	
	
	return error;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:66,代码来源:ServiceDiscovery.cpp

示例3: Start

//	==================================================
//	VCacheLog / Start-stop
//	==================================================
bool VCacheLog::Start(const XBOX::VFolder& inFolder, const XBOX::VString& inLogFileName, const XBOX::VValueBag *inParams)
{
#if VERSIONDEBUG && 0
	_ExplainTTRFormat_V1();
#endif

	VTaskLock lock(&s_mutex);

	_StopWithoutLocking();

	fLogFile = new VSplitableLogFile( inFolder, inLogFileName, 1);
	if (fLogFile != NULL)
	{
		if (fLogFile->Open(true))
		{
			s_isStarted = true;
			fStarTimeMS = XBOX::VSystem::GetCurrentTime();

			fMemStatsLevel = eCLDumpStats_Mini;

			VString		appVersion, structPath, dataPath, cacheSettings;
			if(inParams != NULL)
			{
				sLONG	level = 0;
				
				// If stats level not passed or equal to zero => stays to eCLDumpStats_Mini.
				if( inParams->GetLong("mem_stats_level", level) && level != 0)
					fMemStatsLevel = (ECacheLogMemStatsLevel)	level;

				inParams->GetString("application_version", appVersion);
				inParams->GetString("structure_path", structPath);
				inParams->GetString("data_path", dataPath);
				inParams->GetString("cache_settings", cacheSettings);
			}

			char		theTime[512] = {0};
			time_t now = ::time( NULL);
			::strftime( theTime, sizeof( theTime),"%Y-%m-%dT%H:%M:%S", localtime( &now));
			
			// Start of "begin log"
			fLogFile->AppendFormattedString("[%d]s\t%s\t%d\t%d\r", (sLONG) eCLEntryKind_Start, theTime, XBOX::VTask::GetCurrent()->GetID(), kTTR_FORMAT_VERSION);

			// Add the misc. infos
			char	cStrBuffer[2048];

			VString		sysVersStr;
			XBOX::VSystem::GetOSVersionString(sysVersStr);
			cStrBuffer[0] = 0;
			sysVersStr.ToCString(cStrBuffer, 2048);
			fLogFile->AppendFormattedString("%s\r", cStrBuffer);

			cStrBuffer[0] = 0;
			appVersion.ToCString(cStrBuffer, 2048);
			fLogFile->AppendFormattedString("Application version\t%s\r", cStrBuffer);

			cStrBuffer[0] = 0;
			structPath.ToCString(cStrBuffer, 2048);
			fLogFile->AppendFormattedString("struct\t%s\r", cStrBuffer);
			
			cStrBuffer[0] = 0;
			dataPath.ToCString(cStrBuffer, 2048);
			fLogFile->AppendFormattedString("data\t%s\r", cStrBuffer);
			
			cStrBuffer[0] = 0;
			cacheSettings.ToCString(cStrBuffer, 2048);
			fLogFile->AppendFormattedString("Cache settings:\r%s\r", cStrBuffer);

			// End of "begin log"
			fLogFile->AppendFormattedString("[%d]e\r", (sLONG) eCLEntryKind_Start);
		}
		else
		{
			_StopWithoutLocking();
		}
	}

	return fLogFile != NULL;
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:81,代码来源:VCacheLog.cpp

示例4: main

int main (int inArgc, char * const inArgv[])
{
	// set pattern matching wild char asap
	VCollator::SetDefaultWildChar( '*');	
	
	// First, create the application. So, everything is initialized and ready to use
	VRIAServerApplication application;
	VProcess::InitOptions initOptions = VProcess::Init_Default & ~VProcess::Init_WithQuickTime;

#if VERSION_LINUX
	XBOX::VString versionString;
	versionString.FromCString (STRPRODUCTVER); // 	YT 18-May-2012 - WAK0076647
    VRIAServerApplication::Get()->SetProductVersion (versionString);
#endif
	
    //jmo - We may want to quit after parsing the command line
    bool shouldQuit=false;

	if (application.Init( initOptions))
	{
		// Parse the command line argument
		VError err = VE_OK;

		// remote admin: feature development in progress
		//VRIAServerSupervisor*	srvSup = VRIAServerSupervisor::Get();

		VRIAServerStartupParameters *startupParameters = new VRIAServerStartupParameters();
		if (startupParameters != NULL)
		{
			// skip first argument (executable path)
			if (inArgc > 1)
			{
				int curArg = 1;

				while (curArg < inArgc && err == VE_OK)
				{
					VString argument( inArgv[curArg]);

					if (argument.BeginsWith( kARG_ADMINISTRATOR_PORT))
					{
						++curArg;
						argument.Remove( 1, kARG_ADMINISTRATOR_PORT.GetLength());
						if (!argument.IsEmpty() && argument.GetUniChar(1) == '=')
						{
							argument.Remove( 1, 1);
							if (!argument.IsEmpty())
							{
								sLONG port = argument.GetLong();
								if (port > 0)
									startupParameters->SetAdministratorHttpPort( port);
								else
									err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
							}
							else
							{
								err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
							}
						}
						else
						{
							err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
						}
					}
					else if (argument.BeginsWith( kARG_ADMINISTRATOR_SSL_PORT))
					{
						++curArg;
						argument.Remove( 1, kARG_ADMINISTRATOR_SSL_PORT.GetLength());
						if (!argument.IsEmpty() && argument.GetUniChar(1) == '=')
						{
							argument.Remove( 1, 1);
							if (!argument.IsEmpty())
							{
								sLONG port = argument.GetLong();
								if (port > 0)
									startupParameters->SetAdministratorSSLPort( port);
								else
									err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
							}
							else
							{
								err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
							}
						}
						else
						{
							err = VE_RIA_INVALID_COMMAND_LINE_ARGUMENTS;
						}
					}
                    else if (argument.BeginsWith( kVERSION_NUMBER))
					{
						++curArg;
						argument.Remove(1, kVERSION_NUMBER.GetLength());

						VString version;
						
						VRIAServerApplication::Get()->GetProductVersion(version);
						
						char buf[100];
						
						version.ToCString(buf, sizeof(buf));
//.........这里部分代码省略.........
开发者ID:sanyaade-teachings,项目名称:core-Wakanda,代码行数:101,代码来源:main.cpp


注:本文中的VString::ToCString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。