Esempio n. 1
0
bool ZTextCollatorRep_ICU::Contains(const string16& iPattern, const string16& iTarget)
	{
	if (iPattern.empty())
		return true;

	if (iTarget.empty())
		return false;

	return spContains(fCollator, iPattern.data(), iPattern.size(), iTarget.data(), iTarget.size());
	}
Esempio n. 2
0
bool Pickle::WriteString16(const string16& value)
{
    if(!WriteInt(static_cast<int>(value.size())))
    {
        return false;
    }

    return WriteBytes(value.data(),
        static_cast<int>(value.size())*sizeof(char16));
}
Esempio n. 3
0
bool ZTextCollatorRep_ICU::Equals(const string16& iLeft, const string16& iRight)
	{
	if (iLeft.empty())
		return iRight.empty();

	if (iRight.empty())
		return false;

	return UCOL_EQUAL == ::ucol_strcoll(fCollator, iLeft.data(), iLeft.size(),
		iRight.data(), iRight.size());
	}
Esempio n. 4
0
int ZTextCollatorRep_ICU::Compare(const string16& iLeft, const string16& iRight)
	{
	if (iLeft.empty())
		{
		if (iRight.empty())
			return 0;
		return -1;
		}

	if (iRight.empty())
		return 1;

	return ::ucol_strcoll(fCollator, iLeft.data(), iLeft.size(), iRight.data(), iRight.size());
	}
Esempio n. 5
0
string IRI::IRIString() const
{
    if ( !_pureIRI.empty() )
        return _pureIRI;
    
    if ( !_url )
        return string::EmptyString;
    
    // we'll have to reverse-engineer it, grr
    string uri(URIString());
    std::string plainHost(_url->host());
    
    url_canon::RawCanonOutputW<256> idnDecoded;
    const string16 idnSrc = string(plainHost).utf16string();
    if ( url_canon::IDNToUnicode(idnSrc.c_str(), static_cast<int>(idnSrc.size()), &idnDecoded) && idnSrc != idnDecoded.data() )
    {
        // swap out the IDN-encoded hostname
        string::size_type pos = uri.find(plainHost);
        if ( pos != string::npos )
        {
            uri.replace(pos, plainHost.size(), idnDecoded.data());
        }
    }
    
    // have to leave it all url-encoded, sadly...
    return uri;
}
Esempio n. 6
0
string IRI::IDNEncodeHostname(const string& str)
{
    url_canon::RawCanonOutputW<256> output;
    const string16 src = str.utf16string();
    if ( url_canon::IDNToASCII(src.c_str(), static_cast<int>(src.size()), &output) )
        return output.data();
    return string::EmptyString;
}
Esempio n. 7
0
bool MatchPattern(const string16& eval, const string16& pattern) {
	return MatchPatternT(eval.c_str(), eval.c_str() + eval.size(),
		pattern.c_str(), pattern.c_str() + pattern.size(),
		0, NextCharUTF16());
}
Esempio n. 8
0
void sWrite(const string16& iString, const ChanW_UTF& iChanW)
	{
	if (const size_t countCU = iString.size())
		spWriteMust(iString.data(), countCU, iChanW);
	}