nlib
nn::nlib::unicode::ToWideObj Class Referencefinal

Class used to pass a UTF-8, UTF-16, or UTF-32 string as a wide character (UTF-16/UTF-32) string. More...

#include "nn/nlib/unicode/Convert.h"

Public Member Functions

 ToWideObj (const char *str) noexcept
 Converts a wide character string to a UTF-8 string. More...
 
 ToWideObj (const wchar_t *wstr) noexcept
 Sets a wide character string. More...
 
 operator const wchar_t * () noexcept
 Implicitly returns a wide string.
 
const wchar_t * c_str () noexcept
 Explicitly returns a wide string. More...
 
 operator bool () const
 Returns true if the object is enabled.
 

Detailed Description

Class used to pass a UTF-8, UTF-16, or UTF-32 string as a wide character (UTF-16/UTF-32) string.

Description
Because operator const wchar_t*() is defined, you can pass it to function arguments as a wide string. If the conversion fails and the object is invalid, an empty string is passed instead of a null pointer.

Definition at line 33 of file Convert.h.

Constructor & Destructor Documentation

§ ToWideObj() [1/2]

nn::nlib::unicode::ToWideObj::ToWideObj ( const char *  str)
explicitnoexcept

Converts a wide character string to a UTF-8 string.

Parameters
[in]strUTF-8 string that to pass as a wide character (UTF-16/UTF-32) string.

§ ToWideObj() [2/2]

nn::nlib::unicode::ToWideObj::ToWideObj ( const wchar_t *  wstr)
inlineexplicitnoexcept

Sets a wide character string.

Parameters
[in]wstrWide character string.
Description
Stores the passed pointer in the object. Does not dynamically allocate memory or copy the string.
Stores the converted wide character string internally in dynamically allocated memory. The object becomes invalid if the conversion fails.

Definition at line 36 of file Convert.h.

Member Function Documentation

§ c_str()

nn::nlib::unicode::ToWideObj::c_str ( )
inlinenoexcept

Explicitly returns a wide string.

Returns
C string converted to a wide character string.

Definition at line 42 of file Convert.h.


The documentation for this class was generated from the following files: