Esempio n. 1
0
TEST(StringTest, Ensure16Bit) {
  String string8("8bit");
  EXPECT_TRUE(string8.is8Bit());
  string8.ensure16Bit();
  EXPECT_FALSE(string8.is8Bit());
  EXPECT_EQ("8bit", string8);

  String string16(reinterpret_cast<const UChar*>(u"16bit"));
  EXPECT_FALSE(string16.is8Bit());
  string16.ensure16Bit();
  EXPECT_FALSE(string16.is8Bit());
  EXPECT_EQ("16bit", string16);

  String empty8(StringImpl::empty());
  EXPECT_TRUE(empty8.is8Bit());
  empty8.ensure16Bit();
  EXPECT_FALSE(empty8.is8Bit());
  EXPECT_TRUE(empty8.isEmpty());
  EXPECT_FALSE(empty8.isNull());

  String empty16(StringImpl::empty16Bit());
  EXPECT_FALSE(empty16.is8Bit());
  empty16.ensure16Bit();
  EXPECT_FALSE(empty16.is8Bit());
  EXPECT_TRUE(empty16.isEmpty());
  EXPECT_FALSE(empty16.isNull());

  String nullString;
  nullString.ensure16Bit();
  EXPECT_TRUE(nullString.isNull());
}
Esempio n. 2
0
unsigned playlist_switcher::find_or_create_playlist(const char * name)
{
	unsigned idx = find_playlist(name);
	if (idx==(unsigned)(-1))
	{
		metadb_handle_list dummy;
		idx = create_playlist_fixname(string8(name),dummy);
	}
	return idx;
}
Esempio n. 3
0
string8 KeyRef::NameOf(const Index_t& iIndex) const
	{
	DWORD countKeys, maxLengthKeyName, countValues, maxLengthValueName;
	if (spCount(*this, &countKeys, &maxLengthKeyName, &countValues, &maxLengthValueName))
		{
		size_t offset = iIndex;
		if (offset < countKeys)
			return spKeyName(*this, maxLengthKeyName, offset);

		offset -= countKeys;
		if (offset < countValues)
			return "!" + spValueName(*this, maxLengthValueName, offset);
		}
	return string8();
	}
Esempio n. 4
0
static string8 spValueName(const ZRef<HKEY>& iHKEY, DWORD iMaxLengthValueName, size_t iIndex)
	{
	vector<WCHAR> theName(iMaxLengthValueName);
	if (ERROR_SUCCESS == ::RegEnumValueW(
		iHKEY,
		iIndex,
		&theName[0],
		&iMaxLengthValueName,
		nullptr, // lpReserved
		nullptr, // lpType,
		nullptr, // lpData,
		nullptr // lpcbData
		))
		{
		return ZUnicode::sAsUTF8(spReadLimited(&theName[0], iMaxLengthValueName));
		}
	return string8();
	}
Esempio n. 5
0
std::string convert_from_string16(const android::String16& string16) {
  android::String8 string8(string16);
  std::string converted(string8.string());
  return converted;
}
Esempio n. 6
0
void ZTupleIndex_String::WriteDescription(const ZStrimW& s)
	{
	s << "ZTupleIndex_String. ";
	s.Writef("%zu entries, ", fSet.size());
	s << "indexing on " << string8(fPropName);
	}