X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fustring.cc;h=7dbe8ece3e1c431d8cceae240fde723bf0ce1523;hb=58336526043b3e1b4ce583f3392d261438b6eb35;hp=8c48cb4d6e64e0fd7eca8dfe315d93fda51273d4;hpb=23686632d48fe9d31fb4538593e995df766743a2;p=chaz%2Fopenbox diff --git a/otk/ustring.cc b/otk/ustring.cc index 8c48cb4d..7dbe8ece 100644 --- a/otk/ustring.cc +++ b/otk/ustring.cc @@ -111,7 +111,8 @@ ustring::size_type utf8_byte_offset(const char* str, ustring::size_type offset, // ustring methods -ustring::ustring() +ustring::ustring(bool utf8) + : _utf8(utf8) { } @@ -131,13 +132,13 @@ ustring& ustring::operator=(const ustring& other) return *this; } -ustring::ustring(const std::string& src) - : _string(src), _utf8(true) +ustring::ustring(const std::string& src, bool utf8) + : _string(src), _utf8(utf8) { } -ustring::ustring(const char* src) - : _string(src), _utf8(true) +ustring::ustring(const char* src, bool utf8) + : _string(src), _utf8(utf8) { } @@ -228,6 +229,21 @@ ustring::value_type ustring::operator[](ustring::size_type i) const return utf8_get_char(utf8_offset_to_ptr(_string.data(), i)); } +bool ustring::operator==(const ustring &other) const +{ + return _string == other._string && _utf8 == other._utf8; +} + +bool ustring::operator==(const std::string &other) const +{ + return _string == other; +} + +bool ustring::operator==(const char *other) const +{ + return _string == other; +} + const char* ustring::data() const { return _string.data();