mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 11:56:04 +08:00
Fix/workaround for Boost issues in Config.hpp (#3572)
* Moved new deserialize functions (and their accompanying boost dependencies) into Config.cpp from Config.hpp. Fixes #3539 * Forgot to save Config.hpp for removal of Boost
This commit is contained in:
parent
8910b4970a
commit
b874915445
@ -10,6 +10,8 @@
|
|||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/property_tree/ini_parser.hpp>
|
#include <boost/property_tree/ini_parser.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(setenv) && defined(_putenv_s)
|
#if defined(_WIN32) && !defined(setenv) && defined(_putenv_s)
|
||||||
#define setenv(k, v, o) _putenv_s(k, v)
|
#define setenv(k, v, o) _putenv_s(k, v)
|
||||||
@ -406,4 +408,33 @@ StaticConfig::keys() const {
|
|||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ConfigOptionPoint::deserialize(std::string str, bool append) {
|
||||||
|
std::vector<std::string> tokens(2);
|
||||||
|
boost::split(tokens, str, boost::is_any_of(",x"));
|
||||||
|
try {
|
||||||
|
this->value.x = boost::lexical_cast<coordf_t>(tokens[0]);
|
||||||
|
this->value.y = boost::lexical_cast<coordf_t>(tokens[1]);
|
||||||
|
} catch (boost::bad_lexical_cast &e){
|
||||||
|
std::cout << "Exception caught : " << e.what() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool
|
||||||
|
ConfigOptionPoint3::deserialize(std::string str, bool append) {
|
||||||
|
std::vector<std::string> tokens(3);
|
||||||
|
boost::split(tokens, str, boost::is_any_of(",x"));
|
||||||
|
try {
|
||||||
|
this->value.x = boost::lexical_cast<coordf_t>(tokens[0]);
|
||||||
|
this->value.y = boost::lexical_cast<coordf_t>(tokens[1]);
|
||||||
|
this->value.z = boost::lexical_cast<coordf_t>(tokens[2]);
|
||||||
|
} catch (boost::bad_lexical_cast &e){
|
||||||
|
std::cout << "Exception caught : " << e.what() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
|
||||||
@ -353,18 +351,7 @@ class ConfigOptionPoint : public ConfigOptionSingle<Pointf>
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool deserialize(std::string str, bool append = false) {
|
bool deserialize(std::string str, bool append = false);
|
||||||
std::vector<std::string> tokens(2);
|
|
||||||
boost::split(tokens, str, boost::is_any_of(",x"));
|
|
||||||
try {
|
|
||||||
this->value.x = boost::lexical_cast<coordf_t>(tokens[0]);
|
|
||||||
this->value.y = boost::lexical_cast<coordf_t>(tokens[1]);
|
|
||||||
} catch (boost::bad_lexical_cast &e){
|
|
||||||
std::cout << "Exception caught : " << e.what() << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigOptionPoint3 : public ConfigOptionSingle<Pointf3>
|
class ConfigOptionPoint3 : public ConfigOptionSingle<Pointf3>
|
||||||
@ -384,19 +371,7 @@ class ConfigOptionPoint3 : public ConfigOptionSingle<Pointf3>
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool deserialize(std::string str, bool append = false) {
|
bool deserialize(std::string str, bool append = false);
|
||||||
std::vector<std::string> tokens(3);
|
|
||||||
boost::split(tokens, str, boost::is_any_of(",x"));
|
|
||||||
try {
|
|
||||||
this->value.x = boost::lexical_cast<coordf_t>(tokens[0]);
|
|
||||||
this->value.y = boost::lexical_cast<coordf_t>(tokens[1]);
|
|
||||||
this->value.z = boost::lexical_cast<coordf_t>(tokens[2]);
|
|
||||||
} catch (boost::bad_lexical_cast &e){
|
|
||||||
std::cout << "Exception caught : " << e.what() << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool is_positive_volume () {
|
bool is_positive_volume () {
|
||||||
return this->value.x > 0 && this->value.y > 0 && this->value.z > 0;
|
return this->value.x > 0 && this->value.y > 0 && this->value.z > 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user