X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fustring.hh;h=0031e1c5b888db645c7ee397038f3f62d8ade854;hb=65e91ac3d6bbfec368bae9957c18c477d4f53ec5;hp=d156528cd9d507dd4be9e637f6ee526125a76e44;hpb=55f138186097931f3bf81618e36d2ad53e0c07fd;p=chaz%2Fopenbox diff --git a/otk/ustring.hh b/otk/ustring.hh index d156528c..0031e1c5 100644 --- a/otk/ustring.hh +++ b/otk/ustring.hh @@ -32,18 +32,6 @@ typedef u_int32_t unichar; #ifndef DOXYGEN_IGNORE -//! The number of bytes to skip to find the next character in the string -const char utf8_skip[256] = { - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 -}; - unichar utf8_get_char(const char *p); #endif // DOXYGEN_IGNORE @@ -129,15 +117,15 @@ public: static const size_type npos = std::string::npos; - ustring(); + ustring(bool utf8 = true); ~ustring(); // make new strings ustring(const ustring& other); ustring& operator=(const ustring& other); - ustring(const std::string& src); - ustring(const char* src); + ustring(const std::string& src, bool utf8 = true); + ustring(const char* src, bool utf8 = true); // append to the string @@ -167,6 +155,12 @@ public: // No reference return; use replace() to write characters. value_type operator[](size_type i) const; + // compare strings + + bool operator==(const ustring &other) const; + bool operator==(const std::string &other) const; + bool operator==(const char *other) const; + // internal data const char* data() const;