43bool IsUTF8(
const char* aString );
46#if defined(UTF8_VERIFY)
47 #define MAYBE_VERIFY_UTF8(x) wxASSERT( IsUTF8(x) )
49 #define MAYBE_VERIFY_UTF8(x)
73 UTF8(
const wxString& o );
85 UTF8(
const wchar_t* txt );
87 UTF8(
const std::string& o ) :
105 std::string::size_type
find(
char c )
const {
return m_s.find( c ); }
106 std::string::size_type
find(
char c,
size_t s )
const {
return m_s.find( c, s ); }
109 std::string::size_type
length()
const {
return m_s.length(); }
110 std::string::size_type
size()
const {
return m_s.size(); }
111 int compare(
const std::string& s )
const {
return m_s.compare( s ); }
118 std::string::size_type pos = 0 )
const
120 return m_s.find_first_of( str, pos );
132 m_s.operator+=( ch );
151 static constexpr std::string::size_type
npos = -1;
178 std::string
substr(
size_t pos = 0,
size_t len =
npos )
const
180 return m_s.substr( pos, len );
183 operator const std::string& ()
const {
return m_s; }
188 operator wxString ()
const;
192 std::string::const_iterator
begin()
const {
return m_s.begin(); }
193 std::string::const_iterator
end()
const {
return m_s.end(); }
267 const unsigned char*
it;
271 it( (const unsigned char*) start )
300 static int uni_forward(
const unsigned char* aSequence,
unsigned* aResult =
nullptr );
uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string...
uni_iter(const uni_iter &o)
unsigned operator*() const
return unicode at current position
bool operator!=(const uni_iter &other) const
uni_iter(const char *start)
bool operator<(const uni_iter &other) const
Since the ++ operators advance more than one byte, this is your best loop termination test,...
uni_iter operator-(int aVal) const
bool operator>=(const uni_iter &other) const
bool operator<=(const uni_iter &other) const
bool operator==(const uni_iter &other) const
bool operator>(const uni_iter &other) const
uni_iter operator++(int)
post-increment and return uni_iter at initial position
const uni_iter & operator++()
pre-increment and return uni_iter at new position
unsigned operator->() const
return unicode at current position
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
UTF8 & operator+=(const UTF8 &str)
static constexpr std::string::size_type npos
std::string::const_iterator begin() const
UTF8 & operator=(const std::string &o)
std::string::size_type length() const
std::string::size_type find(char c) const
std::string substr(size_t pos=0, size_t len=npos) const
std::string::size_type find(char c, size_t s) const
uni_iter uend() const
Return a uni_iter initialized to the end of "this" UTF8 byte sequence.
bool operator==(const std::string &rhs) const
static int uni_forward(const unsigned char *aSequence, unsigned *aResult=nullptr)
Advance over a single UTF8 encoded multibyte character, capturing the Unicode character as it goes,...
UTF8(const std::string &o)
UTF8 & operator+=(const char *s)
int compare(const std::string &s) const
std::string::size_type find_first_of(const std::string &str, std::string::size_type pos=0) const
UTF8 & operator+=(char ch)
UTF8(const char *txt)
This is a constructor for which you could end up with non-UTF8 encoding, but that would be your fault...
const char * c_str() const
std::string::size_type size() const
uni_iter ubegin() const
Returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
UTF8 & operator=(const char *s)
bool operator==(const char *s) const
std::string::const_iterator end() const
UTF8 & operator=(const wxString &o)
bool operator==(const UTF8 &rhs) const
#define MAYBE_VERIFY_UTF8(x)
bool IsUTF8(const char *aString)
Test a C string to see if it is UTF8 encoded.