Back to index

nux  3.0.0
Public Member Functions
nux::AnsicharToUnicharConvertion Class Reference

ANSICHAR to UNICHAR conversion. More...

#include <NUnicode.h>

List of all members.

Public Member Functions

 AnsicharToUnicharConvertion ()
UNICHARConvert (const ANSICHAR *Source)
 Convert from ANSICHAR to UNICHAR.

Detailed Description

ANSICHAR to UNICHAR conversion.

Definition at line 219 of file NUnicode.h.

Constructor & Destructor Documentation

Definition at line 222 of file NUnicode.h.


Member Function Documentation

Convert from ANSICHAR to UNICHAR.

SourceString to convert. Null terminated.
Return a pointer to the new string. Null terminated.

Definition at line 55 of file NUnicode.cpp.

    std::string utf8string (Source);
    size_t utf8size = utf8string.length();
    size_t utf16size = utf8size;
    UNICHAR *utf16string = new UNICHAR[utf16size+1];

    const unsigned char *source_start = reinterpret_cast<const unsigned char *> (utf8string.c_str() );
    const unsigned char *source_end = source_start + utf8size;
    wchar_t *target_start = reinterpret_cast<wchar_t *> (utf16string);
    wchar_t *target_end = target_start + utf16size;

    ConversionResult res = ConvertUTF8toUTF16 (&source_start, source_end, &target_start, target_end, lenientConversion);

    if (res != conversionOK)
      delete[] utf16string;
      utf16string = 0;

    // mark end of string
    *target_start = 0;
    return utf16string;

Here is the call graph for this function:

Here is the caller graph for this function:

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