return d->cstring.c_str();
}
+const wchar_t *String::toCWString() const
+{
+ return d->data.c_str();
+}
+
String::Iterator String::begin()
{
return d->data.begin();
* where memory is critical.
*/
const char *toCString(bool unicode = false) const;
-
+
+ /*!
+ * Returns a pointer to the wide char version of the TagLib string. The string
+ * is encoded in UTF-16(without BOM/CPU byte order).
+ *
+ * /note This returns a pointer to the String's internal data without any
+ * conversions.
+ */
+ const wchar_t *toCWString() const;
+
/*!
* Returns an iterator pointing to the beginning of the string.
*/
String unicode2(unicode.to8Bit(true), String::UTF8);
CPPUNIT_ASSERT(unicode == unicode2);
+ String unicode3(L"\u65E5\u672C\u8A9E");
+ CPPUNIT_ASSERT(*(unicode3.toCWString() + 1) == L'\u672C');
+
CPPUNIT_ASSERT(strcmp(String::number(0).toCString(), "0") == 0);
CPPUNIT_ASSERT(strcmp(String::number(12345678).toCString(), "12345678") == 0);
CPPUNIT_ASSERT(strcmp(String::number(-12345678).toCString(), "-12345678") == 0);