コード例 #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());
	}
コード例 #2
0
ファイル: pickle.cpp プロジェクト: noodle1983/putty-nd3.x
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));
}
コード例 #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());
	}
コード例 #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());
	}
コード例 #5
0
ファイル: iri.cpp プロジェクト: HoTaeWang/readium-sdk
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;
}
コード例 #6
0
ファイル: iri.cpp プロジェクト: aironik/readium-sdk
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;
}
コード例 #7
0
ファイル: string_util.cpp プロジェクト: 623442733/cef
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());
}
コード例 #8
0
void sWrite(const string16& iString, const ChanW_UTF& iChanW)
	{
	if (const size_t countCU = iString.size())
		spWriteMust(iString.data(), countCU, iChanW);
	}