本文整理汇总了C++中xbox::VString::SubString方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::SubString方法的具体用法?C++ VString::SubString怎么用?C++ VString::SubString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VString
的用法示例。
在下文中一共展示了VString::SubString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrimUniChar
void TrimUniChar (XBOX::VString& ioString, const UniChar inCharToTrim)
{
if (ioString.GetLength() > 0)
{
sLONG length = ioString.GetLength();
UniChar * data = (UniChar *)ioString.GetCPointer();
XBOX::VIndex leadingChars = 0;
XBOX::VIndex endingChars = 0;
for (UniChar *p = data, *end = (data + length); (p != end) && (*p == inCharToTrim); p++, leadingChars++);
for (UniChar *p = (data + length - 1), *start = (data - 1); (p != start) && (*p == inCharToTrim); p--, endingChars++);
if ((0 != leadingChars) || (0 != endingChars))
{
if ((leadingChars + endingChars) >= length)
{
ioString.Clear();
}
else
{
ioString.SubString (leadingChars + 1, length - leadingChars - endingChars);
}
}
}
}
示例2: _WriteWLF_ELF
//.........这里部分代码省略.........
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
break;
case LOG_TOKEN_SEARCH_ARGS: // The search arguments to the URL (text after a question mark)
string.FromString (inHTTPResponse.GetRequest().GetURLQuery());
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_ELF_CS_URI_QUERY: // Search argument portion of the HTTP request. "first=last&last=first"
string.FromString (inHTTPResponse.GetRequest().GetURLQuery());
if (!string.IsEmpty())
fRequestsBuffer.AppendString (string);
else
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
break;
case LOG_TOKEN_CONNECTION_ID: // A number that is unique for each connection for this invocation of the server. Typically socket number.
{
sLONG rawSocket = inHTTPResponse.GetRawSocket();
if (rawSocket > 0)
{
fRequestsBuffer.AppendLong (rawSocket);
}
else
{
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
}
break;
}
case LOG_TOKEN_ELF_CS_COOKIE: // The "cookie" information sent in this request "Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 20-Jan-05 23:12:40 GMT"
string.Clear();
inHTTPResponse.GetRequest().GetHTTPHeaders().GetHeaderValue (STRING_HEADER_COOKIE, string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
break;
case LOG_TOKEN_TRANSFER_TIME: // Time-Taken in millisecond like IIS
{
uLONG timeTaken = (XBOX::VSystem::GetCurrentTime() - inHTTPResponse.GetStartRequestTime());
fRequestsBuffer.AppendLong (timeTaken);
break;
}
case LOG_TOKEN_WLF_BYTES_RECEIVED:
{
sLONG8 bytesReceived = inHTTPResponse.GetRequest().GetRequestBody().GetDataSize();
if (bytesReceived > 0)
{
fRequestsBuffer.AppendLong8 (bytesReceived);
}
else
{
fRequestsBuffer.AppendUniChar (CHAR_DIGIT_ZERO);
}
break;
}
case LOG_TOKEN_PATH_ARGS: //The path arguments to the URL for a CGI (the text after a dollar sign)
{
sLONG posChar = 0;
XBOX::VString pathArgString;
string.FromString (inHTTPResponse.GetRequest().GetURL());
if (!string.IsEmpty() && (posChar = string.FindUniChar (CHAR_DOLLAR_SIGN)) > 0)
{
// Let's delete all the stuff before '$'
string.GetSubString (posChar + 1, string.GetLength() - posChar, pathArgString);
// We delete the query arguments after the ? : we only want the string after the '$'
if ((posChar = pathArgString.FindUniChar (CHAR_QUESTION_MARK)) > 0)
pathArgString.SubString (1, posChar - 1);
}
if (!pathArgString.IsEmpty())
{
fRequestsBuffer.AppendString (pathArgString);
}
else
{
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
}
break;
}
default: // this should never happen.
assert (false);
fRequestsBuffer.AppendCString ("UNKNOWN_FIELD");
break;
}
VectorOfLogToken::const_iterator nextToken = it;
if (++nextToken != tokens.end())
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
}
fRequestsBuffer.AppendUniChar (HTTP_LF);
return XBOX::VE_OK;
}