本文整理汇总了C++中xbox::VString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::IsEmpty方法的具体用法?C++ VString::IsEmpty怎么用?C++ VString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VString
的用法示例。
在下文中一共展示了VString::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ExtractHeaderValuePair
bool _ExtractHeaderValuePair (const char *inStartLinePtr, const char *inEndLinePtr, XBOX::VString& outHeader, XBOX::VString& outValue)
{
if (NULL == inStartLinePtr)
return false;
const char *colonPtr = strchr (inStartLinePtr, ':');
if (NULL != colonPtr)
{
outHeader.FromBlock (inStartLinePtr, colonPtr - inStartLinePtr, XBOX::VTC_DefaultTextExport);
if (!outHeader.IsEmpty())
{
++colonPtr; // skip colon
while (isspace (*colonPtr))
++colonPtr;
outValue.FromBlock (colonPtr, (inEndLinePtr - colonPtr), XBOX::VTC_DefaultTextExport);
if (((inEndLinePtr - colonPtr) > 0) && outValue.IsEmpty()) // YT 01-Feb-2012 - ACI0075472 - Something was going wrong at conversion... Let's try in UTF-8
outValue.FromBlock (colonPtr, (inEndLinePtr - colonPtr), XBOX::VTC_UTF_8);
}
return !(outHeader.IsEmpty());
}
return false;
}
示例2: BuildFolderPath
static
void BuildFolderPath (const XBOX::VFilePath& inBaseFolder, const XBOX::VString& inPath, XBOX::VFilePath& outPath)
{
if (inPath.IsEmpty())
{
outPath.FromFilePath (inBaseFolder);
}
else
{
XBOX::VString pathString (inPath);
if ((pathString[0] == CHAR_SOLIDUS) // POSIX Path ?
#if VERSIONWIN
|| ((pathString.GetLength() > 2) && (pathString[1] == CHAR_COLON) && (pathString[2] == CHAR_SOLIDUS)) // POSIX path like c:/blahblah/
#endif
)
{
if (!pathString.IsEmpty() && (pathString[pathString.GetLength()-1] != CHAR_SOLIDUS))
pathString.AppendUniChar (CHAR_SOLIDUS);
outPath.FromFullPath (pathString, XBOX::FPS_POSIX);
}
else if ((pathString[0] != CHAR_FULL_STOP) && (pathString.FindUniChar (XBOX::FOLDER_SEPARATOR) > 0))
{
if (!pathString.IsEmpty() && (pathString[pathString.GetLength()-1] != XBOX::FOLDER_SEPARATOR))
pathString.AppendUniChar (XBOX::FOLDER_SEPARATOR);
outPath.FromFullPath (pathString, XBOX::FPS_SYSTEM);
}
else
{
XBOX::VFilePath baseFolder (inBaseFolder);
if ((pathString[0] == CHAR_FULL_STOP) && (pathString[1] == CHAR_SOLIDUS))
pathString.Remove (1, 2);
while ((pathString[0] == CHAR_FULL_STOP) && (pathString[1] == CHAR_FULL_STOP) && (pathString[2] == CHAR_SOLIDUS))
{
pathString.Remove (1, 3);
baseFolder = baseFolder.ToParent();
}
pathString.ExchangeAll (CHAR_SOLIDUS, XBOX::FOLDER_SEPARATOR);
if (!pathString.IsEmpty() && (pathString[pathString.GetLength()-1] != XBOX::FOLDER_SEPARATOR))
pathString.AppendUniChar (XBOX::FOLDER_SEPARATOR);
outPath.FromRelativePath (baseFolder, pathString);
}
}
}
示例3: _WriteUsername
void VHTTPServerLog::_WriteUsername (const XBOX::VString& inUserName, XBOX::VString& ioStream)
{
if (!inUserName.IsEmpty())
{
bool wasCtrl = false;
XBOX::VString userName;
for (XBOX::VIndex pos = 0; pos < inUserName.GetLength(); ++pos)
{
// When user name contains CHAR_SPACE, replace it by CHAR_LOW_LINE '_'
if ((inUserName[pos] <= CHAR_SPACE) && (inUserName[pos] > 0))
{
if (!wasCtrl)
userName.AppendUniChar (CHAR_LOW_LINE);
wasCtrl = (inUserName[pos] != CHAR_SPACE);
}
else
{
userName.AppendUniChar (inUserName[pos]);
wasCtrl = false;
}
}
ioStream.AppendString (userName);
}
else
{
ioStream.AppendUniChar (CHAR_HYPHEN_MINUS);
}
}
示例4: SetRequestHeader
bool HttpRequest::SetRequestHeader(const XBOX::VString& inKey, const XBOX::VString& inValue)
{
if(!fHandle || inKey.IsEmpty())
return false;
fReqHdrs.SetHeader(inKey, inValue);
return true;
}
示例5: AddVirtualFolder
XBOX::VError VHTTPServerProject::AddVirtualFolder (const XBOX::VString& inLocationPath, const XBOX::VString& inIndexFileName, const XBOX::VString& inMatchingKeyWord)
{
if (inLocationPath.IsEmpty() || inMatchingKeyWord.IsEmpty())
return XBOX::VE_INVALID_PARAMETER;
XBOX::VError error = XBOX::VE_MEMORY_FULL;
VVirtualFolder * virtualFolder = fHTTPServer->RetainVirtualFolder (inLocationPath, inIndexFileName, inMatchingKeyWord);
if (NULL!= virtualFolder)
{
XBOX::VTaskLock lock (&fVirtualHostsLock);
error = XBOX::VE_OK;
if (fVirtualHosts.empty())
{
// sc 16/02/2012 create a virtual host if needed
VVirtualHost *virtualHost = new VVirtualHost (this);
if (testAssert(virtualHost != NULL))
{
fVirtualHosts.push_back (virtualHost);
error = fHTTPServer->AddVirtualHost (virtualHost);
}
else
{
error = XBOX::VE_MEMORY_FULL;
}
}
if (error == XBOX::VE_OK)
{
for (std::vector<VVirtualHost *>::const_iterator it = fVirtualHosts.begin(); (it != fVirtualHosts.end()) && (error == XBOX::VE_OK); ++it)
{
error = (*it)->AddVirtualFolder (virtualFolder);
}
}
XBOX::ReleaseRefCountable (&virtualFolder);
}
return error;
}
示例6: AddVirtualHost
XBOX::VError VVirtualHostManager::AddVirtualHost (const VVirtualHost *inVirtualHost)
{
XBOX::VError error = XBOX::VE_INVALID_PARAMETER;
if (NULL != inVirtualHost)
{
XBOX::VString pattern;
VVirtualHost * virtualHost = const_cast<VVirtualHost *>(inVirtualHost);
pattern.FromString (virtualHost->GetHostPattern());
if (!pattern.IsEmpty())
{
/* Severals project can use the same hostPattern but they can NOT have the same projectPattern */
error = _AddVirtualHost (fHostPatternsMap, virtualHost, pattern);
}
#if HTTP_SERVER_USE_PROJECT_PATTERNS
pattern.FromString (virtualHost->GetURLPattern());
if (!pattern.IsEmpty())
{
if (!_VirtualHostAlreadyExist (fURLPatternsMap, pattern))
{
error = _AddVirtualHost (fURLPatternsMap, virtualHost, pattern);
}
else
{
error = VE_HTTP_SERVER_VIRTUAL_HOST_ALREADY_EXIST;
}
}
#endif
if (error == VE_OK)
{
fVirtualHosts.push_back (virtualHost);
}
}
return error;
}
示例7: SetHTTPResponseString
USING_TOOLBOX_NAMESPACE
VError SetHTTPResponseString( IHTTPResponse* inResponse, const VString& inString, const VString* inContentType)
{
if (inResponse == NULL)
return VE_INVALID_PARAMETER;
StStringConverter<char> buffer( inString, VTC_UTF_8);
inResponse->GetResponseBody().OpenWriting();
inResponse->GetResponseBody().PutData( buffer.GetCPointer(), buffer.GetLength());
inResponse->GetResponseBody().CloseWriting();
VError err = inResponse->GetResponseBody().GetLastError();
if (err == VE_OK)
{
inResponse->SetExpiresHeader( GMT_NOW);
inResponse->AddResponseHeader( HEADER_PRAGMA, CVSTR ("no-cache"));
if (inContentType != NULL)
{
inResponse->AddResponseHeader( HEADER_CONTENT_TYPE, *inContentType);
}
/* We send a String encoded using UTF-8, so set the correct header value */
XBOX::CharSet charSet = XBOX::VTC_UNKNOWN;
XBOX::VString contentType;
inResponse->GetContentTypeHeader (contentType, &charSet);
if (contentType.IsEmpty() || charSet != VTC_UTF_8)
{
inResponse->SetContentTypeHeader (contentType.IsEmpty() ? CVSTR ("text/html"): contentType, VTC_UTF_8);
}
#if HTTP_SERVER_VERBOSE_MODE
inResponse->AddResponseHeader( HEADER_X_POWERED_BY, "RIA Server");
#endif
inResponse->SetContentLengthHeader( buffer.GetLength());
inResponse->AllowCompression (false);
}
return err;
}
示例8: MakeHostString
void MakeHostString (const XBOX::VString& inHost, PortNumber inPort, XBOX::VString& outHostString)
{
outHostString.Clear();
if (!inHost.IsEmpty())
outHostString.AppendString (inHost);
if (inPort != DEFAULT_LISTENING_PORT)
{
outHostString.AppendUniChar (CHAR_COLON);
outHostString.AppendLong (inPort);
}
}
示例9: _UpdateRequestURL
bool VHTTPResponse::_UpdateRequestURL (const XBOX::VString& inProjectPattern)
{
// URL Start with project pattern ?
if (!inProjectPattern.IsEmpty())
{
_RemoveProjectPatternFromURL (inProjectPattern, fRequest->fURL);
_RemoveProjectPatternFromURL (inProjectPattern, fRequest->fURLPath);
_RemoveProjectPatternFromURL (inProjectPattern, fRequest->fRawURL);
return true;
}
return false;
}
示例10: _VirtualHostAlreadyExist
bool VVirtualHostManager::_VirtualHostAlreadyExist (const VVirtualHostMap& inMap, const XBOX::VString& inPattern)
{
if (inPattern.IsEmpty())
return false;
VVirtualHost * matchingHost = NULL;
XBOX::VTaskLock lock (&fLock);
VVirtualHostMap::const_iterator it = std::find_if (inMap.begin(), inMap.end(), EqualVRegexMatcherFunctor<VVirtualHostRefPtr> (inPattern));
if (it != inMap.end())
matchingHost = it->second;
return (NULL != matchingHost);
}
示例11: _RemoveProjectPatternFromURL
static
bool _RemoveProjectPatternFromURL (const XBOX::VString& inProjectPattern, XBOX::VString& ioURL)
{
if (inProjectPattern.IsEmpty())
return false;
XBOX::VString url (ioURL);
sLONG pos = HTTPServerTools::FindASCIIVString (url, inProjectPattern);
if (pos == 2) // Takes the starting CHAR_SOLIDUS into account
{
url.GetSubString (pos + inProjectPattern.GetLength(), url.GetLength() - inProjectPattern.GetLength() - 1, ioURL);
return true;
}
return false;;
}
示例12: fMIMEMessage
BEGIN_TOOLBOX_NAMESPACE
USING_TOOLBOX_NAMESPACE
VMIMEWriter::VMIMEWriter (const XBOX::VString& inBoundary)
: fMIMEMessage()
{
if (inBoundary.IsEmpty())
{
XBOX::VUUID uuid (true);
uuid.GetString (fMIMEMessage.fBoundary);
}
else
{
fMIMEMessage.fBoundary.FromString (inBoundary);
}
}
示例13: _BuildRegexMatcher
XBOX::VError VHTTPServerProject::_BuildRegexMatcher (const XBOX::VString& inPatternString, XBOX::VRegexMatcher **outMatcher)
{
if (NULL == outMatcher)
return XBOX::VE_INVALID_PARAMETER;
XBOX::VString patternString (inPatternString);
XBOX::VError error = XBOX::VE_OK;
sLONG pos = 0;
if (!HTTPServerTools::BeginsWithASCIICString (patternString.GetCPointer(), "(?i)"))
patternString.Insert (CVSTR ("(?i)"), 1);
if (HTTPServerTools::EndsWithASCIICString (patternString, "/") &&
!HTTPServerTools::EndsWithASCIICString (patternString, "$"))
patternString.AppendString (CVSTR (".*"));
XBOX::VString string;
if ((pos = patternString.FindUniChar (CHAR_CIRCUMFLEX_ACCENT)) == 0)
{
string.FromCString ("^");
pos = HTTPServerTools::FindASCIICString (patternString, "(?i)") + 4;
}
else
{
++pos;
}
#if HTTP_SERVER_USE_PROJECT_PATTERNS
if (!fSettings->GetProjectPattern().IsEmpty())
{
string.AppendCString ("(/");
string.AppendString (fSettings->GetProjectPattern());
string.AppendCString ("|)");
}
#endif
patternString.Insert (string, pos);
if (!patternString.IsEmpty())
*outMatcher = XBOX::VRegexMatcher::Create (patternString, &error);
return error;
}
示例14: _ReadUrl
void VMIMEMessage::_ReadUrl (const XBOX::VString& inString)
{
if (!inString.IsEmpty())
{
const UniChar *stringPtr = inString.GetCPointer();
UniChar ch = *stringPtr;
while (ch != '\0')
{
XBOX::VString name;
XBOX::VString value;
while (ch != '\0' && ch != CHAR_EQUALS_SIGN && ch != CHAR_AMPERSAND)
{
if (ch == CHAR_PLUS_SIGN) ch = CHAR_SPACE;
name.AppendUniChar (ch);
ch = *(++stringPtr);
}
if (ch == CHAR_EQUALS_SIGN)
{
ch = *(++stringPtr);
while (ch != '\0' && ch != CHAR_AMPERSAND)
{
if (ch == CHAR_PLUS_SIGN) ch = CHAR_SPACE;
value.AppendUniChar (ch);
ch = *(++stringPtr);
}
}
XBOX::VString decodedName (name);
XBOX::VString decodedValue (value);
XBOX::VURL::Decode (decodedName);
XBOX::VURL::Decode (decodedValue);
XBOX::StStringConverter<char> buffer (decodedValue, XBOX::VTC_UTF_8);
_AddValuePair (decodedName, CONST_TEXT_PLAIN_UTF_8, (void *)buffer.GetCPointer(), buffer.GetLength());
if (ch == CHAR_AMPERSAND) ch = *(++stringPtr);
}
}
}
示例15: LogComment
void VCacheLog::LogComment( const XBOX::VString& inComment )
{
if(!inComment.IsEmpty())
{
if (fLogFile != NULL)
{
VTaskLock lock(&s_mutex);
if (fLogFile != NULL)
{
_UpdateStartFlag(true);
_AddEntry(eCLEntryKind_Comment);
_UpdateStartFlag(false);
fLogFile->AppendFormattedString("\r%s\r", fConverter.ConvertString(inComment));
_AddEntryEnd(eCLEntryKind_Comment, true);
}
}
}
}