1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
5 #endif // HAVE_CONFIG_H
23 ustring::ustring(const ustring& other)
24 : _string(other._string)
28 ustring& ustring::operator=(const ustring& other)
30 _string = other._string;
34 ustring::ustring(const std::string& src)
39 ustring::ustring(const char* src)
44 static ustring::size_type find_offset(const char *str, const char *pos)
46 ustring::size_type offset = 0;
49 str += g_utf8_skip[*str];
50 offset += g_utf8_skip[*str];
56 ustring::size_type ustring::size() const
58 const char *const pdata = _string.data();
59 return find_offset(pdata, pdata + _string.size());
62 ustring::size_type ustring::length() const
64 const char *const pdata = _string.data();
65 return find_offset(pdata, pdata + _string.size());
68 ustring::size_type ustring::bytes() const
70 return _string.size();
73 ustring::size_type ustring::capacity() const
75 return _string.capacity();
78 ustring::size_type ustring::max_size() const
80 return _string.max_size();
84 const char* ustring::data() const
86 return _string.data();
89 const char* ustring::c_str() const
91 return _string.c_str();