31 #define ERR_GENERAL LOG_STREAM(err, lg::general())
44 if (count == 1 || count > 6) {
57 char32_t uchar = *itor;
59 if(uchar <=
static_cast<char32_t
>(std::numeric_limits<wchar_t>::max()))
60 uchar = towlower(
static_cast<wchar_t>(uchar));
61 res += unicode_cast<std::string>(uchar);
64 res.append(itor.
substr().second,
s.end());
70 std::size_t
index(
const std::string& str,
const std::size_t
index)
74 unsigned int i = 0, len = str.size();
76 for (
unsigned int chr=0; chr<
index &&
i<len; ++chr) {
85 std::size_t
size(
const std::string& str)
87 unsigned int chr,
i = 0, len = str.size();
89 for (chr=0;
i<len; ++chr) {
98 std::string&
insert(std::string& str,
const std::size_t pos,
const std::string&
insert)
103 std::string&
erase(std::string& str,
const std::size_t
start,
const std::size_t len)
108 if (len == std::string::npos) {
110 return str.erase(pos);
112 return str.erase(pos,
index(str,
start+len) - pos);
123 std::u32string u4_str = unicode_cast<std::u32string>(str);
124 if(u4_str.size() >
size) {
126 str = unicode_cast<std::string>(u4_str);
static iterator_base end(const string_type &str)
const std::pair< typename string_type::const_iterator, typename string_type::const_iterator > & substr() const
Thrown by operations encountering invalid UTF-8 data.
Standard logging facilities (interface).
constexpr 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 ...
EXIT_STATUS start(bool clear_id, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
Functions for converting Unicode wide-char strings to UTF-8 encoded strings, back and forth.
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::string & insert(std::string &str, const std::size_t pos, const std::string &insert)
Insert a UTF-8 string at the specified position.
std::string lowercase(const std::string &s)
Returns a lowercased version of the string.
std::string & erase(std::string &str, const std::size_t start, const std::size_t len)
Erases a portion of a UTF-8 string.
void truncate_as_ucs4(std::string &str, const std::size_t size)
Truncates a UTF-8 string to the specified number of characters.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
static int byte_size_from_utf8_first(const unsigned char ch)
std::string & truncate(std::string &str, const std::size_t size)
Truncates a UTF-8 string to the specified number of characters.
static map_location::direction s
static lg::log_domain log_engine("engine")