mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
48
src/libslic3r/LocalesUtils.hpp
Normal file
48
src/libslic3r/LocalesUtils.hpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef slic3r_LocalesUtils_hpp_
|
||||
#define slic3r_LocalesUtils_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <clocale>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <string_view>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// RAII wrapper that sets LC_NUMERIC to "C" on construction
|
||||
// and restores the old value on destruction.
|
||||
class CNumericLocalesSetter {
|
||||
public:
|
||||
CNumericLocalesSetter();
|
||||
~CNumericLocalesSetter();
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
std::string m_orig_numeric_locale;
|
||||
#else
|
||||
locale_t m_original_locale;
|
||||
locale_t m_new_locale;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// A function to check that current C locale uses decimal point as a separator.
|
||||
// Intended mostly for asserts.
|
||||
bool is_decimal_separator_point();
|
||||
|
||||
|
||||
// A substitute for std::to_string that works according to
|
||||
// C++ locales, not C locale. Meant to be used when we need
|
||||
// to be sure that decimal point is used as a separator.
|
||||
// (We use user C locales and "C" C++ locales in most of the code.)
|
||||
std::string float_to_string_decimal_point(double value, int precision = -1);
|
||||
//std::string float_to_string_decimal_point(float value, int precision = -1);
|
||||
double string_to_double_decimal_point(const std::string_view str, size_t* pos = nullptr);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_LocalesUtils_hpp_
|
||||
Loading…
Add table
Add a link
Reference in a new issue