本文整理汇总了C++中xbox::VString::FromLong方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::FromLong方法的具体用法?C++ VString::FromLong怎么用?C++ VString::FromLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VString
的用法示例。
在下文中一共展示了VString::FromLong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _WriteWLF_ELF
XBOX::VError VHTTPServerLog::_WriteWLF_ELF (const IHTTPResponse& inHTTPResponse)
{
XBOX::VString string;
XBOX::VString ipAddress;
const VectorOfLogToken tokens = fSettings.GetLogTokens();
const EHTTPServerLogFormat format = fSettings.GetLogFormat();
for (VectorOfLogToken::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
{
switch (*it)
{
case LOG_TOKEN_DATE:
string.Clear();
if (format == LOG_FORMAT_ELF)
{
_GetCurrentFormatedDate (string, false);
}
else
{
_GetCurrentFormatedDate (string, true, HTTP_SOLIDUS);
}
if (!string.IsEmpty())
{
fRequestsBuffer.AppendString (string);
}
else
{
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
}
break;
case LOG_TOKEN_TIME:
string.Clear();
if (format == LOG_FORMAT_WLF)
_GetCurrentFormatedTime (string, true);
else
_GetCurrentFormatedTime (string, false);
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_STATUS:
string.FromLong ((sLONG)inHTTPResponse.GetResponseStatusCode());
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_ELF_S_IP:
string.Clear();
HTTPServerTools::MakeIPv4String (inHTTPResponse.GetIPv4(), string);
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_HOST_NAME: // = C_DNS .....
case LOG_TOKEN_ELF_C_DNS: // DNS lookup : tres couteux en perf : remplacé par l'IP du client (les analyseurs de log font le DNS lookup)...
case LOG_TOKEN_ELF_C_IP: // Client IP Address 192.0.1.3
string.Clear();
HTTPServerTools::MakeIPv4String (inHTTPResponse.GetIPv4(), string);
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_METHOD: // The HTTP method : GET HEAD POST. If Unknown, we just copy it
string.Clear();
HTTPProtocol::MakeHTTPMethodString (inHTTPResponse.GetRequest().GetRequestMethod(), string);
fRequestsBuffer.AppendString (string);
break;
case LOG_TOKEN_BYTES_SENT: //WLF : Bytes sent to the client : = HTTP Content Length
string.Clear();
if (inHTTPResponse.GetResponseHeader (STRING_HEADER_CONTENT_LENGTH, string) && !string.IsEmpty())
fRequestsBuffer.AppendString (string);
else
fRequestsBuffer.AppendUniChar (CHAR_DIGIT_ZERO);
break;
case LOG_TOKEN_AGENT: // The identity of the browser software or other client. Mozilla/4.04_(Macintosh;_U;_PPC)
string.Clear();
if (inHTTPResponse.GetRequest().GetHTTPHeaders().GetHeaderValue (STRING_HEADER_USER_AGENT, string) && !string.IsEmpty())
{
string.Exchange (CHAR_SPACE, CHAR_LOW_LINE);
fRequestsBuffer.AppendString (string);
}
else
{
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
}
break;
case LOG_TOKEN_CS_USER_AGENT: // HTTP request's "User-Agent" header field. "Mozilla/4.04 (Macintosh; U; PPC)"
string.Clear();
inHTTPResponse.GetRequest().GetHTTPHeaders().GetHeaderValue (STRING_HEADER_USER_AGENT, string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
break;
case LOG_TOKEN_USER: //The User Name if there was a Web User entry for a realm.
string.Clear();
inHTTPResponse.GetRequest().GetAuthenticationInfos()->GetUserName (string);
_WriteUsername (string, fRequestsBuffer);
break;
//.........这里部分代码省略.........
示例2: _WriteCLF_DLF
XBOX::VError VHTTPServerLog::_WriteCLF_DLF (const IHTTPResponse& inHTTPResponse)
{
XBOX::VString string;
XBOX::VTime time;
// GMT time
time.FromSystemTime();
// Client IP address
HTTPServerTools::MakeIPv4String (inHTTPResponse.GetIPv4(), string);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// RFC931
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// AuthUser
XBOX::VString userName;
inHTTPResponse.GetRequest().GetAuthenticationInfos()->GetUserName (userName);
if (userName.IsEmpty())
fRequestsBuffer.AppendUniChar (CHAR_HYPHEN_MINUS);
else
fRequestsBuffer.AppendString (userName);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// Date & Time
string.Clear();
_MakeDateString (time, string);
fRequestsBuffer.AppendUniChar (CHAR_LEFT_SQUARE_BRACKET);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_RIGHT_SQUARE_BRACKET);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// HTTP Request
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendString (inHTTPResponse.GetRequest().GetRequestLine());
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// HTTP Status
string.Clear();
string.FromLong ((sLONG)inHTTPResponse.GetResponseStatusCode());
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// HTTP Content Length
string.Clear();
if (!inHTTPResponse.GetResponseHeader (STRING_HEADER_CONTENT_LENGTH, string) || string.IsEmpty())
string.FromLong(0);
fRequestsBuffer.AppendString (string);
// We add the last fields for the DLF log format
if (fSettings.GetLogFormat() == LOG_FORMAT_DLF)
{
// HTTP Referrer
string.Clear();
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
inHTTPResponse.GetRequest().GetHTTPHeaders().GetHeaderValue (STRING_HEADER_REFERER, string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendUniChar (CHAR_SPACE);
// HTTP User-Agent
string.Clear();
inHTTPResponse.GetRequest().GetHTTPHeaders().GetHeaderValue (STRING_HEADER_USER_AGENT, string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
fRequestsBuffer.AppendString (string);
fRequestsBuffer.AppendUniChar (CHAR_QUOTATION_MARK);
}
fRequestsBuffer.AppendUniChar (HTTP_LF);
return XBOX::VE_OK;
}