Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ConfigOptionBool Class Reference

#include <src/libslic3r/Config.hpp>

+ Inheritance diagram for Slic3r::ConfigOptionBool:
+ Collaboration diagram for Slic3r::ConfigOptionBool:

Public Member Functions

 ConfigOptionBool ()
 
 ConfigOptionBool (bool _value)
 
ConfigOptionType type () const override
 
bool getBool () const override
 
ConfigOptionclone () const override
 
ConfigOptionBooloperator= (const ConfigOption *opt)
 
bool operator== (const ConfigOptionBool &rhs) const throw ()
 
bool operator< (const ConfigOptionBool &rhs) const throw ()
 
std::string serialize () const override
 
bool deserialize (const std::string &str, bool append=false) override
 
 operator bool () const
 
void set (const ConfigOption *rhs) override
 
bool operator== (const ConfigOption &rhs) const override
 
bool operator== (const bool &rhs) const throw ()
 
bool operator!= (const bool &rhs) const throw ()
 
bool operator!= (const ConfigOption &rhs) const
 
bool operator< (const bool &rhs) const throw ()
 
size_t hash () const override throw ()
 
virtual int getInt () const
 
virtual double getFloat () const
 
virtual void setInt (int)
 
bool is_scalar () const
 
bool is_vector () const
 
virtual bool nullable () const
 
virtual bool is_nil () const
 
virtual bool overriden_by (const ConfigOption *rhs) const
 
virtual bool apply_override (const ConfigOption *rhs)
 

Static Public Member Functions

static ConfigOptionType static_type ()
 

Public Attributes

bool value
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar)
 

Friends

class cereal::access
 

Detailed Description

Constructor & Destructor Documentation

◆ ConfigOptionBool() [1/2]

Slic3r::ConfigOptionBool::ConfigOptionBool ( )
inline
1351: ConfigOptionSingle<bool>(false) {}

Referenced by clone().

+ Here is the caller graph for this function:

◆ ConfigOptionBool() [2/2]

Slic3r::ConfigOptionBool::ConfigOptionBool ( bool  _value)
inlineexplicit
1352: ConfigOptionSingle<bool>(_value) {}

Member Function Documentation

◆ apply_override()

virtual bool Slic3r::ConfigOption::apply_override ( const ConfigOption rhs)
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionVector< T >, Slic3r::ConfigOptionVector< double >, Slic3r::ConfigOptionVector< FloatOrPercent >, Slic3r::ConfigOptionVector< int >, Slic3r::ConfigOptionVector< std::string >, Slic3r::ConfigOptionVector< unsigned char >, and Slic3r::ConfigOptionVector< Vec2d >.

290 {
291 if (*this == *rhs)
292 return false;
293 *this = *rhs;
294 return true;
295 }

Referenced by Slic3r::print_config_diffs().

+ Here is the caller graph for this function:

◆ clone()

ConfigOption * Slic3r::ConfigOptionBool::clone ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

1357{ return new ConfigOptionBool(*this); }
ConfigOptionBool()
Definition Config.hpp:1351

References ConfigOptionBool().

+ Here is the call graph for this function:

◆ deserialize()

bool Slic3r::ConfigOptionBool::deserialize ( const std::string &  str,
bool  append = false 
)
inlineoverridevirtual

Implements Slic3r::ConfigOption.

1368 {
1369 UNUSED(append);
1370 if (str == "1") {
1371 this->value = true;
1372 return true;
1373 }
1374 if (str == "0") {
1375 this->value = false;
1376 return true;
1377 }
1378 return false;
1379 }
bool value
Definition Config.hpp:305
#define UNUSED(x)
Definition libslic3r.h:74
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:110

References Slic3r::append(), and UNUSED.

+ Here is the call graph for this function:

◆ getBool()

bool Slic3r::ConfigOptionBool::getBool ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOption.

1356{ return this->value; }

References Slic3r::ConfigOptionSingle< bool >::value.

◆ getFloat()

virtual double Slic3r::ConfigOption::getFloat ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionFloat.

271{ throw BadOptionTypeException("Calling ConfigOption::getFloat on a non-float ConfigOption"); }

Referenced by Slic3r::GUI::TabSLAMaterial::build(), Slic3r::GUI::get_string_value(), Slic3r::client::MyContext::scalar_variable_to_expr(), and Slic3r::GUI::Sidebar::update_sliced_info_sizer().

+ Here is the caller graph for this function:

◆ getInt()

virtual int Slic3r::ConfigOption::getInt ( ) const
inlinevirtualinherited

◆ hash()

size_t Slic3r::ConfigOptionSingle< bool >::hash ( ) const
throw (
)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

329{ return std::hash<T>{}(this->value); }

◆ is_nil()

◆ is_scalar()

bool Slic3r::ConfigOption::is_scalar ( ) const
inlineinherited
277{ return (int(this->type()) & int(coVectorType)) == 0; }
virtual ConfigOptionType type() const =0
@ coVectorType
Definition Config.hpp:161

References Slic3r::coVectorType, and Slic3r::ConfigOption::type().

