OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ConfigOptionPercent Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp>

Inheritance diagram for Slic3r::ConfigOptionPercent:
Collaboration diagram for Slic3r::ConfigOptionPercent:

Public Member Functions

 ConfigOptionPercent ()
 ConfigOptionPercent (double _value)
ConfigOptionType type () const override
ConfigOption * clone () const override
ConfigOptionPercent & operator= (const ConfigOption *opt)
bool operator== (const ConfigOptionPercent &rhs) const throw ()
bool operator< (const ConfigOptionPercent &rhs) const throw ()
double get_abs_value (double ratio_over) const
std::string serialize () const override
bool deserialize (const std::string &str, bool append=false) override
bool operator== (const ConfigOptionFloat &rhs) const throw ()
bool operator== (const ConfigOption &rhs) const override
double getFloat () const override
bool operator< (const ConfigOptionFloat &rhs) const throw ()
bool operator< (const double &rhs) const throw ()
 operator double () const
void set (const ConfigOption *rhs) override
bool operator!= (const double &rhs) const throw ()
bool operator!= (const ConfigOption &rhs) const
size_t hash () const override throw ()
virtual int getInt () const
virtual bool getBool () 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, std::vector< int > &default_index)

Static Public Member Functions

static ConfigOptionType static_type ()

Public Attributes

double value

Private Member Functions

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

Friends

class cereal::access

Detailed Description

Constructor & Destructor Documentation

◆ ConfigOptionPercent() [1/2]

Slic3r::ConfigOptionPercent::ConfigOptionPercent ( )
inline
1240: ConfigOptionFloat(0) {}
ConfigOptionFloat()
Definition Config.hpp:827

References Slic3r::ConfigOptionFloat::ConfigOptionFloat().

Referenced by Slic3r::ConfigOptionFloatOrPercent::ConfigOptionFloatOrPercent(), Slic3r::ConfigOptionFloatOrPercent::ConfigOptionFloatOrPercent(), clone(), operator<(), operator=(), and operator==().

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

◆ ConfigOptionPercent() [2/2]

Slic3r::ConfigOptionPercent::ConfigOptionPercent ( double _value)
inlineexplicit
1241: ConfigOptionFloat(_value) {}

References Slic3r::ConfigOptionFloat::ConfigOptionFloat().

Here is the call graph for this function:

Member Function Documentation

◆ apply_override()

virtual bool Slic3r::ConfigOption::apply_override ( const ConfigOption * rhs,
std::vector< int > & default_index )
inlinevirtualinherited
314 {
315 if (*this == *rhs)
316 return false;
317 *this = *rhs;
318 return true;
319 }
Definition Config.hpp:327

◆ clone()

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

Reimplemented from Slic3r::ConfigOptionFloat.

1245{ return new ConfigOptionPercent(*this); }
ConfigOptionPercent()
Definition Config.hpp:1240

References ConfigOptionPercent().

Here is the call graph for this function:

◆ deserialize()

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

Reimplemented from Slic3r::ConfigOptionFloat.

1263 {
1264 UNUSED(append);
1265 // don't try to parse the trailing % since it's optional
1266 std::istringstream iss(str);
1267 double value;
1268 iss >> value;
1269 if (iss.fail())
1270 return false;
1271 this->value = value;
1272 return true;
1273 }
double value
Definition Config.hpp:329
#define UNUSED(x)
Definition libslic3r.h:112
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157

References Slic3r::append(), UNUSED, and Slic3r::ConfigOptionSingle< double >::value.

Here is the call graph for this function:

◆ get_abs_value()

double Slic3r::ConfigOptionPercent::get_abs_value ( double ratio_over) const
inline
1251{ return ratio_over * this->value / 100; }

Referenced by Slic3r::ConfigBase::get_abs_value(), and Slic3r::GUI::ConfigManipulation::toggle_print_fff_options().

Here is the caller graph for this function:

◆ getBool()

virtual bool Slic3r::ConfigOption::getBool ( ) const
inlinevirtualinherited
296{ throw BadOptionTypeException("Calling ConfigOption::getBool on a non-boolean ConfigOption"); }

◆ getFloat()

double Slic3r::ConfigOptionFloat::getFloat ( ) const
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

832{ return this->value; }

Referenced by Slic3r::anonymous_namespace{SL1.cpp}::get_slice_params(), and Slic3r::GUI::ObjectGridTable::GetValueAsDouble().

Here is the caller graph for this function:

◆ getInt()

