Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
boost::nowide Namespace Reference

This namespace includes implementation of the standard library functios such that they accept UTF-8 strings on Windows. On other platforms it is just an alias of std namespace (i.e. not on Windows) More...

Classes

class  args
 
class  basic_stackstring
 A class that allows to create a temporary wide or narrow UTF strings from wide or narrow UTF source. More...
 
class  utf8_codecvt
 
class  utf8_codecvt< CharType, 2 >
 
class  utf8_codecvt< CharType, 4 >
 

Typedefs

typedef basic_stackstring< wchar_t, char, 256 > wstackstring
 Convinience typedef.
 
typedef basic_stackstring< char, wchar_t, 256 > stackstring
 Convinience typedef.
 
typedef basic_stackstring< wchar_t, char, 16 > wshort_stackstring
 Convinience typedef.
 
typedef basic_stackstring< char, wchar_t, 16 > short_stackstring
 Convinience typedef.
 

Functions

template<typename CharOut , typename CharIn >
CharOut * basic_convert (CharOut *buffer, size_t buffer_size, CharIn const *source_begin, CharIn const *source_end)
 Template function that converts a buffer of UTF sequences in range [source_begin,source_end) to the output buffer of size buffer_size.
 
char * narrow (char *output, size_t output_size, wchar_t const *source)
 Convert NULL terminated UTF source string to NULL terminated output string of size at most output_size (including NULL)
 
char * narrow (char *output, size_t output_size, wchar_t const *begin, wchar_t const *end)
 Convert UTF text in range [begin,end) to NULL terminated output string of size at most output_size (including NULL)
 
wchar_t * widen (wchar_t *output, size_t output_size, char const *source)
 Convert NULL terminated UTF source string to NULL terminated output string of size at most output_size (including NULL)
 
wchar_t * widen (wchar_t *output, size_t output_size, char const *begin, char const *end)
 Convert UTF text in range [begin,end) to NULL terminated output string of size at most output_size (including NULL)
 
std::string narrow (wchar_t const *s)
 Convert between Wide - UTF-16/32 string and UTF-8 string.
 
std::wstring widen (char const *s)
 Convert between UTF-8 and UTF-16 string, implemented only on Windows platform.
 
std::string narrow (std::wstring const &s)
 Convert between Wide - UTF-16/32 string and UTF-8 string.
 
std::wstring widen (std::string const &s)
 Convert between UTF-8 and UTF-16 string, implemented only on Windows platform.
 
void nowide_filesystem ()
 Instal utf8_codecvt facet into boost::filesystem::path such all char strings are interpreted as utf-8 strings.
 
 BOOST_STATIC_ASSERT (sizeof(std::mbstate_t)>=2)
 

Detailed Description

This namespace includes implementation of the standard library functios such that they accept UTF-8 strings on Windows. On other platforms it is just an alias of std namespace (i.e. not on Windows)


Class Documentation

◆ boost::nowide::utf8_codecvt

class boost::nowide::utf8_codecvt
template<typename CharType, int CharSize = sizeof(CharType)>
class boost::nowide::utf8_codecvt< CharType, CharSize >

Typedef Documentation

◆ short_stackstring

Convinience typedef.

◆ stackstring

typedef basic_stackstring<char,wchar_t,256> boost::nowide::stackstring

Convinience typedef.

◆ wshort_stackstring

Convinience typedef.

◆ wstackstring

Convinience typedef.

Function Documentation

◆ basic_convert()

template<typename CharOut , typename CharIn >
CharOut * boost::nowide::basic_convert ( CharOut *  buffer,
size_t  buffer_size,
CharIn const source_begin,
CharIn const source_end 
)

Template function that converts a buffer of UTF sequences in range [source_begin,source_end) to the output buffer of size buffer_size.

In case of success a NULL terminated string is returned (buffer), otherwise 0 is returned.

If there is not enough room in the buffer or the source sequence contains invalid UTF, 0 is returned, and the contents of the buffer are undefined.

27 {
28 CharOut *rv = buffer;
29 if(buffer_size == 0)
30 return 0;
31 buffer_size --;
32 while(source_begin!=source_end) {
33 using namespace boost::locale::utf;
34 code_point c = utf_traits<CharIn>::template decode<CharIn const *>(source_begin,source_end);
35 if(c==illegal || c==incomplete) {
36 rv = 0;
37 break;
38 }
39 size_t width = utf_traits<CharOut>::width(c);
40 if(buffer_size < width) {
41 rv=0;
42 break;
43 }
44 buffer = utf_traits<CharOut>::template encode<CharOut *>(c,buffer);
45 buffer_size -= width;
46 }
47 *buffer++ = 0;
48 return rv;
49 }

Referenced by boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert(), narrow(), narrow(), widen(), and widen().

+ Here is the caller graph for this function:

◆ BOOST_STATIC_ASSERT()

boost::nowide::BOOST_STATIC_ASSERT ( sizeof(std::mbstate_t)>=  2)

◆ narrow() [1/4]

char * boost::nowide::narrow ( char *  output,
size_t  output_size,
wchar_t const begin,
wchar_t const end 
)
inline

Convert UTF text in range [begin,end) to NULL terminated output string of size at most output_size (including NULL)

In case of success output is returned, if the input sequence is illegal, or there is not enough room NULL is returned

85 {
86 return basic_convert(output,output_size,begin,end);
87 }
CharOut * basic_convert(CharOut *buffer, size_t buffer_size, CharIn const *source_begin, CharIn const *source_end)
Template function that converts a buffer of UTF sequences in range [source_begin,source_end) to the o...
Definition convert.hpp:26

References basic_convert().

+ Here is the call graph for this function:

◆ narrow() [2/4]

