本文整理汇总了C++中xbox::VString类的典型用法代码示例。如果您正苦于以下问题:C++ VString类的具体用法?C++ VString怎么用?C++ VString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsCookieSet
bool VHTTPResponse::IsCookieSet (const VHTTPCookie& inCookie) const
{
XBOX::VectorOfVString cookieValues;
if (GetHeaders().GetHeaderValues (HEADER_SET_COOKIE, cookieValues))
{
XBOX::VString cookieName (inCookie.GetName());
cookieName.AppendUniChar (CHAR_EQUALS_SIGN);
for (XBOX::VectorOfVString::const_iterator it = cookieValues.begin(); it != cookieValues.end(); ++it)
{
XBOX::VectorOfVString multipleCookieValues;
(*it).GetSubStrings (CHAR_SEMICOLON, multipleCookieValues, false, true);
XBOX::VectorOfVString::const_iterator found = std::find_if (multipleCookieValues.begin(), multipleCookieValues.end(), FindVStringFunctor (cookieName));
if (found != multipleCookieValues.end())
{
VHTTPCookie cookie (*found);
if (cookie == inCookie)
return true;
}
}
}
return false;
}
示例2: RemoveContext
void VRemoteDebugPilot::RemoveContext(std::map< OpaqueDebuggerContext, VContextDescriptor* >::iterator& inCtxIt)
{
XBOX::VError err;
XBOX::VString resp;
if (fState != STOPPED_STATE)
{
// ctx could already have been removed by ABORT
if (inCtxIt != fContextArray.end())
{
if ((*inCtxIt).second->fPage)
{
ReleaseRefCountable(&(*inCtxIt).second->fPage);
}
if (fState == CONNECTED_STATE)
{
resp = CVSTR("{\"method\":\"removeContext\",\"contextId\":\"");
resp.AppendLong8((sLONG8)((*inCtxIt).first));
resp += CVSTR("\",\"id\":\"");
resp += fClientId;
resp += CVSTR("\"}");
err = SendToBrowser( resp );
if (err)
{
fWS->Close();
fState = DISCONNECTING_STATE;
}
}
inCtxIt->second->Release();
fContextArray.erase(inCtxIt);
}
}
}
示例3: GetIPv4FromString
void GetIPv4FromString (const XBOX::VString& inIPv4String, IP4& outIPv4)
{
sLONG hostNameSize = inIPv4String.GetLength() + 1;
char * hostName = new char[hostNameSize];
outIPv4 = INADDR_NONE;
if (NULL != hostName)
{
struct hostent * remoteHost = NULL;
struct in_addr addr = {0};
inIPv4String.ToCString (hostName, hostNameSize);
if (isalpha (hostName[0])) // host address is a name
{
remoteHost = gethostbyname (hostName);
}
else
{
addr.s_addr = inet_addr (hostName);
if (addr.s_addr != INADDR_NONE)
remoteHost = gethostbyaddr ((char *) &addr, 4, AF_INET);
}
if (NULL != remoteHost)
outIPv4 = *((sLONG *)remoteHost->h_addr_list[0]);
delete [] hostName;
}
}
示例4: SendContextToBrowser
XBOX::VError VRemoteDebugPilot::SendContextToBrowser(
std::map< OpaqueDebuggerContext,VContextDescriptor* >::iterator& inCtxIt)
{
XBOX::VString resp;
XBOX::VString brkptsStr;
VChromeDebugHandler::GetJSONBreakpoints(brkptsStr);
resp = CVSTR("{\"method\":\"updateContext\",\"contextId\":\"");
resp.AppendLong8((sLONG8)(*inCtxIt).first);
resp += CVSTR("\",\"debugLineNb\":");
resp.AppendLong((*inCtxIt).second->fDebugInfos.fLineNb);
resp += CVSTR(",\"debugFileName\":\"");
resp += (*inCtxIt).second->fDebugInfos.fFileName;
resp += CVSTR("\",\"debugReason\":\"");
resp += (*inCtxIt).second->fDebugInfos.fReason;
resp += CVSTR("\",\"debugComment\":\"");
resp += (*inCtxIt).second->fDebugInfos.fComment;
resp += CVSTR("\",\"sourceLine\":\"");
resp += (*inCtxIt).second->fDebugInfos.fSourceLine;
resp += CVSTR("\",\"id\":\"");
resp += fClientId;
resp += "\",\"breakpoints\":";
resp += brkptsStr;
resp += CVSTR("}");
return SendToBrowser( resp );
}
示例5: name
IHTTPRequestHandler *VHTTPServerProject::RetainMatchingHTTPRequestHandler (const XBOX::VString& inURL)
{
IHTTPRequestHandler *resultHandler = NULL;
XBOX::VTaskLock lock (&fRegexCacheLock);
XBOX::VString urlString (inURL);
/*
// URL Start with project pattern ?
if (!fSettings->GetProjectPattern().IsEmpty())
{
sLONG pos = HTTPServerTools::FindASCIIVString (urlString, fSettings->GetProjectPattern());
if (pos == 2) // Takes the starting CHAR_SOLIDUS into account
inURL.GetSubString (pos + fSettings->GetProjectPattern().GetLength(), inURL.GetLength() - fSettings->GetProjectPattern().GetLength() - 1, urlString);
}
*/
resultHandler = RetainProcessingHandler<IHTTPRequestHandler> (fRegexCache, urlString, false);
/* YT 18-Jan-2012 - ACI0075015, ACI0074936 & ACI0074300
When no requestHandler match and the URL ends by SOLIDUS '/', try to find a requestHandler matching the URL +
the index page name (typically for 4D: /index.shtml have to be handled by a specific requestHandler)
*/
if ((NULL == resultHandler) && (urlString.GetUniChar (urlString.GetLength()) == CHAR_SOLIDUS))
{
urlString.AppendString (fSettings->GetIndexPageName());
resultHandler = RetainProcessingHandler<IHTTPRequestHandler> (fRegexCache, urlString, false);
}
return resultHandler;
}
示例6: Require
XBOX::VJSObject VJSGlobalObject::Require (XBOX::VJSContext inContext, const XBOX::VString &inClassName)
{
XBOX::VJSObject object(inContext, NULL);
VJSGlobalObject::SObjectMap::iterator it;
if ((it = fRequireMap.find(inClassName)) != fRequireMap.end()) {
xbox_assert(it->second != NULL);
object.SetObjectRef(it->second);
} else {
if (inClassName.EqualToString("net", true)) {
VJSNetClass::Class();
object = VJSNetClass::CreateInstance(inContext, NULL);
} else if (inClassName.EqualToString("tls", true)) {
VJSTLSClass::Class();
object = VJSTLSClass::CreateInstance(inContext, NULL);
}
if (object.GetObjectRef() != NULL)
fRequireMap[inClassName] = object.GetObjectRef();
}
return object;
}
示例7: 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);
}
}
}
}
示例8: GetLongFromString
sLONG GetLongFromString (const XBOX::VString& inString)
{
bool isneg = false;
XBOX::VIndex sepPos = HTTPServerTools::FindASCIIVString (inString, XBOX::VIntlMgr::GetDefaultMgr()->GetDecimalSeparator());
if (sepPos <= 0)
sepPos = inString.GetLength();
const UniChar* bb = inString.GetCPointer();
sLONG result = 0;
for (XBOX::VIndex i = 0; i < sepPos; ++i)
{
if ((0 == result) && (bb[i] == CHAR_HYPHEN_MINUS))
isneg = true;
if ((bb[i] < CHAR_DIGIT_ZERO) || (bb[i] > CHAR_DIGIT_NINE))
continue;
result *= 10;
result += bb[i] - CHAR_DIGIT_ZERO;
}
if (isneg)
result = -result;
return result;
}
示例9: SetUserInfos
bool HttpRequest::SetUserInfos(const XBOX::VString& inUser, const XBOX::VString& inPasswd, bool inAllowBasic)
{
if(!fHandle)
return false;
XBOX::VString userInfos;
userInfos.AppendString(inUser).AppendCString(":").AppendString(inPasswd);
int maxlen=2*userInfos.GetLength()+1; //We convert utf16 to utf8, it should be large enough.
char* buf=new char[maxlen];
if(!buf)
return false;
int len=userInfos.ToBlock(buf, maxlen, XBOX::VTC_UTF_8, true, false);
curl_easy_setopt(fHandle, CURLOPT_USERPWD, buf);
delete buf;
if(inAllowBasic)
curl_easy_setopt(fHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC|CURLAUTH_DIGEST);
else
curl_easy_setopt(fHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
return true;
}
示例10: EndsWithASCIICString
bool EndsWithASCIICString (const XBOX::VString& inText, const char *inPattern, bool isCaseSensitive)
{
sLONG textSize = inText.GetLength();
sLONG patternSize = (sLONG)strlen (inPattern);
return (_FindASCIICString (inText.GetCPointer() + (textSize - patternSize), textSize, inPattern, patternSize, isCaseSensitive) == 1);
}
示例11: _SetProperty
bool VJSStorageClass::_SetProperty (XBOX::VJSParms_setProperty &ioParms, VJSStorageObject *inStorageObject)
{
xbox_assert(inStorageObject != NULL);
XBOX::VString name;
if (!ioParms.GetPropertyName(name))
return true;
if (name.EqualToUSASCIICString("length"))
return true;
sLONG i;
for (i = 0; i < kNumberMethods; i++)
{
if (name.EqualToUSASCIICString(kMethodNames[i]))
return true;
}
inStorageObject->SetKeyValue(name, ioParms.GetPropertyValue());
return true;
}
示例12: _HasProperty
void VJSStorageClass::_HasProperty (XBOX::VJSParms_hasProperty &ioParms, VJSStorageObject *inStorageObject)
{
xbox_assert(inStorageObject != NULL);
XBOX::VString name;
if (!ioParms.GetPropertyName(name))
ioParms.ReturnFalse();
else {
if (inStorageObject->HasKey(name)
|| name.EqualToUSASCIICString("length"))
ioParms.ReturnTrue();
else {
sLONG i;
for (i = 0; i < kNumberMethods; i++)
if (name.EqualToUSASCIICString(kMethodNames[i]))
ioParms.ReturnTrue();
ioParms.ReturnFalse();
}
}
}
示例13: _FormatCurrentVTaskInfos
void VCacheLog::_FormatCurrentVTaskInfos(bool inForTags)
{
XBOX::VString taskName;
char nameCStr[256] = {0};
VTask *currentTask = VTask::GetCurrent();
currentTask->GetName(taskName);
taskName.ToCString(nameCStr, 256);
sLONG pNum = 0;
if(currentTask->GetKind() == '4dut')
pNum = (sLONG) currentTask->GetKindData();
/********* WARNING **********
fVTaskInfos is char[512]. If you add more infos, think about increasing its size
*/
fVTaskInfos[0] = 0;
if(inForTags)
{
sprintf(fVTaskInfos, "tname=\"%s\" pnum=\"%d\"", nameCStr, pNum);
}
else
{
sprintf(fVTaskInfos, "%s\t%d", nameCStr, pNum);
}
}
示例14: GetSubString
void GetSubString (const XBOX::VString& inString, sLONG inFirst, sLONG inLast, XBOX::VString& outString)
{
if (testAssert ((inFirst >= 0) && (inLast < inString.GetLength())))
outString.FromBlock (inString.GetCPointer() + inFirst, (inLast - inFirst + 1) * sizeof(UniChar), XBOX::VTC_UTF_16);
else
outString.Clear();
}
示例15: EnumFamScreenCallBackEx
BOOL CALLBACK XWinFontMgr::EnumFamScreenCallBackEx(ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* /*lpntm*/, int FontType,LPVOID pThis)
{
XBOX::VString fontName;
fontName.FromCString((const char*)(pelf->elfFullName));
((XWinFontMgr *)pThis)->AddFont(fontName);
return 1;
}