本文整理汇总了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;
}
示例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));
}
示例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();
}
示例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;
}
示例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);
}
}