char * boost::nowide::narrow ( char *  output,
size_t  output_size,
wchar_t const source 
)
inline

Convert NULL terminated UTF source string to NULL terminated output string of size at most output_size (including NULL)

In case of success output is returned, if the input sequence is illegal, or there is not enough room NULL is returned

74 {
75 return basic_convert(output,output_size,source,details::basic_strend(source));
76 }

References basic_convert().

Referenced by Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::DownloaderUtils::Worker::Worker(), Slic3r::GUI::Mouse3DController::connect_device(), Slic3r::Emboss::create_range_text(), priv::create_style(), Slic3r::GUI::ObjectList::fix_through_netfabb(), Slic3r::GUI::generate_system_info_json(), Slic3r::GUI::Sidebar::jump_to_option(), Slic3r::GUI::PrintHostQueueDialog::on_cancel(), Slic3r::GUI::PrintHostQueueDialog::on_error(), Slic3r::GUI::Downloader::on_error(), Slic3r::GUI::PrintHostQueueDialog::on_info(), Slic3r::GUI::PrintHostQueueDialog::on_progress(), Slic3r::GUI::Downloader::on_progress(), Slic3r::Search::Option::opt_key(), Slic3r::GUI::Plater::preview_zip_archive(), Slic3r::client::MyContext::process_error_message(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::Utils::scan_serial_ports_extended(), Slic3r::Search::OptionsSearcher::search(), Slic3r::GUI::PrintHostSendDialog::storage(), and Slic3r::GUI::Sidebar::update_sliced_info_sizer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ narrow() [3/4]

std::string boost::nowide::narrow ( std::wstring const s)
inline

Convert between Wide - UTF-16/32 string and UTF-8 string.

boost::locale::conv::conversion_error is thrown in a case of a error

136 {
137 return boost::locale::conv::utf_to_utf<char>(s);
138 }

◆ narrow() [4/4]

std::string boost::nowide::narrow ( wchar_t const s)
inline

Convert between Wide - UTF-16/32 string and UTF-8 string.

boost::locale::conv::conversion_error is thrown in a case of a error

118 {
119 return boost::locale::conv::utf_to_utf<char>(s);
120 }

◆ nowide_filesystem()

void boost::nowide::nowide_filesystem ( )
inline

Instal utf8_codecvt facet into boost::filesystem::path such all char strings are interpreted as utf-8 strings.

19 {
20 std::locale tmp = std::locale(std::locale(),new boost::nowide::utf8_codecvt<wchar_t>());
21 boost::filesystem::path::imbue(tmp);
22 }
Definition utf8_codecvt.hpp:30

Referenced by Slic3r::CLI::run().

+ Here is the caller graph for this function:

◆ widen() [1/4]

std::wstring boost::nowide::widen ( char const s)
inline

Convert between UTF-8 and UTF-16 string, implemented only on Windows platform.

boost::locale::conv::conversion_error is thrown in a case of a error

127 {
128 return boost::locale::conv::utf_to_utf<wchar_t>(s);
129 }

◆ widen() [2/4]

std::wstring boost::nowide::widen ( std::string const s)
inline

Convert between UTF-8 and UTF-16 string, implemented only on Windows platform.

boost::locale::conv::conversion_error is thrown in a case of a error

145 {
146 return boost::locale::conv::utf_to_utf<wchar_t>(s);
147 }

◆ widen() [3/4]

wchar_t * boost::nowide::widen ( wchar_t *  output,
size_t  output_size,
char const begin,
char const end 
)
inline

Convert UTF text in range [begin,end) to NULL terminated output string of size at most output_size (including NULL)

In case of success output is returned, if the input sequence is illegal, or there is not enough room NULL is returned

107 {
108 return basic_convert(output,output_size,begin,end);
109 }

References basic_convert().

+ Here is the call graph for this function:

◆ widen() [4/4]

wchar_t * boost::nowide::widen ( wchar_t *  output,
size_t  output_size,
char const source 
)
inline

Convert NULL terminated UTF source string to NULL terminated output string of size at most output_size (including NULL)

In case of success output is returned, if the input sequence is illegal, or there is not enough room NULL is returned

96 {
97 return basic_convert(output,output_size,source,details::basic_strend(source));
98 }

References basic_convert().

Referenced by Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::IPListDialog::IPListDialog(), Slic3r::GUI::PageVendors::PageVendors(), Slic3r::Search::OptionsSearcher::append_options(), Slic3r::Search::OptionsSearcher::append_preferences_option(), Slic3r::GUI::NotificationManager::PopNotification::compare_text(), Slic3r::Search::create_option(), Slic3r::Emboss::create_range_text(), Slic3r::Search::OptionsSearcher::get_option(), Slic3r::Search::OptionsSearcher::get_option(), Slic3r::GUI::FileGet::priv::get_perform(), Slic3r::PrusaLink::get_storage(), Slic3r::GUI::GUI_Run(), Slic3r::GUI::GUI_App::init_single_instance_checker(), Slic3r::is_plain_file(), Slic3r::GUI::HintDatabase::load_hints_from_file(), Slic3r::GUI::ConfigWizard::priv::load_pages(), Slic3r::GUI::Plater::preview_zip_archive(), Slic3r::client::MyContext::process_error_message(), Slic3r::Search::OptionsSearcher::search(), Slic3r::GUI::PageMaterials::set_compatible_printers_html_window(), Slic3r::GUI::DownloaderUtils::Worker::set_path_name(), Slic3r::GUI::DownloaderUtils::Worker::set_path_name(), Slic3r::GUI::PageMaterials::sort_list_data(), Slic3r::GUI::PageMaterials::sort_list_data(), Slic3r::Emboss::text2shapes(), and Slic3r::OctoPrint::upload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: