The Battle for Wesnoth  1.15.2+dev
Namespaces | Macros | Functions | Variables
unicode.cpp File Reference

Unicode support functions. More...

#include "serialization/ucs4_convert_impl.hpp"
#include "serialization/unicode_cast.hpp"
#include "serialization/unicode.hpp"
#include "log.hpp"
#include <cassert>
#include <limits>
Include dependency graph for unicode.cpp:

Go to the source code of this file.

Namespaces

 utf8
 Functions for converting Unicode wide-char strings to UTF-8 encoded strings, back and forth.
 

Macros

#define ERR_GENERAL   LOG_STREAM(err, lg::general())
 

Functions

static int utf8::byte_size_from_utf8_first (const unsigned char ch)
 
std::string utf8::lowercase (const std::string &s)
 Returns a lowercased version of the string. More...
 
std::size_t utf8::index (const std::string &str, const std::size_t index)
 Codepoint index corresponding to the nth character in a UTF-8 string. More...
 
std::size_t utf8::size (const std::string &str)
 Length in characters of a UTF-8 string. More...
 
std::string & utf8::insert (std::string &str, const std::size_t pos, const std::string &insert)
 Insert a UTF-8 string at the specified position. More...
 
std::string & utf8::erase (std::string &str, const std::size_t start, const std::size_t len=std::string::npos)
 Erases a portion of a UTF-8 string. More...
 
std::string & utf8::truncate (std::string &str, const std::size_t size)
 Truncates a UTF-8 string to the specified number of characters. More...
 
void utf8::truncate_as_ucs4 (std::string &str, const std::size_t size)
 Truncates a UTF-8 string to the specified number of characters. More...
 

Variables

static lg::log_domain log_engine ("engine")
 

Detailed Description

Unicode support functions.

Definition in file unicode.cpp.

Macro Definition Documentation

◆ ERR_GENERAL

#define ERR_GENERAL   LOG_STREAM(err, lg::general())

Definition at line 32 of file unicode.cpp.

Referenced by utf8::index(), and utf8::size().

Variable Documentation

◆ log_engine

lg::log_domain log_engine("engine")
static