示例#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
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());
	}
示例#3
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());
	}
示例#4
0
文件: rtl.cpp 项目: sharperM/UI
    bool AdjustStringForLocaleDirection(const string16& text,
        string16* localized_text)
    {
        if(!IsRTL() || text.empty())
        {
            return false;
        }

        // TODO: 根据IsRTL()实际值进行处理.
        *localized_text = text;
        return true;
    }
示例#5
0
ZQ<Val> KeyRef::QGet(const string16& iName) const
	{
	if (iName.empty())
		return null;

	if (iName[0] != '!')
		{
		KeyRef subKey;
		if (ERROR_SUCCESS == ::RegOpenKeyExW(
			*this,
			iName.c_str(),
			0, // ulOptions
			KEY_ALL_ACCESS,
			&subKey.OParam()))
			{ return subKey; }
		else if (ERROR_SUCCESS == ::RegOpenKeyExW(
			*this,
			iName.c_str(),
			0, // ulOptions
			KEY_READ,
			&subKey.OParam()))
			{ return subKey; }
		return null;
		}

	DWORD curLength = 1024;
	for (;;)
		{
		DWORD type;
		vector<BYTE> bufferVec(curLength);
		DWORD length = curLength;
		LONG result = ::RegQueryValueExW(
			*this,
			&iName.c_str()[1],
			nullptr, // lpReserved
			&type,
			&bufferVec[0],
			&length);

		if (ERROR_SUCCESS == result)
			return spQGet(type, &bufferVec[0], length);

		if (ERROR_MORE_DATA == result)
			{
			// If we're hitting HKEY_PERFORMANCE_DATA then the value of length is not
			// useful, the next call may need more space. So we just double curLength.
			curLength *= 2;
			continue;
			}

		return null;
		}
	}