NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
WindowsStringHelpers.h File Reference

Helper functions for working with wide-character APIs on Windows. More...

#include <string>

Go to the source code of this file.

Functions

const wchar_t * nvneural::str::utf16Data (const std::u16string &stringUtf16)
 Returns the contents of a std::u16string as a wchar_t*. More...
 
std::u16string nvneural::str::utf16FromUtf8 (const char *pStringUtf8)
 Converts a UTF-8 string to UTF-16. More...
 
std::string nvneural::str::utf8FromUtf16 (const std::u16string &stringUtf16)
 Converts a UTF-16 string to UTF-8. More...
 

Detailed Description

Helper functions for working with wide-character APIs on Windows.

Function Documentation

◆ utf16Data()

const wchar_t * nvneural::str::utf16Data ( const std::u16string &  stringUtf16)

Returns the contents of a std::u16string as a wchar_t*.

Provided as a convenience function to reduce the amount of casting between char16_t and wchar_t when working with UTF-16 string types.

Parameters
stringUtf16A UTF-16 string object

◆ utf16FromUtf8()

std::u16string nvneural::str::utf16FromUtf8 ( const char *  pStringUtf8)

Converts a UTF-8 string to UTF-16.

Uses WideCharToMultiByte system APIs to avoid going through deprecated functions in <codecvt> or pulling in other string handling libraries.

Parameters
pStringUtf8Pointer to a null-terminated UTF-8 string
Returns
The same string as UTF-16, or an empty string if conversion fails
See also
utf8FromUtf16

◆ utf8FromUtf16()

std::string nvneural::str::utf8FromUtf16 ( const std::u16string &  stringUtf16)

Converts a UTF-16 string to UTF-8.

Uses MultiByteToWideChar system APIs to avoid going through deprecated functions in <codecvt> or pulling in other string handling libraries.

Parameters
stringUtf16A UTF-16 string object
Returns
The same string as UTF-8, or an empty string if conversion fails
See also
utf16FromUtf8