qxLib
Functions
string_converters.h File Reference
#include <qx/category.h>
#include <qx/containers/string/string.h>
#include <qx/containers/string/string_literal.h>
#include <qx/containers/string/string_view.h>
#include <qx/internal/perf_scope.h>
#include <qx/windows.h>
#include <codecvt>
#include <locale>
#include <qx/containers/string/string_converters.inl>

Go to the source code of this file.

Functions

void qx::to_wstring (wstring &out, cstring_view stringView, const std::locale &locale=std::locale())
 convert cstring to wstring More...
 
wstring qx::to_wstring (cstring_view stringView, const std::locale &locale=std::locale())
 convert cstring to wstring More...
 
void qx::to_wstring (wstring &out, wstring_view stringView, const std::locale &locale=std::locale())
 Convert wstring to wstring. More...
 
wstring_view qx::to_wstring (wstring_view stringView, const std::locale &locale=std::locale())
 Convert wstring to wstring (stub) More...
 
void qx::to_cstring (cstring &out, wstring_view stringView, const std::locale &locale=std::locale())
 Convert wstring to cstring. More...
 
cstring qx::to_cstring (wstring_view stringView, const std::locale &locale=std::locale())
 Convert wstring to cstring. More...
 
void qx::to_cstring (cstring &out, cstring_view stringView, const std::locale &locale=std::locale())
 Convert string to string. More...
 
cstring_view qx::to_cstring (cstring_view stringView, const std::locale &locale=std::locale())
 Convert string to string (stub) More...
 
void qx::to_string (string &out, cstring_view stringView, const std::locale &locale=std::locale())
 Convert a char string to common string type. More...
 
string qx::to_string (cstring_view stringView, const std::locale &locale=std::locale())
 Convert a char string to common string type. More...
 
void qx::to_string (string &out, wstring_view stringView, const std::locale &locale=std::locale())
 Convert a wchar_t string to common string type. More...
 
string qx::to_string (wstring_view stringView, const std::locale &locale=std::locale())
 Convert a wchar_t string to common string type. More...
 
void qx::utf8_to_string (string &out, cstring_view pszUtf8)
 Convert const char* representing UTF8 to wstring. More...
 
string qx::utf8_to_string (cstring_view pszUtf8)
 Convert const char* representing UTF8 to wstring. More...
 
template<class char_t , string_literal sLiteral>
constexpr basic_string_view< char_t > qx::convert_string_literal ()
 Convert a constexpr string literal to the wider or equal char type string view. More...
 

Detailed Description

Author
Khrapov
Date
24.11.2021

Definition in file string_converters.h.

Function Documentation

◆ convert_string_literal()

template<class char_t , string_literal sLiteral>
constexpr basic_string_view< char_t > qx::convert_string_literal ( )
constexpr

Convert a constexpr string literal to the wider or equal char type string view.

Template Parameters
char_t- target string view type
sLiteral- constexpr string literal
Return values
-constexpr string view of a wider or equal char type

Definition at line 157 of file string_converters.inl.

◆ to_cstring() [1/4]

void qx::to_cstring ( cstring out,
cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert string to string.

Parameters
out- output char string
stringView- char string view
locale- locale to use

Definition at line 59 of file string_converters.inl.

◆ to_cstring() [2/4]

void qx::to_cstring ( cstring out,
wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert wstring to cstring.

'?' is a default character

Parameters
out- output char string
stringView- wchar_t string view
locale- locale to use

Definition at line 43 of file string_converters.inl.

◆ to_cstring() [3/4]

cstring_view qx::to_cstring ( cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert string to string (stub)

Parameters
stringView- char string view
locale- locale to use
Return values
-char string

Definition at line 64 of file string_converters.inl.

◆ to_cstring() [4/4]

cstring qx::to_cstring ( wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert wstring to cstring.

'?' is a default character

Parameters
stringView- wchar_t string view
locale- locale to use
Return values
-char string

Definition at line 52 of file string_converters.inl.

◆ to_string() [1/4]

string qx::to_string ( cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert a char string to common string type.

Parameters
stringView- char string
locale- locale to use
Return values
-common string

Definition at line 78 of file string_converters.inl.

◆ to_string() [2/4]

void qx::to_string ( string out,
cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert a char string to common string type.

Parameters
out- output common string
stringView- char string
locale- locale to use

Definition at line 69 of file string_converters.inl.

◆ to_string() [3/4]

void qx::to_string ( string out,
wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert a wchar_t string to common string type.

Parameters
out- output common string
stringView- wchar_t string
locale- locale to use

Definition at line 87 of file string_converters.inl.

◆ to_string() [4/4]

string qx::to_string ( wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert a wchar_t string to common string type.

Parameters
stringView- wchar_t string
locale- locale to use
Return values
-common string

Definition at line 96 of file string_converters.inl.

◆ to_wstring() [1/4]

wstring qx::to_wstring ( cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

convert cstring to wstring

Parameters
stringView- char string view
locale- locale to use
Return values
-wchar_t string

Definition at line 26 of file string_converters.inl.

◆ to_wstring() [2/4]

void qx::to_wstring ( wstring out,
cstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

convert cstring to wstring

Parameters
out- output wchar_t string
stringView- char string view
locale- locale to use

Definition at line 15 of file string_converters.inl.

◆ to_wstring() [3/4]

void qx::to_wstring ( wstring out,
wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert wstring to wstring.

Parameters
out- output wchar_t string
stringView- wchar_t string view
locale- locale to use

Definition at line 33 of file string_converters.inl.

◆ to_wstring() [4/4]

wstring_view qx::to_wstring ( wstring_view  stringView,
const std::locale &  locale = std::locale() 
)
inline

Convert wstring to wstring (stub)

Parameters
stringView- wchar_t string view
locale- locale to use
Return values
-wchar_t string

Definition at line 38 of file string_converters.inl.

◆ utf8_to_string() [1/2]

string qx::utf8_to_string ( cstring_view  pszUtf8)
inline

Convert const char* representing UTF8 to wstring.

Parameters
pszUtf8- UTF8 string
Return values
-wchar_t string

Definition at line 128 of file string_converters.inl.

◆ utf8_to_string() [2/2]

void qx::utf8_to_string ( string out,
cstring_view  pszUtf8 
)
inline

Convert const char* representing UTF8 to wstring.

Parameters
out- output wchar_t string
pszUtf8- UTF8 string

Definition at line 105 of file string_converters.inl.