HoverRace  2.0
Classes | Functions
HoverRace::Util::Str Namespace Reference

Classes

class  Lua
 Mark a string to be streamed out escaped for Lua. More...
 
class  PU
 
class  PW
 
class  UW
 Utility class for easy conversion of UTF-8 to wide strings. More...
 
class  WU
 Utility class for easy conversion of wide strings to UTF-8. More...
 

Functions

MR_DllDeclare void Append (std::string &dest, const std::string &src, size_t len)
 Append a string onto another string with a specific maximum length. More...
 
MR_DllDeclare size_t Assign (std::string &dest, const std::string &src, size_t len)
 Assign a UTF-8 string to another, with a maximum length. More...
 
std::ostream & operator<< (std::ostream &os, const Lua &lua)
 
OS::path_t UP (const char *s=nullptr) noexcept
 
OS::path_t UP (const std::string &s) noexcept
 
MR_DllDeclare wchar_t * Utf8ToWide (const char *s)
 Convert a UTF-8 string to a wide string. More...
 
MR_DllDeclare char * WideToUtf8 (const wchar_t *ws)
 Convert a wide string to a UTF-8 string. More...
 
OS::path_t WP (const wchar_t *s=NULL) noexcept
 
OS::path_t WP (const std::wstring &s) noexcept
 

Function Documentation

void HoverRace::Util::Str::Append ( std::string &  dest,
const std::string &  src,
size_t  len 
)

Append a string onto another string with a specific maximum length.

Parameters
destThe destination string.
srcThe string to append.
lenThe maximum length of the destination string, in code points.
size_t HoverRace::Util::Str::Assign ( std::string &  dest,
const std::string &  src,
size_t  len 
)

Assign a UTF-8 string to another, with a maximum length.

Parameters
destThe destination string. The contents will be replaced.
srcThe source string.
lenThe maximum length, in code points.
Returns
The destination length, in code points copied.
std::ostream& HoverRace::Util::Str::operator<< ( std::ostream &  os,
const Lua lua 
)
inline
OS::path_t HoverRace::Util::Str::UP ( const char *  s = nullptr)
inlinenoexcept
OS::path_t HoverRace::Util::Str::UP ( const std::string &  s)
inlinenoexcept
wchar_t * HoverRace::Util::Str::Utf8ToWide ( const char *  s)

Convert a UTF-8 string to a wide string.

The caller must use OS::Free() on the result.

Parameters
sThe UTF-8-encoded string (may not be NULL).
Returns
A wide string (must be freed by the caller) (never NULL).
char * HoverRace::Util::Str::WideToUtf8 ( const wchar_t *  ws)

Convert a wide string to a UTF-8 string.

The caller must use OS::Free() on the result.

Parameters
wsThe wide string (may not be NULL).
Returns
A UTF-8-encoded string (must be freed by the caller) (never NULL).
OS::path_t HoverRace::Util::Str::WP ( const wchar_t *  s = NULL)
inlinenoexcept
OS::path_t HoverRace::Util::Str::WP ( const std::wstring &  s)
inlinenoexcept