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...
 
const wchar_t * c_str () noexcept
 Explicitly returns a C string. More...
 
bool IsOk () const noexcept
 : Checks whether the object is valid. More...
 

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 char* is defined, you can pass to function arguments as a wide character string. If the conversion fails and the object is invalid, an empty string is passed instead of a null pointer.

Definition at line 35 of file Convert.h.

Constructor & Destructor Documentation

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.
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 38 of file Convert.h.

Member Function Documentation

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

Explicitly returns a C string.

Returns
C string converted to a wide character string.

Definition at line 46 of file Convert.h.

nn::nlib::unicode::ToWideObj::IsOk ( ) const
inlinenoexcept

: Checks whether the object is valid.

Returns
Returns true if valid.

Definition at line 47 of file Convert.h.


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