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


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

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


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

示例1: AppendRawData

void AXMLAttribute::AppendRawData(VString &pDestination) const
{
	pDestination.AppendString(fName);
	pDestination.AppendCString("=\"");
	pDestination.AppendString(fValue);
	pDestination.AppendCString("\"");
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:7,代码来源:XMLGenerator.cpp

示例2:

wchar_t * XWinProcessLauncher::_CreateConcatenetedArguments()
{
	sLONG		nbArguments	= (sLONG) fArrayArg.size();
	wchar_t *	theArgs		= NULL;
	
	if(nbArguments < 1)
	{
		theArgs = new wchar_t[1];
		theArgs[0] = 0;
	}
	else
	{
		VString		concatenetedArgs;
		concatenetedArgs.SetEmpty();
		
		for(sLONG i = 0; i < nbArguments; ++i)
		{
			// ACI0065260 - 2010-03-11, T.A.
			// Add quotes if the path contains a space and is not already quoted
			if( !fArrayArg[i].IsEmpty() && fArrayArg[i].FindUniChar(CHAR_SPACE) > 0 && fArrayArg[i][0] != CHAR_QUOTATION_MARK )
			{
				VString		quotedArg;

				quotedArg = CHAR_QUOTATION_MARK;
				quotedArg += fArrayArg[i];
				quotedArg += CHAR_QUOTATION_MARK;

				concatenetedArgs.AppendString(quotedArg);
			}
			else
			{
				concatenetedArgs.AppendString(fArrayArg[i]);
			}
			if(i < (nbArguments - 1))
				concatenetedArgs.AppendChar(' ');
		}

		theArgs = _CreateCString(concatenetedArgs, true);
	}
	
	return theArgs;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:42,代码来源:XWinProcessLauncher.cpp

示例3: DumpXMLCData

void VValueBag::DumpXMLCData( VString& ioDump, VIndex inCDataAttributeIndex) const
{
	VStr<1000> cdata;

	GetNthAttribute( inCDataAttributeIndex, NULL)->GetString( cdata);

	if (NeedsEscapeSequence( cdata, sXMLEscapeChars_Contents, sXMLEscapeChars_Contents + sizeof(sXMLEscapeChars_Contents)/sizeof(UniChar)))
	{
		ioDump += CVSTR( "<![CDATA[");

		// see if there's a "]]>" for which we need to split
		// someting like: hello ]]> world
		// becomes: <![CDATA[hello ]]>]]<![CDATA[> world]]>
		
		VIndex pos = 1;
		while( pos <= cdata.GetLength())
		{
			VIndex endTag = cdata.Find( CVSTR( "]]>"), pos, true);
			if (endTag > 0)
			{
				// add everything including ]]>
				ioDump.AppendBlock( cdata.GetCPointer() + pos - 1, (endTag - pos + 3) * sizeof( UniChar), VTC_UTF_16);
				// add ]] outside CDATA section
				ioDump.AppendString( CVSTR( "]]"));
				// open a new CDATA section and add remaining >
				ioDump += CVSTR( "<![CDATA[>");
				pos = endTag + 3;
			}
			else
			{
				// add everything left
				ioDump.AppendBlock( cdata.GetCPointer() + pos - 1, (cdata.GetLength() - pos + 1) * sizeof( UniChar), VTC_UTF_16);
				break;
			}
		}
		ioDump += CVSTR( "]]>");
	}
	else
	{
		VString toInsert;
		for (sLONG i = 0, n = cdata.GetLength(); i < n; i++)
		{
			UniChar c = cdata[ i ];
			if (c != 13 && c != 10 && c != 9)
			{
				toInsert += c;
			}
		}
		if ( ! toInsert.IsEmpty() )
			ioDump += toInsert;
	}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:52,代码来源:VValueBag.cpp

示例4: GetData

void AXMLElement::GetData( VString &pCData)
{
	AXMLGenericElement	*elem;
	VString			vCData;

	vCData.Clear();
	pCData.Clear();
	elem = Get_FirstChild();
	while (elem) {
		elem->GetData(vCData);
		pCData.AppendString(vCData);
//		pCData.AppendChar((uBYTE)0x0D);
		elem = elem->GetNext();
	}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:15,代码来源:XMLGenerator.cpp

示例5: _EncodePTRQuery

VError VServiceDiscoveryClient::_EncodePTRQuery (uBYTE *outBuffer, uLONG *ioSize, const VString &inServiceName, uWORD inIdentifier)
{
	xbox_assert(outBuffer != NULL && ioSize != NULL);
	
	uBYTE	*p;
	VString	vString;
	uLONG	size;
	VError	error;
	
	if (*ioSize < 12) 
	
		return VE_SRVR_BONJOUR_CANT_FIT_PACKET;
	
	p = outBuffer;
	
	::memset(p, 0, 12);
	Bonjour::Write2Bytes(p, inIdentifier);
	Bonjour::Write2Bytes(p + 4, 1);
	p += 12;
	
	vString = inServiceName;
	vString.AppendString(".local");
	size = *ioSize - 12;
	if ((error = Bonjour::EncodeDNSName(p, &size, vString)) != VE_OK)
		
		return error;
	
	p += size;
	
	if (*ioSize < 12 + size + 4) 
			
		return VE_SRVR_BONJOUR_CANT_FIT_PACKET;
	
	Bonjour::Write2Bytes(p, Bonjour::kTypePTR);
	Bonjour::Write2Bytes(p + 2, 1);

	xbox_assert(*ioSize >=  12 + size + 4);		// Check encoded packet size.
	*ioSize = 12 + size + 4;	
	
	return VE_OK;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:41,代码来源:ServiceDiscovery.cpp

示例6: GetProperties

VString VNetAddress::GetProperties(const VString& inSep) const
{
	VString props;

	xbox_assert(IsV4() || IsV6());
	xbox_assert(!(IsV4() && IsV6()));

#if !VERSIONWIN
	if(!GetName().IsEmpty())
		props.AppendString(GetName()).AppendString(inSep);
#endif
	
	props.AppendCString(IsV4() ? "v4" : "");
	props.AppendCString(IsV6() ? "v6" : "");

	if(IsV4MappedV6())
		props.AppendString(inSep).AppendCString("v4 mapped v6");
	
	if(IsLoopBack())
		props.AppendString(inSep).AppendCString("loopback");
	
	if(IsAny())
		props.AppendString(inSep).AppendCString("any");
	
	if(IsAPIPA())
		props.AppendString(inSep).AppendCString("APIPA");
	
	if(IsULA())
		props.AppendString(inSep).AppendCString("ULA");
	
	if(IsLocal())
		props.AppendString(inSep).AppendCString("Local");
	
	if(IsLocallyAssigned())
		props.AppendString(inSep).AppendCString("LocallyAssigned");

	return props;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:38,代码来源:VNetAddr.cpp

示例7: AppendToCData

void VValueBag::AppendToCData( const VString& inValue)
{
	VValueSingle *val = fAttributes.GetValue( CDataAttributeName());
	if (val != NULL)
	{
		VString *val_str = dynamic_cast<VString*>( val);
		if (val_str)
			val_str->AppendString( inValue);
		else
		{
			VString *temp = new VString;
			if (temp)
			{
				val->GetString( *temp);
				temp->AppendString( inValue);
				fAttributes.Replace( val, temp);
			}
		}
	}
	else
	{
		fAttributes.SetValue( CDataAttributeName(), inValue);
	}
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:24,代码来源:VValueBag.cpp

示例8: 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))
			{
//.........这里部分代码省略.........
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:101,代码来源:VSysLogOutput.cpp

示例9: _SendServiceList

VError VServiceDiscoveryServer::_SendServiceList (VUDPEndPoint *inEndPoint, uBYTE *ioPacket, uLONG inBufferSize, uLONG inOffset)
{
	xbox_assert(inEndPoint != NULL);
	xbox_assert(ioPacket != NULL);
	
	VError									error;
	std::list<VServiceRecord>::iterator		i;
	std::map<VString, bool>					allServices;
	std::map<VString, bool>::iterator		j;
	
	error = VE_OK;

	for (i = fServiceRecords.begin(); i != fServiceRecords.end(); i++)

		allServices[i->fServiceName] = true;
	
	for (j = allServices.begin(); j != allServices.end(); ) {
		
		uBYTE	*p, *q, buffer[Bonjour::kBufferSize];
		uLONG	size, dataSize, numberPTRs;
		VString	serviceName;

		p = &ioPacket[inOffset];
		q = ioPacket + inBufferSize;

		// Try to pack as many PTR resource records as possible in each packet.

		numberPTRs = 0;
		for ( ; j != allServices.end(); j++) {
			
			serviceName = j->first;
			serviceName.AppendString(".");
			
			dataSize = Bonjour::kMaximumNameLength + 1;
			size = q - p;	
			if ((error = Bonjour::EncodeDNSName(buffer, &dataSize, serviceName)) != VE_OK	
			|| (error = Bonjour::EncodeResourceRecord(p, &size, 
													  "_services._dns-sd._udp.local", Bonjour::kTypePTR, 
													  buffer, dataSize, 
													  Bonjour::kDefaultTimeToLive)) != VE_OK) {

				if (error == VE_SRVR_BONJOUR_CANT_FIT_PACKET) 

					break;		// Packet is full, send it.

				else 
										
					continue;	// Silently ignore any other form of error.

			} else {

				p += size;
				numberPTRs++;

			}

		}

		if (numberPTRs) {

			ioPacket[2] |= 0x80;
			Bonjour::Write2Bytes(&ioPacket[6], numberPTRs);
			Bonjour::Write2Bytes(&ioPacket[8], 0);
			Bonjour::Write2Bytes(&ioPacket[10], 0);

			xbox_assert(p - ioPacket <= inBufferSize);
			inEndPoint->WriteExactly(ioPacket, p - ioPacket);

		}
	}
	
	return error;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:73,代码来源:ServiceDiscovery.cpp


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