virtual int Slic3r::ConfigOption::getInt ( ) const
inlinevirtualinherited
294{ throw BadOptionTypeException("Calling ConfigOption::getInt on a non-int ConfigOption"); }

◆ hash()

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

Implements Slic3r::ConfigOption.

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

◆ is_nil()

virtual bool Slic3r::ConfigOption::is_nil ( ) const
inlinevirtualinherited
306{ return false; }

◆ is_scalar()

bool Slic3r::ConfigOption::is_scalar ( ) const
inlineinherited
301{ return (int(this->type()) & int(coVectorType)) == 0; }
virtual ConfigOptionType type() const=0

◆ is_vector()

bool Slic3r::ConfigOption::is_vector ( ) const
inlineinherited
302{ return ! this->is_scalar(); }
bool is_scalar() const
Definition Config.hpp:301

◆ nullable()

virtual bool Slic3r::ConfigOption::nullable ( ) const
inlinevirtualinherited
304{ return false; }

◆ operator double()

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

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

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

◆ operator<() [1/3]

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

References ConfigOptionFloat().

Here is the call graph for this function:

◆ operator<() [2/3]

bool Slic3r::ConfigOptionPercent::operator< ( const ConfigOptionPercent & rhs) const
throw ( )
inline
1249{ return this->value < rhs.value; }

References ConfigOptionPercent().

Here is the call graph for this function:

◆ operator<() [3/3]

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

◆ operator=()

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

References ConfigOptionPercent(), and Slic3r::ConfigOptionSingle< double >::set().

Here is the call graph for this function:

◆ operator==() [1/3]

bool Slic3r::ConfigOptionFloat::operator== ( const ConfigOption & rhs) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOptionFloat.

857 {
858 if (rhs.type() != this->type())
859 throw ConfigurationError("ConfigOptionFloat: Comparing incompatible types");
860 assert(dynamic_cast<const ConfigOptionFloat*>(&rhs));
861 return *this == *static_cast<const ConfigOptionFloat*>(&rhs);
862 }

◆ operator==() [2/3]

bool Slic3r::ConfigOptionFloat::operator== ( const ConfigOptionFloat & rhs) const
throw ( )
inline
834{ return is_approx(this->value, rhs.value); }
constexpr bool is_approx(Number value, Number test_value, Number precision=EPSILON)
Definition libslic3r.h:320

◆ operator==() [3/3]

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

References ConfigOptionPercent().

Here is the call graph for this function:

◆ overriden_by()

virtual bool Slic3r::ConfigOption::overriden_by ( const ConfigOption * rhs) const
inlinevirtualinherited
309 {
310 assert(! this->nullable() && ! rhs->nullable());
311 return *this != *rhs;
312 }
virtual bool nullable() const
Definition Config.hpp:304

◆ serialize() [1/2]

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

Reimplemented from Slic3r::ConfigOptionFloat.

1254 {
1255 std::ostringstream ss;
1256 ss << this->value;
1257 std::string s(ss.str());
1258 s += "%";
1259 return s;
1260 }

◆ serialize() [2/2]

template<class Archive>
void Slic3r::ConfigOptionPercent::serialize ( Archive & ar)
inlineprivate
1277{ ar(cereal::base_class<ConfigOptionFloat>(this)); }

◆ set()

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

Implements Slic3r::ConfigOption.

334 {
335 if (rhs->type() != this->type())
336 throw ConfigurationError("ConfigOptionSingle: Assigning an incompatible type");
337 assert(dynamic_cast<const ConfigOptionSingle<T>*>(rhs));
338 this->value = static_cast<const ConfigOptionSingle<T>*>(rhs)->value;
339 }

Referenced by Slic3r::ConfigOptionFloat::operator=(), and Slic3r::ConfigOptionPercent::operator=().

Here is the caller graph for this function:

◆ setInt()

virtual void Slic3r::ConfigOption::setInt ( int )
inlinevirtualinherited
297{ throw BadOptionTypeException("Calling ConfigOption::setInt on a non-int ConfigOption"); }

◆ static_type()

ConfigOptionType Slic3r::ConfigOptionPercent::static_type ( )
inlinestatic
1243{ return coPercent; }
@ coPercent
Definition Config.hpp:196

References Slic3r::coPercent.

Referenced by type().

Here is the caller graph for this function:

◆ type()

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

Reimplemented from Slic3r::ConfigOptionFloat.

1244{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:1243

References static_type().

Here is the call graph for this function:

◆ cereal::access

friend class cereal::access
friend

References cereal::access.

Referenced by cereal::access.

Member Data Documentation

◆ value


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp