コード例 #1
0
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
0
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();
}
コード例 #3
0
    XBOX::VString VStringFromAsciiStdString(const std::string inStr)
    {
        const char* ptr=inStr.c_str();
        int len=inStr.length();

        XBOX::VString outStr;

        outStr.FromBlock(ptr, len, XBOX::VTC_US_ASCII);

        return outStr;
    }