Referenced by Slic3r::PresetBundle::full_fff_config(), Slic3r::client::MyContext::is_nil_test(), Slic3r::ConfigOption::is_vector(), Slic3r::client::MyContext::legacy_variable_expansion(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::client::MyContext::scalar_variable_assign_scalar(), Slic3r::client::MyContext::scalar_variable_to_expr(), Slic3r::client::MyContext::vector_variable_assign_array(), Slic3r::client::MyContext::vector_variable_assign_initializer_list(), and Slic3r::client::MyContext::vector_variable_new_from_array().

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

◆ is_vector()

◆ nullable()

virtual bool Slic3r::ConfigOption::nullable ( ) const
inlinevirtualinherited

◆ operator bool()

Slic3r::ConfigOptionSingle< bool >::operator bool ( ) const
inlineinherited
307{ return this->value; }

◆ operator!=() [1/2]

bool Slic3r::ConfigOptionSingle< bool >::operator!= ( const bool &  rhs) const
throw (
)
inlineinherited
326{ return this->value != rhs; }

◆ operator!=() [2/2]

bool Slic3r::ConfigOption::operator!= ( const ConfigOption rhs) const
inlineinherited
275{ return ! (*this == rhs); }

◆ operator<() [1/2]

bool Slic3r::ConfigOptionSingle< bool >::operator< ( const bool &  rhs) const
throw (
)
inlineinherited
327{ return this->value < rhs; }

◆ operator<() [2/2]

bool Slic3r::ConfigOptionBool::operator< ( const ConfigOptionBool rhs) const
throw (
)
inline
1360{ return int(this->value) < int(rhs.value); }

◆ operator=()

ConfigOptionBool & Slic3r::ConfigOptionBool::operator= ( const ConfigOption opt)
inline
1358{ this->set(opt); return *this; }
void set(const ConfigOption *rhs) override
Definition Config.hpp:309

References Slic3r::ConfigOptionSingle< bool >::set().

+ Here is the call graph for this function:

◆ operator==() [1/3]

bool Slic3r::ConfigOptionSingle< bool >::operator== ( const bool &  rhs) const
throw (
)
inlineinherited
325{ return this->value == rhs; }

◆ operator==() [2/3]

bool Slic3r::ConfigOptionSingle< bool >::operator== ( const ConfigOption rhs) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

318 {
319 if (rhs.type() != this->type())
320 throw ConfigurationError("ConfigOptionSingle: Comparing incompatible types");
321 assert(dynamic_cast<const ConfigOptionSingle<T>*>(&rhs));
322 return this->value == static_cast<const ConfigOptionSingle<T>*>(&rhs)->value;
323 }

◆ operator==() [3/3]

bool Slic3r::ConfigOptionBool::operator== ( const ConfigOptionBool rhs) const
throw (
)
inline
1359{ return this->value == rhs.value; }

◆ overriden_by()

virtual bool Slic3r::ConfigOption::overriden_by ( const ConfigOption rhs) const
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionVector< T >, Slic3r::ConfigOptionVector< double >, Slic3r::ConfigOptionVector< FloatOrPercent >, Slic3r::ConfigOptionVector< int >, Slic3r::ConfigOptionVector< std::string >, Slic3r::ConfigOptionVector< unsigned char >, and Slic3r::ConfigOptionVector< Vec2d >.

285 {
286 assert(! this->nullable() && ! rhs->nullable());
287 return *this != *rhs;
288 }
virtual bool nullable() const
Definition Config.hpp:280

References Slic3r::ConfigOption::nullable().

Referenced by Slic3r::print_config_diffs().

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

◆ serialize() [1/2]

std::string Slic3r::ConfigOptionBool::serialize ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

1363 {
1364 return std::string(this->value ? "1" : "0");
1365 }

◆ serialize() [2/2]

template<class Archive >
void Slic3r::ConfigOptionBool::serialize ( Archive &  ar)
inlineprivate
1383{ ar(cereal::base_class<ConfigOptionSingle<bool>>(this)); }

◆ set()

void Slic3r::ConfigOptionSingle< bool >::set ( const ConfigOption rhs)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

310 {
311 if (rhs->type() != this->type())
312 throw ConfigurationError("ConfigOptionSingle: Assigning an incompatible type");
313 assert(dynamic_cast<const ConfigOptionSingle<T>*>(rhs));
314 this->value = static_cast<const ConfigOptionSingle<T>*>(rhs)->value;
315 }

◆ setInt()

virtual void Slic3r::ConfigOption::setInt ( int  )
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionInt, and Slic3r::ConfigOptionEnum< T >.

273{ throw BadOptionTypeException("Calling ConfigOption::setInt on a non-int ConfigOption"); }

◆ static_type()

static ConfigOptionType Slic3r::ConfigOptionBool::static_type ( )
inlinestatic
1354{ return coBool; }
@ coBool
Definition Config.hpp:190

References Slic3r::coBool.

Referenced by type().

+ Here is the caller graph for this function:

◆ type()

ConfigOptionType Slic3r::ConfigOptionBool::type ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

1355{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:1354

References static_type().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ cereal::access

friend class cereal::access
friend

Member Data Documentation

◆ value

bool Slic3r::ConfigOptionSingle< bool >::value
inherited

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