34 #define ERR_GENERAL LOG_STREAM(err, lg::general())
47 if (count == 1 || count > 6) {
62 if(uchar <= static_cast<ucs4::char_t>(std::numeric_limits<wchar_t>::max()))
63 uchar = towlower(static_cast<wchar_t>(uchar));
67 res.append(itor.
substr().second, s.end());
77 unsigned int i = 0,
len = str.size();
79 for (
unsigned int chr=0; chr<index && i<
len; ++chr) {
83 ERR_GENERAL <<
"Invalid UTF-8 string." << std::endl;
90 unsigned int chr,
i = 0,
len = str.size();
92 for (chr=0; i<
len; ++chr) {
96 ERR_GENERAL <<
"Invalid UTF-8 string." << std::endl;
103 return str.insert(
index(str, pos), insert);
108 if (start >
size(str))
return str;
111 if (len == std::string::npos) {
113 return str.erase(pos);
115 return str.erase(pos,
index(str,start+len) - pos);
121 return erase(str, size);
127 if(u4_str.size() >
size) {
std::vector< char_t > string
size_t index(const utf8::string &str, const size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
unsigned int count_leading_ones(N n)
Returns the quantity of leading 1 bits in n — i.e., the quantity of bits in n, minus the 1-based bit...
void truncate_as_ucs4(utf8::string &str, const size_t size)
Truncates a UTF-8 string to the specified number of characters.
ucs4_convert_impl::enableif< TD, typename TS::value_type >::type unicode_cast(const TS &source)
utf8::string lowercase(const utf8::string &s)
Returns a lowercased version of the string.
static int byte_size_from_utf8_first(const unsigned char ch)
utf8::string & truncate(utf8::string &str, const size_t size)
Truncates a UTF-8 string to the specified number of characters.
Templates and utility-routines for strings and numbers.
GLuint GLuint GLsizei count
size_t size(const utf8::string &str)
Length in characters of a UTF-8 string.
Functions for converting Unicode wide-char strings to UTF-8 encoded strings, back and forth...
std::map< std::string, tfilter >::iterator itor
Thrown by operations encountering invalid UTF-8 data.
static iterator_base end(const string_type &str)
static lg::log_domain log_engine("engine")
const std::pair< typename string_type::const_iterator, typename string_type::const_iterator > & substr() const
Standard logging facilities (interface).
utf8::string & insert(utf8::string &str, const size_t pos, const utf8::string &insert)
Insert a UTF-8 string at the specified position.
utf8::string & erase(utf8::string &str, const size_t start, const size_t len)
Erases a portion of a UTF-8 string.