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


C++ RakString::Clear方法代码示例

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


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

示例1: SplitURI

void RakString::SplitURI(RakNet::RakString &header, RakNet::RakString &domain, RakNet::RakString &path)
{
	header.Clear();
	domain.Clear();
	path.Clear();

	size_t strLen = strlen(sharedString->c_str);

	char c;
	unsigned int i=0;
	if (strncmp(sharedString->c_str, "http://", 7)==0)
		i+=(unsigned int) strlen("http://");
	else if (strncmp(sharedString->c_str, "https://", 8)==0)
		i+=(unsigned int) strlen("https://");
	
	if (strncmp(sharedString->c_str, "www.", 4)==0)
		i+=(unsigned int) strlen("www.");

	if (i!=0)
	{
		header.Allocate(i+1);
		strncpy(header.sharedString->c_str, sharedString->c_str, i);
		header.sharedString->c_str[i]=0;
	}


	domain.Allocate(strLen-i+1);
	char *domainOutput=domain.sharedString->c_str;
	unsigned int outputIndex=0;
	for (; i < strLen; i++)
	{
		c=sharedString->c_str[i];
		if (c=='/')
		{
			break;
		}
		else
		{
			domainOutput[outputIndex++]=sharedString->c_str[i];
		}
	}

	domainOutput[outputIndex]=0;

	path.Allocate(strLen-header.GetLength()-outputIndex+1);
	outputIndex=0;
	char *pathOutput=path.sharedString->c_str;
	for (; i < strLen; i++)
	{
		pathOutput[outputIndex++]=sharedString->c_str[i];
	}
	pathOutput[outputIndex]=0;
}
开发者ID:Napoleon314,项目名称:Venus2D,代码行数:53,代码来源:RakString.cpp

示例2: ReadLine

void Rackspace::ReadLine(const char *data, const char *stringStart, RakNet::RakString &output)
{
	output.Clear();

	char *result, *resultEnd;

	result=strstr((char*) data, stringStart);
	if (result==0)
	{
		RakAssert(0);
		return;
	}

	result+=strlen(stringStart);
	if (result==0)
	{
		RakAssert(0);
		return;
	}

	output=result;
	resultEnd=result;
	while (*resultEnd && (*resultEnd!='\r') && (*resultEnd!='\n') )
		resultEnd++;
	output.Truncate((unsigned int) (resultEnd-result));
}
开发者ID:120pulsations,项目名称:RakNet,代码行数:26,代码来源:Rackspace.cpp

示例3:

void RoomsBrowserGFx3_RakNet::LoadProperty(const char *propertyId, RakNet::RakString &propertyOut)
{
	XMLNode xMainNode=XMLNode::openFileHelper(pathToXMLPropertyFile.C_String(),"");
	if (xMainNode.isEmpty())
		return;
	XMLNode xNode=xMainNode.getChildNode(propertyId);
	LPCTSTR attr = xNode.getAttribute("value", 0);
	if (attr)
		propertyOut = attr;
	else
		propertyOut.Clear();
}
开发者ID:dream7w,项目名称:ZRKServer,代码行数:12,代码来源:RoomsBrowserGFx3_RakNet.cpp

示例4: ReadResult

ReadResultEnum ReadResult(RakNet::RakString &httpResult)
{
	RakNet::TimeMS endTime=RakNet::GetTimeMS()+10000;
	httpResult.Clear();
	while (RakNet::GetTimeMS()<endTime)
	{
		Packet *packet = tcp->Receive();
		if(packet)
		{
			httpConnection->ProcessTCPPacket(packet);
			tcp->DeallocatePacket(packet);
		}

		if (httpConnection->HasRead())
		{
			httpResult = httpConnection->Read();
			// Good response, let the PHPDirectoryServer2 class handle the data
			// If resultCode is not an empty string, then we got something other than a table
			// (such as delete row success notification, or the message is for HTTP only and not for this class).
			HTTPReadResult readResult = phpDirectoryServer2->ProcessHTTPRead(httpResult);

			if (readResult==HTTP_RESULT_GOT_TABLE)
			{
				//printf("RR_READ_TABLE\n");
				return RR_READ_TABLE;
			}
			else if (readResult==HTTP_RESULT_EMPTY)
			{
				//printf("HTTP_RESULT_EMPTY\n");
				return RR_EMPTY_TABLE;
			}
		}

		// Update our two classes so they can do time-based updates
		httpConnection->Update();
		phpDirectoryServer2->Update();

		// Prevent 100% cpu usage
		RakSleep(30);
	}

	return RR_TIMEOUT;
}
开发者ID:dream7w,项目名称:ZRKServer,代码行数:43,代码来源:main.cpp

示例5:

void NatPunchthroughServer::User::LogConnectionAttempts(RakNet::RakString &rs)
{
	rs.Clear();
	unsigned int index;
	char guidStr[128], ipStr[128];
	guid.ToString(guidStr);
	systemAddress.ToString(true,ipStr);
	rs=RakNet::RakString("User systemAddress=%s guid=%s\n", ipStr, guidStr);
	rs+=RakNet::RakString("%i attempts in list:\n", connectionAttempts.Size());
	for (index=0; index < connectionAttempts.Size(); index++)
	{
		rs+=RakNet::RakString("%i. SessionID=%i ", index+1, connectionAttempts[index]->sessionId);
		if (connectionAttempts[index]->sender==this)
			rs+="(We are sender) ";
		else
			rs+="(We are recipient) ";
		if (isReady)
			rs+="(READY TO START) ";
		else
			rs+="(NOT READY TO START) ";
		if (connectionAttempts[index]->attemptPhase==NatPunchthroughServer::ConnectionAttempt::NAT_ATTEMPT_PHASE_NOT_STARTED)
			rs+="(NOT_STARTED). ";
		else
			rs+="(GETTING_RECENT_PORTS). ";
		if (connectionAttempts[index]->sender==this)
		{
			connectionAttempts[index]->recipient->guid.ToString(guidStr);
			connectionAttempts[index]->recipient->systemAddress.ToString(true,ipStr);
		}
		else
		{
			connectionAttempts[index]->sender->guid.ToString(guidStr);
			connectionAttempts[index]->sender->systemAddress.ToString(true,ipStr);
		}

		rs+=RakNet::RakString("Target systemAddress=%s, guid=%s.\n", ipStr, guidStr);
	}
}
开发者ID:Aasagi,项目名称:DICEProgrammingChallenge,代码行数:38,代码来源:NatPunchthroughServer.cpp


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