mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Slic3r::format(), Slic3r::GUI::format_wxstr():
wrappers around boost::format using C++17 variadic templates, replacing the ugly and verbose (boost::format("template") % arg1 % arg2).str() syntax. The wrappers also implictely convert input parameters including the template from wxString to UTF8. The new format wrapper has been applied at multiple places as a start, also some double macros _(L()) with new single macro _L().
This commit is contained in:
parent
daa6dd0a25
commit
b843a094f6
10 changed files with 364 additions and 240 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "Config.hpp"
|
||||
#include "format.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include <assert.h>
|
||||
#include <fstream>
|
||||
|
@ -464,7 +465,7 @@ bool ConfigBase::set_deserialize_nothrow(const t_config_option_key &opt_key_src,
|
|||
void ConfigBase::set_deserialize(const t_config_option_key &opt_key_src, const std::string &value_src, bool append)
|
||||
{
|
||||
if (! this->set_deserialize_nothrow(opt_key_src, value_src, append))
|
||||
throw BadOptionTypeException((boost::format("ConfigBase::set_deserialize() failed for parameter \"%1%\", value \"%2%\"") % opt_key_src % value_src).str());
|
||||
throw BadOptionTypeException(format("ConfigBase::set_deserialize() failed for parameter \"%1%\", value \"%2%\"", opt_key_src, value_src));
|
||||
}
|
||||
|
||||
void ConfigBase::set_deserialize(std::initializer_list<SetDeserializeItem> items)
|
||||
|
@ -620,7 +621,7 @@ void ConfigBase::load_from_gcode_file(const std::string &file)
|
|||
|
||||
size_t key_value_pairs = load_from_gcode_string(data.data());
|
||||
if (key_value_pairs < 80)
|
||||
throw std::runtime_error((boost::format("Suspiciously low number of configuration values extracted from %1%: %2%") % file % key_value_pairs).str());
|
||||
throw std::runtime_error(format("Suspiciously low number of configuration values extracted from %1%: %2%", file, key_value_pairs));
|
||||
}
|
||||
|
||||
// Load the config keys from the given string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue