OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::CNumericLocalesSetter Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/LocalesUtils.hpp>

Public Member Functions

 CNumericLocalesSetter ()
 ~CNumericLocalesSetter ()
 CNumericLocalesSetter (const CNumericLocalesSetter &)=delete
CNumericLocalesSetter & operator= (const CNumericLocalesSetter &)=delete

Private Attributes

bool m_nested { false }
locale_t m_original_locale
locale_t m_new_locale

Detailed Description

Constructor & Destructor Documentation

◆ CNumericLocalesSetter() [1/2]

Slic3r::CNumericLocalesSetter::CNumericLocalesSetter ( )
35{
36 // Nested in another setter on this thread, whose "C" the separator check
37 // confirms is still set.
39 m_nested = true;
41 return;
42 }
43#ifdef _WIN32
44 _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
45 m_orig_numeric_locale = std::setlocale(LC_NUMERIC, nullptr);
46 std::setlocale(LC_NUMERIC, "C");
47#elif __APPLE__
48 m_original_locale = uselocale((locale_t)0);
49 m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_original_locale);
50 uselocale(m_new_locale);
51#else // linux / BSD
52 m_original_locale = uselocale((locale_t)0);
54 m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_new_locale);
55 uselocale(m_new_locale);
56#endif
57 // Counted last, since the destructor does not run for a constructor that throws.
59}
locale_t m_original_locale
Definition LocalesUtils.hpp:33
locale_t m_new_locale
Definition LocalesUtils.hpp:34
bool m_nested
Definition LocalesUtils.hpp:29
static int s_numeric_locale_depth
Definition LocalesUtils.cpp:32
bool is_decimal_separator_point()
Definition LocalesUtils.cpp:78

References Slic3r::is_decimal_separator_point(), m_nested, m_new_locale, m_original_locale, and Slic3r::s_numeric_locale_depth.

Referenced by CNumericLocalesSetter(), and operator=().

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

◆ ~CNumericLocalesSetter()

Slic3r::CNumericLocalesSetter::~CNumericLocalesSetter ( )
64{
66 if (m_nested)
67 return;
68#ifdef _WIN32
69 std::setlocale(LC_NUMERIC, m_orig_numeric_locale.data());
70#else
71 uselocale(m_original_locale);
72 freelocale(m_new_locale);
73#endif
74}

References m_nested, m_new_locale, m_original_locale, and Slic3r::s_numeric_locale_depth.

◆ CNumericLocalesSetter() [2/2]

Slic3r::CNumericLocalesSetter::CNumericLocalesSetter ( const CNumericLocalesSetter & )
delete

References CNumericLocalesSetter().

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

CNumericLocalesSetter & Slic3r::CNumericLocalesSetter::operator= ( const CNumericLocalesSetter & )
delete

References CNumericLocalesSetter().

Here is the call graph for this function:

Member Data Documentation

◆ m_nested

bool Slic3r::CNumericLocalesSetter::m_nested { false }
private
29{ false };

Referenced by CNumericLocalesSetter(), and ~CNumericLocalesSetter().

◆ m_new_locale

locale_t Slic3r::CNumericLocalesSetter::m_new_locale
private

◆ m_original_locale

locale_t Slic3r::CNumericLocalesSetter::m_original_locale
private

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