From b874915445ff5735ef7d61ff70f1e6d93f646650 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 12 Nov 2016 15:30:20 -0600 Subject: [PATCH] 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 --- xs/src/libslic3r/Config.cpp | 31 +++++++++++++++++++++++++++++++ xs/src/libslic3r/Config.hpp | 29 ++--------------------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index 2426a491f..59b0401c6 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #if defined(_WIN32) && !defined(setenv) && defined(_putenv_s) #define setenv(k, v, o) _putenv_s(k, v) @@ -406,4 +408,33 @@ StaticConfig::keys() const { return keys; } +bool +ConfigOptionPoint::deserialize(std::string str, bool append) { + std::vector tokens(2); + boost::split(tokens, str, boost::is_any_of(",x")); + try { + this->value.x = boost::lexical_cast(tokens[0]); + this->value.y = boost::lexical_cast(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 tokens(3); + boost::split(tokens, str, boost::is_any_of(",x")); + try { + this->value.x = boost::lexical_cast(tokens[0]); + this->value.y = boost::lexical_cast(tokens[1]); + this->value.z = boost::lexical_cast(tokens[2]); + } catch (boost::bad_lexical_cast &e){ + std::cout << "Exception caught : " << e.what() << std::endl; + return false; + } + return true; +}; + } diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 48c6bbd89..c293b4ef8 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include "libslic3r.h" #include "Point.hpp" @@ -353,18 +351,7 @@ class ConfigOptionPoint : public ConfigOptionSingle return ss.str(); }; - bool deserialize(std::string str, bool append = false) { - std::vector tokens(2); - boost::split(tokens, str, boost::is_any_of(",x")); - try { - this->value.x = boost::lexical_cast(tokens[0]); - this->value.y = boost::lexical_cast(tokens[1]); - } catch (boost::bad_lexical_cast &e){ - std::cout << "Exception caught : " << e.what() << std::endl; - return false; - } - return true; - }; + bool deserialize(std::string str, bool append = false); }; class ConfigOptionPoint3 : public ConfigOptionSingle @@ -384,19 +371,7 @@ class ConfigOptionPoint3 : public ConfigOptionSingle return ss.str(); }; - bool deserialize(std::string str, bool append = false) { - std::vector tokens(3); - boost::split(tokens, str, boost::is_any_of(",x")); - try { - this->value.x = boost::lexical_cast(tokens[0]); - this->value.y = boost::lexical_cast(tokens[1]); - this->value.z = boost::lexical_cast(tokens[2]); - } catch (boost::bad_lexical_cast &e){ - std::cout << "Exception caught : " << e.what() << std::endl; - return false; - } - return true; - }; + bool deserialize(std::string str, bool append = false); bool is_positive_volume () { return this->value.x > 0 && this->value.y > 0 && this->value.z > 0;