Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::client::expr Struct Reference
+ Collaboration diagram for Slic3r::client::expr:

Classes

union  Data
 

Public Types

enum  Type {
  TYPE_EMPTY = 0 , TYPE_BOOL , TYPE_INT , TYPE_DOUBLE ,
  TYPE_STRING
}
 
enum  Function2ParamsType { FUNCTION_MIN , FUNCTION_MAX }
 

Public Member Functions

 expr ()
 
 expr (const expr &rhs)
 
 expr (expr &&rhs)
 
 expr (bool b)
 
 expr (bool b, const Iterator &it_begin, const Iterator &it_end)
 
 expr (int i)
 
 expr (int i, const Iterator &it_begin, const Iterator &it_end)
 
 expr (double d)
 
 expr (double d, const Iterator &it_begin, const Iterator &it_end)
 
 expr (const char *s)
 
 expr (const std::string &s)
 
 expr (std::string &&s)
 
 expr (const std::string &s, const Iterator &it_begin, const Iterator &it_end)
 
 expr (expr &&rhs, const Iterator &it_begin, const Iterator &it_end)
 
exproperator= (const expr &rhs)
 
exproperator= (expr &&rhs)
 
void reset ()
 
 ~expr ()
 
Type type () const
 
bool numeric_type () const
 
bool & b ()
 
bool b () const
 
void set_b (bool v)
 
void set_b_lite (bool v)
 
int & i ()
 
int i () const
 
void set_i (int v)
 
void set_i_lite (int v)
 
int as_i () const
 
int as_i_rounded () const
 
double & d ()
 
double d () const
 
void set_d (double v)
 
void set_d_lite (double v)
 
double as_d () const
 
std::string & s ()
 
const std::string & s () const
 
void set_s (const std::string &s)
 
void set_s (std::string &&s)
 
void set_s (const char *s)
 
std::string to_string () const
 
expr unary_minus (const Iterator start_pos) const
 
expr unary_integer (const Iterator start_pos) const
 
expr round (const Iterator start_pos) const
 
expr unary_not (const Iterator start_pos) const
 
exproperator+= (const expr &rhs)
 
exproperator-= (const expr &rhs)
 
exproperator*= (const expr &rhs)
 
exproperator/= (const expr &rhs)
 
exproperator%= (const expr &rhs)
 
void throw_exception (const char *message) const
 
void throw_if_not_numeric (const char *message) const
 

Static Public Member Functions

static void to_string2 (expr &self, std::string &out)
 
static void evaluate_boolean (expr &self, bool &out)
 
static void evaluate_boolean_to_string (expr &self, std::string &out)
 
static void compare_op (expr &lhs, expr &rhs, char op, bool invert)
 
static void equal (expr &lhs, expr &rhs)
 
static void not_equal (expr &lhs, expr &rhs)
 
static void lower (expr &lhs, expr &rhs)
 
static void greater (expr &lhs, expr &rhs)
 
static void leq (expr &lhs, expr &rhs)
 
static void geq (expr &lhs, expr &rhs)
 
static void throw_if_not_numeric (const expr &param)
 
static void function_2params (expr &param1, expr &param2, Function2ParamsType fun)
 
static void min (expr &param1, expr &param2)
 
static void max (expr &param1, expr &param2)
 
static void random (expr &param1, expr &param2, std::mt19937 &rng)
 
template<bool leading_zeros>
static void digits (expr &param1, expr &param2, expr &param3)
 
static void regex_op (const expr &lhs, IteratorRange &rhs, char op, expr &out)
 
static void regex_matches (expr &lhs, IteratorRange &rhs)
 
static void regex_doesnt_match (expr &lhs, IteratorRange &rhs)
 
static void one_of_test_init (expr &out)
 
template<bool RegEx>
static void one_of_test (const expr &match, const expr &pattern, expr &out)
 
static void one_of_test_regex (const expr &match, IteratorRange &pattern, expr &out)
 
static void logical_op (expr &lhs, expr &rhs, char op)
 
static void logical_or (expr &lhs, expr &rhs)
 
static void logical_and (expr &lhs, expr &rhs)
 

Public Attributes

IteratorRange it_range
 

Private Member Functions

void set_s_take_ownership (std::string *s)
 

Private Attributes

Type m_type = TYPE_EMPTY
 
union Slic3r::client::expr::Data m_data
 

Detailed Description

Member Enumeration Documentation

◆ Function2ParamsType

Enumerator
FUNCTION_MIN 
FUNCTION_MAX 
574 {
577 };
@ FUNCTION_MAX
Definition PlaceholderParser.cpp:576
@ FUNCTION_MIN
Definition PlaceholderParser.cpp:575

◆ Type

Enumerator
TYPE_EMPTY 
TYPE_BOOL 
TYPE_INT 
TYPE_DOUBLE 
TYPE_STRING 
248 {
249 TYPE_EMPTY = 0,
250 TYPE_BOOL,
251 TYPE_INT,
254 };
@ TYPE_INT
Definition PlaceholderParser.cpp:251
@ TYPE_BOOL
Definition PlaceholderParser.cpp:250
@ TYPE_STRING
Definition PlaceholderParser.cpp:253
@ TYPE_DOUBLE
Definition PlaceholderParser.cpp:252
@ TYPE_EMPTY
Definition PlaceholderParser.cpp:249

Constructor & Destructor Documentation

◆ expr() [1/14]

Slic3r::client::expr::expr ( )
inline
195{}

Referenced by round(), unary_integer(), unary_minus(), and unary_not().

+ Here is the caller graph for this function:

◆ expr() [2/14]

Slic3r::client::expr::expr ( const expr rhs)
inline
196 : m_type(rhs.type()), it_range(rhs.it_range)
197 { if (rhs.type() == TYPE_STRING) m_data.s = new std::string(*rhs.m_data.s); else m_data.set(rhs.m_data); }
union Slic3r::client::expr::Data m_data
IteratorRange it_range
Definition PlaceholderParser.cpp:325
Type m_type
Definition PlaceholderParser.cpp:749
std::string * s
Definition PlaceholderParser.cpp:755
void set(const Data &rhs)
Definition PlaceholderParser.cpp:758

References m_data, Slic3r::client::expr::Data::s, Slic3r::client::expr::Data::set(), type(), and TYPE_STRING.

+ Here is the call graph for this function:

◆ expr() [3/14]

Slic3r::client::expr::expr ( expr &&  rhs)
inline
198: expr(std::move(rhs), rhs.it_range.begin(), rhs.it_range.end()) {}
expr()
Definition PlaceholderParser.cpp:195

◆ expr() [4/14]

Slic3r::client::expr::expr ( bool  b)
inlineexplicit
200: m_type(TYPE_BOOL) { m_data.b = b; }
bool & b()
Definition PlaceholderParser.cpp:258
bool b
Definition PlaceholderParser.cpp:752

References b(), Slic3r::client::expr::Data::b, and m_data.

+ Here is the call graph for this function:

◆ expr() [5/14]

Slic3r::client::expr::expr ( bool  b,
const Iterator it_begin,
const Iterator it_end 
)
inlineexplicit
201: m_type(TYPE_BOOL), it_range(it_begin, it_end) { m_data.b = b; }

References b(), Slic3r::client::expr::Data::b, and m_data.

+ Here is the call graph for this function:

◆ expr() [6/14]

Slic3r::client::expr::expr ( int  i)
inlineexplicit
202: m_type(TYPE_INT) { m_data.i = i; }
int & i()
Definition PlaceholderParser.cpp:262
int i
Definition PlaceholderParser.cpp:753

References i(), Slic3r::client::expr::Data::i, and m_data.

+ Here is the call graph for this function:

◆ expr() [7/14]

Slic3r::client::expr::expr ( int  i,
const Iterator it_begin,
const Iterator it_end 
)
inlineexplicit
203: m_type(TYPE_INT), it_range(it_begin, it_end) { m_data.i = i; }

References i(), Slic3r::client::expr::Data::i, and m_data.

+ Here is the call graph for this function:

◆ expr() [8/14]

Slic3r::client::expr::expr ( double  d)
inlineexplicit
204: m_type(TYPE_DOUBLE) { m_data.d = d; }
double & d()
Definition PlaceholderParser.cpp:268
double d
Definition PlaceholderParser.cpp:754

References d(), Slic3r::client::expr::Data::d, and m_data.

+ Here is the call graph for this function:

◆ expr() [9/14]

Slic3r::client::expr::expr ( double  d,
const Iterator it_begin,
const Iterator it_end 
)
inlineexplicit
205: m_type(TYPE_DOUBLE), it_range(it_begin, it_end) { m_data.d = d; }

References d(), Slic3r::client::expr::Data::d, and m_data.

+ Here is the call graph for this function:

◆ expr() [10/14]

Slic3r::client::expr::expr ( const char *  s)
inlineexplicit
206: m_type(TYPE_STRING) { m_data.s = new std::string(s); }
std::string & s()
Definition PlaceholderParser.cpp:273

References m_data, s(), and Slic3r::client::expr::Data::s.

+ Here is the call graph for this function:

◆ expr() [11/14]

Slic3r::client::expr::expr ( const std::string &  s)
inlineexplicit
207: m_type(TYPE_STRING) { m_data.s = new std::string(s); }

References m_data, s(), and Slic3r::client::expr::Data::s.

+ Here is the call graph for this function:

◆ expr() [12/14]

Slic3r::client::expr::expr ( std::string &&  s)
inlineexplicit
208: m_type(TYPE_STRING) { m_data.s = new std::string(std::move(s)); }

References m_data, s(), and Slic3r::client::expr::Data::s.

+ Here is the call graph for this function:

◆ expr() [13/14]

Slic3r::client::expr::expr ( const std::string &  s,
const Iterator it_begin,
const Iterator it_end 
)
inlineexplicit
209 :
210 m_type(TYPE_STRING), it_range(it_begin, it_end) { m_data.s = new std::string(s); }

References m_data, s(), and Slic3r::client::expr::Data::s.

+ Here is the call graph for this function:

◆ expr() [14/14]

Slic3r::client::expr::expr ( expr &&  rhs,
const Iterator it_begin,
const Iterator it_end 
)
inlineexplicit
211 : m_type(rhs.type()), it_range{ it_begin, it_end }
212 {
213 m_data.set(rhs.m_data);
214 rhs.m_type = TYPE_EMPTY;
215 }

References m_data, Slic3r::client::expr::Data::set(), and TYPE_EMPTY.

+ Here is the call graph for this function:

◆ ~expr()

Slic3r::client::expr::~expr ( )
inline
246{ reset(); }
void reset()
Definition PlaceholderParser.cpp:240

References reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ as_d()

double Slic3r::client::expr::as_d ( ) const
inline
272{ return this->type() == TYPE_DOUBLE ? this->d() : double(this->i()); }
Type type() const
Definition PlaceholderParser.cpp:255

References d(), i(), type(), and TYPE_DOUBLE.

Referenced by compare_op(), digits(), Slic3r::client::InterpolateTableContext::evaluate(), function_2params(), operator%=(), operator*=(), operator+=(), operator-=(), operator/=(), random(), Slic3r::client::MyContext::scalar_variable_assign_scalar(), Slic3r::client::MyContext::vector_variable_assign_expr_with_count(), and Slic3r::client::MyContext::vector_variable_element_assign_scalar().

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

◆ as_i()

int Slic3r::client::expr::as_i ( ) const
inline
266{ return this->type() == TYPE_INT ? this->i() : int(this->d()); }

References d(), i(), type(), and TYPE_INT.

Referenced by digits(), function_2params(), random(), Slic3r::client::MyContext::scalar_variable_assign_scalar(), Slic3r::client::MyContext::vector_variable_assign_expr_with_count(), and Slic3r::client::MyContext::vector_variable_element_assign_scalar().

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

◆ as_i_rounded()

int Slic3r::client::expr::as_i_rounded ( ) const
inline
267{ return this->type() == TYPE_INT ? this->i() : int(std::round(this->d())); }
EIGEN_DEVICE_FUNC const RoundReturnType round() const
Definition ArrayCwiseUnaryOps.h:374
STL namespace.

References d(), i(), type(), and TYPE_INT.

Referenced by digits().

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

◆ b() [1/2]

◆ b() [2/2]

bool Slic3r::client::expr::b ( ) const
inline
259{ return m_data.b; }

References Slic3r::client::expr::Data::b, and m_data.

◆ compare_op()

static void Slic3r::client::expr::compare_op ( expr lhs,
expr rhs,
char  op,
bool  invert 
)
inlinestatic
521 {
522 if (lhs.type() == TYPE_EMPTY)
523 // Inside an if / else block to be skipped
524 return;
525 bool value = false;
526 if (lhs.numeric_type() && rhs.numeric_type()) {
527 // Both types are numeric.
528 switch (op) {
529 case '=':
530 value = (lhs.type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE) ?
531 (std::abs(lhs.as_d() - rhs.as_d()) < 1e-8) : (lhs.i() == rhs.i());
532 break;
533 case '<':
534 value = (lhs.type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE) ?
535 (lhs.as_d() < rhs.as_d()) : (lhs.i() < rhs.i());
536 break;
537 case '>':
538 default:
539 value = (lhs.type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE) ?
540 (lhs.as_d() > rhs.as_d()) : (lhs.i() > rhs.i());
541 break;
542 }
543 } else if (lhs.type() == TYPE_BOOL && rhs.type() == TYPE_BOOL) {
544 // Both type are bool.
545 if (op != '=')
546 boost::throw_exception(qi::expectation_failure<Iterator>(
547 lhs.it_range.begin(), rhs.it_range.end(), spirit::info("*Cannot compare the types.")));
548 value = lhs.b() == rhs.b();
549 } else if (lhs.type() == TYPE_STRING || rhs.type() == TYPE_STRING) {
550 // One type is string, the other could be converted to string.
551 value = (op == '=') ? (lhs.to_string() == rhs.to_string()) :
552 (op == '<') ? (lhs.to_string() < rhs.to_string()) : (lhs.to_string() > rhs.to_string());
553 } else {
554 boost::throw_exception(qi::expectation_failure<Iterator>(
555 lhs.it_range.begin(), rhs.it_range.end(), spirit::info("*Cannot compare the types.")));
556 }
557 lhs.reset();
558 lhs.set_b_lite(invert ? ! value : value);
559 }
std::string to_string() const
Definition PlaceholderParser.cpp:294

References as_d(), b(), i(), it_range, numeric_type(), reset(), set_b_lite(), to_string(), type(), TYPE_BOOL, TYPE_DOUBLE, TYPE_EMPTY, and TYPE_STRING.

Referenced by equal(), geq(), greater(), leq(), lower(), and not_equal().

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

◆ d() [1/2]

double & Slic3r::client::expr::d ( )
inline
268{ return m_data.d; }

References Slic3r::client::expr::Data::d, and m_data.

Referenced by expr(), expr(), as_d(), as_i(), as_i_rounded(), function_2params(), operator%=(), operator/=(), Slic3r::client::operator<<(), round(), Slic3r::client::MyContext::scalar_variable_new_from_scalar_expression(), to_string(), unary_integer(), unary_minus(), and Slic3r::client::MyContext::vector_variable_new_from_array().

+ Here is the caller graph for this function:

◆ d() [2/2]

double Slic3r::client::expr::d ( ) const
inline
269{ return m_data.d; }

References Slic3r::client::expr::Data::d, and m_data.

◆ digits()

template<bool leading_zeros>
static void Slic3r::client::expr::digits ( expr param1,
expr param2,
expr param3 
)
inlinestatic
626 {
627 if (param1.type() == TYPE_EMPTY)
628 // Inside an if / else block to be skipped
629 return;
630 throw_if_not_numeric(param1);
631 if (param2.type() != TYPE_INT)
632 param2.throw_exception("digits: second parameter must be integer");
633 bool has_decimals = param3.type() != TYPE_EMPTY;
634 if (has_decimals && param3.type() != TYPE_INT)
635 param3.throw_exception("digits: third parameter must be integer");
636
637 char buf[256];
638 int ndigits = std::clamp(param2.as_i(), 0, 64);
639 if (has_decimals) {
640 // Format as double.
641 int decimals = std::clamp(param3.as_i(), 0, 64);
642 sprintf(buf, leading_zeros ? "%0*.*lf" : "%*.*lf", ndigits, decimals, param1.as_d());
643 } else
644 // Format as int.
645 sprintf(buf, leading_zeros ? "%0*d" : "%*d", ndigits, param1.as_i_rounded());
646 param1.set_s(buf);
647 }
int as_i_rounded() const
Definition PlaceholderParser.cpp:267
double as_d() const
Definition PlaceholderParser.cpp:272
static void throw_if_not_numeric(const expr &param)
Definition PlaceholderParser.cpp:568

References as_d(), as_i(), as_i_rounded(), set_s(), throw_exception(), throw_if_not_numeric(), type(), TYPE_EMPTY, and TYPE_INT.

+ Here is the call graph for this function:

◆ equal()

static void Slic3r::client::expr::equal ( expr lhs,
expr rhs 
)
inlinestatic
561{ compare_op(lhs, rhs, '=', false); }
static void compare_op(expr &lhs, expr &rhs, char op, bool invert)
Definition PlaceholderParser.cpp:520

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ evaluate_boolean()

static void Slic3r::client::expr::evaluate_boolean ( expr self,
bool &  out 
)
inlinestatic
502 {
503 if (self.type() != TYPE_EMPTY) {
504 // Not inside an if / else block to be skipped
505 if (self.type() != TYPE_BOOL)
506 self.throw_exception("Not a boolean expression");
507 out = self.b();
508 }
509 }

References b(), throw_exception(), type(), TYPE_BOOL, and TYPE_EMPTY.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ evaluate_boolean_to_string()

static void Slic3r::client::expr::evaluate_boolean_to_string ( expr self,
std::string &  out 
)
inlinestatic
512 {
513 assert(self.type() != TYPE_EMPTY);
514 if (self.type() != TYPE_BOOL)
515 self.throw_exception("Not a boolean expression");
516 out = self.b() ? "true" : "false";
517 }

References b(), throw_exception(), type(), TYPE_BOOL, and TYPE_EMPTY.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ function_2params()

static void Slic3r::client::expr::function_2params ( expr param1,
expr param2,
Function2ParamsType  fun 
)
inlinestatic
580 {
581 if (param1.type() == TYPE_EMPTY)
582 // Inside an if / else block to be skipped
583 return;
584 throw_if_not_numeric(param1);
585 throw_if_not_numeric(param2);
586 if (param1.type() == TYPE_DOUBLE || param2.type() == TYPE_DOUBLE) {
587 double d = 0.;
588 switch (fun) {
589 case FUNCTION_MIN: d = std::min(param1.as_d(), param2.as_d()); break;
590 case FUNCTION_MAX: d = std::max(param1.as_d(), param2.as_d()); break;
591 default: param1.throw_exception("Internal error: invalid function");
592 }
593 param1.set_d_lite(d);
594 } else {
595 int i = 0;
596 switch (fun) {
597 case FUNCTION_MIN: i = std::min(param1.as_i(), param2.as_i()); break;
598 case FUNCTION_MAX: i = std::max(param1.as_i(), param2.as_i()); break;
599 default: param1.throw_exception("Internal error: invalid function");
600 }
601 param1.set_i_lite(i);
602 }
603 }

References as_d(), as_i(), d(), FUNCTION_MAX, FUNCTION_MIN, i(), set_d_lite(), set_i_lite(), throw_exception(), throw_if_not_numeric(), type(), TYPE_DOUBLE, and TYPE_EMPTY.

Referenced by max(), and min().

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

◆ geq()

static void Slic3r::client::expr::geq ( expr lhs,
expr rhs 
)
inlinestatic
566{ compare_op(lhs, rhs, '<', true ); }

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ greater()

static void Slic3r::client::expr::greater ( expr lhs,
expr rhs 
)
inlinestatic
564{ compare_op(lhs, rhs, '>', false); }

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ i() [1/2]

◆ i() [2/2]

int Slic3r::client::expr::i ( ) const
inline
263{ return m_data.i; }

References Slic3r::client::expr::Data::i, and m_data.

◆ leq()

static void Slic3r::client::expr::leq ( expr lhs,
expr rhs 
)
inlinestatic
565{ compare_op(lhs, rhs, '>', true ); }

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ logical_and()

static void Slic3r::client::expr::logical_and ( expr lhs,
expr rhs 
)
inlinestatic
731{ logical_op(lhs, rhs, '&'); }
static void logical_op(expr &lhs, expr &rhs, char op)
Definition PlaceholderParser.cpp:716

References logical_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ logical_op()

static void Slic3r::client::expr::logical_op ( expr lhs,
expr rhs,
char  op 
)
inlinestatic
717 {
718 if (lhs.type() == TYPE_EMPTY)
719 // Inside an if / else block to be skipped
720 return;
721 bool value = false;
722 if (lhs.type() == TYPE_BOOL && rhs.type() == TYPE_BOOL) {
723 value = (op == '|') ? (lhs.b() || rhs.b()) : (lhs.b() && rhs.b());
724 } else {
725 boost::throw_exception(qi::expectation_failure<Iterator>(
726 lhs.it_range.begin(), rhs.it_range.end(), spirit::info("*Cannot apply logical operation to non-boolean operators.")));
727 }
728 lhs.set_b_lite(value);
729 }

References b(), it_range, set_b_lite(), type(), TYPE_BOOL, and TYPE_EMPTY.

Referenced by logical_and(), and logical_or().

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

◆ logical_or()

static void Slic3r::client::expr::logical_or ( expr lhs,
expr rhs 
)
inlinestatic
730{ logical_op(lhs, rhs, '|'); }

References logical_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ lower()

static void Slic3r::client::expr::lower ( expr lhs,
expr rhs 
)
inlinestatic
563{ compare_op(lhs, rhs, '<', false); }

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ max()

static void Slic3r::client::expr::max ( expr param1,
expr param2 
)
inlinestatic
606{ function_2params(param1, param2, FUNCTION_MAX); }
static void function_2params(expr &param1, expr &param2, Function2ParamsType fun)
Definition PlaceholderParser.cpp:579

References function_2params(), and FUNCTION_MAX.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ min()

static void Slic3r::client::expr::min ( expr param1,
expr param2 
)
inlinestatic
605{ function_2params(param1, param2, FUNCTION_MIN); }

References function_2params(), and FUNCTION_MIN.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ not_equal()

static void Slic3r::client::expr::not_equal ( expr lhs,
expr rhs 
)
inlinestatic
562{ compare_op(lhs, rhs, '=', true ); }

References compare_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ numeric_type()

bool Slic3r::client::expr::numeric_type ( ) const
inline
256{ return m_type == TYPE_INT || m_type == TYPE_DOUBLE; }

References m_type, TYPE_DOUBLE, and TYPE_INT.

Referenced by Slic3r::client::MyContext::check_numeric(), compare_op(), and throw_if_not_numeric().

+ Here is the caller graph for this function:

◆ one_of_test()

template<bool RegEx>
static void Slic3r::client::expr::one_of_test ( const expr match,
const expr pattern,
expr out 
)
inlinestatic
681 {
682 if (match.type() == TYPE_EMPTY) {
683 // Inside an if / else block to be skipped
684 out.reset();
685 return;
686 }
687 if (! out.b()) {
688 if (match.type() != TYPE_STRING)
689 match.throw_exception("one_of(): First parameter (the string to match against) has to be a string value");
690 if (pattern.type() != TYPE_STRING)
691 match.throw_exception("one_of(): Pattern has to be a string value");
692 if (RegEx) {
693 try {
694 out.set_b(SLIC3R_REGEX_NAMESPACE::regex_match(match.s(), SLIC3R_REGEX_NAMESPACE::regex(pattern.s())));
695 } catch (SLIC3R_REGEX_NAMESPACE::regex_error &) {
696 // Syntax error in the regular expression
697 pattern.throw_exception("Regular expression compilation failed");
698 }
699 } else
700 out.set_b(match.s() == pattern.s());
701 }
702 }

References b(), reset(), s(), set_b(), throw_exception(), type(), TYPE_EMPTY, and TYPE_STRING.

+ Here is the call graph for this function:

◆ one_of_test_init()

static void Slic3r::client::expr::one_of_test_init ( expr out)
inlinestatic
677 {
678 out.set_b(false);
679 }

References set_b().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ one_of_test_regex()

static void Slic3r::client::expr::one_of_test_regex ( const expr match,
IteratorRange pattern,
expr out 
)
inlinestatic
703 {
704 if (match.type() == TYPE_EMPTY) {
705 // Inside an if / else block to be skipped
706 out.reset();
707 return;
708 }
709 if (! out.b()) {
710 if (match.type() != TYPE_STRING)
711 match.throw_exception("one_of(): First parameter (the string to match against) has to be a string value");
712 regex_op(match, pattern, '=', out);
713 }
714 }
static void regex_op(const expr &lhs, IteratorRange &rhs, char op, expr &out)
Definition PlaceholderParser.cpp:649

References b(), regex_op(), reset(), throw_exception(), type(), TYPE_EMPTY, and TYPE_STRING.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ operator%=()

expr & Slic3r::client::expr::operator%= ( const expr rhs)
inline
476 {
477 if (this->type() == TYPE_EMPTY) {
478 // Inside an if / else block to be skipped.
479 this->reset();
480 } else {
481 this->throw_if_not_numeric("Cannot divide a non-numeric type.");
482 rhs.throw_if_not_numeric("Cannot divide with a non-numeric type.");
483 if (rhs.type() == TYPE_INT ? (rhs.i() == 0) : (rhs.d() == 0.))
484 rhs.throw_exception("Division by zero");
485 if (this->type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE)
486 this->set_d_lite(std::fmod(this->as_d(), rhs.as_d()));
487 else
488 m_data.i %= rhs.i();
489 this->it_range = IteratorRange(this->it_range.begin(), rhs.it_range.end());
490 }
491 return *this;
492 }
boost::iterator_range< Iterator > IteratorRange
Definition PlaceholderParser.cpp:172
void throw_exception(const char *message) const
Definition PlaceholderParser.cpp:733
void set_d_lite(double v)
Definition PlaceholderParser.cpp:271

References as_d(), d(), i(), Slic3r::client::expr::Data::i, it_range, m_data, reset(), set_d_lite(), throw_exception(), throw_if_not_numeric(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_INT.

+ Here is the call graph for this function:

◆ operator*=()

expr & Slic3r::client::expr::operator*= ( const expr rhs)
inline
439 {
440 if (this->type() == TYPE_EMPTY) {
441 // Inside an if / else block to be skipped.
442 this->reset();
443 } else {
444 const char *err_msg = "Cannot multiply with non-numeric type.";
445 this->throw_if_not_numeric(err_msg);
446 rhs.throw_if_not_numeric(err_msg);
447 if (this->type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE)
448 this->set_d_lite(this->as_d() * rhs.as_d());
449 else
450 m_data.i *= rhs.i();
451 this->it_range = IteratorRange(this->it_range.begin(), rhs.it_range.end());
452 }
453 return *this;
454 }

References as_d(), i(), Slic3r::client::expr::Data::i, it_range, m_data, reset(), set_d_lite(), throw_if_not_numeric(), type(), TYPE_DOUBLE, and TYPE_EMPTY.

+ Here is the call graph for this function:

◆ operator+=()

expr & Slic3r::client::expr::operator+= ( const expr rhs)
inline
398 {
399 if (this->type() == TYPE_EMPTY) {
400 // Inside an if / else block to be skipped.
401 } else if (this->type() == TYPE_STRING) {
402 // Convert the right hand side to string and append.
403 *m_data.s += rhs.to_string();
404 } else if (rhs.type() == TYPE_STRING) {
405 // Conver the left hand side to string, append rhs.
406 this->set_s(this->to_string() + rhs.s());
407 } else {
408 const char *err_msg = "Cannot add non-numeric types.";
409 this->throw_if_not_numeric(err_msg);
410 rhs.throw_if_not_numeric(err_msg);
411 if (this->type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE)
412 this->set_d_lite(this->as_d() + rhs.as_d());
413 else
414 m_data.i += rhs.i();
415 }
416 this->it_range = IteratorRange(this->it_range.begin(), rhs.it_range.end());
417 return *this;
418 }
void set_s(const std::string &s)
Definition PlaceholderParser.cpp:275

References as_d(), i(), Slic3r::client::expr::Data::i, it_range, m_data, s(), Slic3r::client::expr::Data::s, set_d_lite(), set_s(), throw_if_not_numeric(), to_string(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_STRING.

+ Here is the call graph for this function:

◆ operator-=()

expr & Slic3r::client::expr::operator-= ( const expr rhs)
inline
421 {
422 if (this->type() == TYPE_EMPTY) {
423 // Inside an if / else block to be skipped.
424 this->reset();
425 } else {
426 const char *err_msg = "Cannot subtract non-numeric types.";
427 this->throw_if_not_numeric(err_msg);
428 rhs.throw_if_not_numeric(err_msg);
429 if (this->type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE)
430 this->set_d_lite(this->as_d() - rhs.as_d());
431 else
432 m_data.i -= rhs.i();
433 this->it_range = IteratorRange(this->it_range.begin(), rhs.it_range.end());
434 }
435 return *this;
436 }

References as_d(), i(), Slic3r::client::expr::Data::i, it_range, m_data, reset(), set_d_lite(), throw_if_not_numeric(), type(), TYPE_DOUBLE, and TYPE_EMPTY.

+ Here is the call graph for this function:

◆ operator/=()

expr & Slic3r::client::expr::operator/= ( const expr rhs)
inline
457 {
458 if (this->type() == TYPE_EMPTY) {
459 // Inside an if / else block to be skipped.
460 this->reset();
461 } else {
462 this->throw_if_not_numeric("Cannot divide a non-numeric type.");
463 rhs.throw_if_not_numeric("Cannot divide with a non-numeric type.");
464 if (rhs.type() == TYPE_INT ? (rhs.i() == 0) : (rhs.d() == 0.))
465 rhs.throw_exception("Division by zero");
466 if (this->type() == TYPE_DOUBLE || rhs.type() == TYPE_DOUBLE)
467 this->set_d_lite(this->as_d() / rhs.as_d());
468 else
469 m_data.i /= rhs.i();
470 this->it_range = IteratorRange(this->it_range.begin(), rhs.it_range.end());
471 }
472 return *this;
473 }

References as_d(), d(), i(), Slic3r::client::expr::Data::i, it_range, m_data, reset(), set_d_lite(), throw_exception(), throw_if_not_numeric(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_INT.

+ Here is the call graph for this function:

◆ operator=() [1/2]

expr & Slic3r::client::expr::operator= ( const expr rhs)
inline
217 {
218 if (rhs.type() == TYPE_STRING) {
219 this->set_s(rhs.s());
220 } else {
221 m_type = rhs.type();
222 m_data.set(rhs.m_data);
223 }
224 this->it_range = rhs.it_range;
225 return *this;
226 }

References it_range, m_data, m_type, s(), Slic3r::client::expr::Data::set(), set_s(), type(), and TYPE_STRING.

+ Here is the call graph for this function:

◆ operator=() [2/2]

expr & Slic3r::client::expr::operator= ( expr &&  rhs)
inline
229 {
230 if (this != &rhs) {
231 this->reset();
232 m_type = rhs.type();
233 this->it_range = rhs.it_range;
234 m_data.set(rhs.m_data);
235 rhs.m_type = TYPE_EMPTY;
236 }
237 return *this;
238 }

References it_range, m_data, m_type, reset(), Slic3r::client::expr::Data::set(), and TYPE_EMPTY.

+ Here is the call graph for this function:

◆ random()

static void Slic3r::client::expr::random ( expr param1,
expr param2,
std::mt19937 &  rng 
)
inlinestatic
610 {
611 if (param1.type() == TYPE_EMPTY)
612 // Inside an if / else block to be skipped
613 return;
614 throw_if_not_numeric(param1);
615 throw_if_not_numeric(param2);
616 if (param1.type() == TYPE_DOUBLE || param2.type() == TYPE_DOUBLE)
617 param1.set_d_lite(std::uniform_real_distribution<>(param1.as_d(), param2.as_d())(rng));
618 else
619 param1.set_i_lite(std::uniform_int_distribution<>(param1.as_i(), param2.as_i())(rng));
620 }

References as_d(), as_i(), set_d_lite(), set_i_lite(), throw_if_not_numeric(), type(), TYPE_DOUBLE, and TYPE_EMPTY.

Referenced by Slic3r::client::MyContext::random().

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

◆ regex_doesnt_match()

static void Slic3r::client::expr::regex_doesnt_match ( expr lhs,
IteratorRange rhs 
)
inlinestatic
675{ return regex_op(lhs, rhs, '!', lhs); }

References regex_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ regex_matches()

static void Slic3r::client::expr::regex_matches ( expr lhs,
IteratorRange rhs 
)
inlinestatic
674{ return regex_op(lhs, rhs, '=', lhs); }

References regex_op().

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ regex_op()

static void Slic3r::client::expr::regex_op ( const expr lhs,
IteratorRange rhs,
char  op,
expr out 
)
inlinestatic
650 {
651 if (lhs.type() == TYPE_EMPTY)
652 // Inside an if / else block to be skipped
653 return;
654 const std::string *subject = nullptr;
655 if (lhs.type() == TYPE_STRING) {
656 // One type is string, the other could be converted to string.
657 subject = &lhs.s();
658 } else {
659 lhs.throw_exception("Left hand side of a regex match must be a string.");
660 }
661 try {
662 std::string pattern(++ rhs.begin(), -- rhs.end());
663 bool result = SLIC3R_REGEX_NAMESPACE::regex_match(*subject, SLIC3R_REGEX_NAMESPACE::regex(pattern));
664 if (op == '!')
665 result = ! result;
666 out.set_b(result);
667 } catch (SLIC3R_REGEX_NAMESPACE::regex_error &ex) {
668 // Syntax error in the regular expression
669 boost::throw_exception(qi::expectation_failure<Iterator>(
670 rhs.begin(), rhs.end(), spirit::info(std::string("*Regular expression compilation failed: ") + ex.what())));
671 }
672 }

References s(), set_b(), throw_exception(), type(), TYPE_EMPTY, and TYPE_STRING.

Referenced by one_of_test_regex(), regex_doesnt_match(), and regex_matches().

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

◆ reset()

void Slic3r::client::expr::reset ( )
inline
241 {
242 if (this->type() == TYPE_STRING)
243 delete m_data.s;
245 }

References m_data, m_type, Slic3r::client::expr::Data::s, type(), TYPE_EMPTY, and TYPE_STRING.

Referenced by ~expr(), Slic3r::client::FactorActions::bool_(), compare_op(), Slic3r::client::FactorActions::double_(), Slic3r::client::FactorActions::int_(), Slic3r::client::FactorActions::noexpr(), one_of_test(), one_of_test_regex(), operator%=(), operator*=(), operator-=(), operator/=(), operator=(), set_b(), set_d(), set_i(), and Slic3r::client::FactorActions::string_().

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

◆ round()

expr Slic3r::client::expr::round ( const Iterator  start_pos) const
inline
364 {
365 switch (this->type()) {
366 case TYPE_EMPTY:
367 // Inside an if / else block to be skipped.
368 return expr();
369 case TYPE_INT:
370 return expr(this->i(), start_pos, this->it_range.end());
371 case TYPE_DOUBLE:
372 return expr(static_cast<int>(std::round(this->d())), start_pos, this->it_range.end());
373 default:
374 this->throw_exception("Cannot round a non-numeric value.");
375 }
376 assert(false);
377 // Suppress compiler warnings.
378 return expr();
379 }

References expr(), d(), i(), throw_exception(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_INT.

Referenced by Slic3r::client::FactorActions::round().

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

◆ s() [1/2]

std::string & Slic3r::client::expr::s ( )
inline
273{ return *m_data.s; }

References m_data, and Slic3r::client::expr::Data::s.

Referenced by expr(), expr(), expr(), expr(), one_of_test(), operator+=(), Slic3r::client::operator<<(), operator=(), regex_op(), Slic3r::client::MyContext::scalar_variable_new_from_scalar_expression(), set_s(), set_s(), set_s(), set_s_take_ownership(), to_string(), and Slic3r::client::MyContext::vector_variable_new_from_array().

+ Here is the caller graph for this function:

◆ s() [2/2]

const std::string & Slic3r::client::expr::s ( ) const
inline
274{ return *m_data.s; }

References m_data, and Slic3r::client::expr::Data::s.

◆ set_b()

void Slic3r::client::expr::set_b ( bool  v)
inline
260{ this->reset(); this->set_b_lite(v); }
void set_b_lite(bool v)
Definition PlaceholderParser.cpp:261

References reset(), and set_b_lite().

Referenced by Slic3r::client::MyContext::is_nil_test(), Slic3r::client::MyContext::is_vector_empty(), one_of_test(), one_of_test_init(), regex_op(), Slic3r::client::MyContext::scalar_variable_to_expr(), and Slic3r::client::MyContext::vector_element_to_expr().

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

◆ set_b_lite()

void Slic3r::client::expr::set_b_lite ( bool  v)
inline
261{ assert(this->type() != TYPE_STRING); Data tmp; tmp.b = v; m_data.set(tmp); m_type = TYPE_BOOL; }

References Slic3r::client::expr::Data::b, m_data, m_type, Slic3r::client::expr::Data::set(), type(), TYPE_BOOL, and TYPE_STRING.

Referenced by compare_op(), logical_op(), and set_b().

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

◆ set_d()

void Slic3r::client::expr::set_d ( double  v)
inline
270{ this->reset(); this->set_d_lite(v); }

References reset(), and set_d_lite().

Referenced by Slic3r::client::InterpolateTableContext::evaluate(), Slic3r::client::MyContext::scalar_variable_to_expr(), and Slic3r::client::MyContext::vector_element_to_expr().

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

◆ set_d_lite()

void Slic3r::client::expr::set_d_lite ( double  v)
inline
271{ assert(this->type() != TYPE_STRING); Data tmp; tmp.d = v; m_data.set(tmp); m_type = TYPE_DOUBLE; }

References Slic3r::client::expr::Data::d, m_data, m_type, Slic3r::client::expr::Data::set(), type(), TYPE_DOUBLE, and TYPE_STRING.

Referenced by function_2params(), operator%=(), operator*=(), operator+=(), operator-=(), operator/=(), random(), and set_d().

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

◆ set_i()

void Slic3r::client::expr::set_i ( int  v)
inline
264{ this->reset(); set_i_lite(v); }
void set_i_lite(int v)
Definition PlaceholderParser.cpp:265

References reset(), and set_i_lite().

Referenced by Slic3r::client::MyContext::scalar_variable_to_expr(), Slic3r::client::MyContext::vector_element_to_expr(), and Slic3r::client::MyContext::vector_size().

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

◆ set_i_lite()

void Slic3r::client::expr::set_i_lite ( int  v)
inline
265{ assert(this->type() != TYPE_STRING); Data tmp; tmp.i = v; m_data.set(tmp); m_type = TYPE_INT; }

References Slic3r::client::expr::Data::i, m_data, m_type, Slic3r::client::expr::Data::set(), type(), TYPE_INT, and TYPE_STRING.

Referenced by function_2params(), random(), and set_i().

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

◆ set_s() [1/3]

void Slic3r::client::expr::set_s ( const char *  s)
inline
287 {
288 if (this->type() == TYPE_STRING)
289 *m_data.s = s;
290 else
291 this->set_s_take_ownership(new std::string(s));
292 }
void set_s_take_ownership(std::string *s)
Definition PlaceholderParser.cpp:747

References m_data, s(), Slic3r::client::expr::Data::s, set_s_take_ownership(), type(), and TYPE_STRING.

+ Here is the call graph for this function:

◆ set_s() [2/3]

void Slic3r::client::expr::set_s ( const std::string &  s)
inline
275 {
276 if (this->type() == TYPE_STRING)
277 *m_data.s = s;
278 else
279 this->set_s_take_ownership(new std::string(s));
280 }

References m_data, s(), Slic3r::client::expr::Data::s, set_s_take_ownership(), type(), and TYPE_STRING.

Referenced by digits(), operator+=(), operator=(), Slic3r::client::MyContext::scalar_variable_to_expr(), and Slic3r::client::MyContext::vector_element_to_expr().

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

◆ set_s() [3/3]

void Slic3r::client::expr::set_s ( std::string &&  s)
inline
281 {
282 if (this->type() == TYPE_STRING)
283 *m_data.s = std::move(s);
284 else
285 this->set_s_take_ownership(new std::string(std::move(s)));
286 }

References m_data, s(), Slic3r::client::expr::Data::s, set_s_take_ownership(), type(), and TYPE_STRING.

+ Here is the call graph for this function:

◆ set_s_take_ownership()

void Slic3r::client::expr::set_s_take_ownership ( std::string *  s)
inlineprivate
747{ assert(this->type() != TYPE_STRING); Data tmp; tmp.s = s; m_data.set(tmp); m_type = TYPE_STRING; }

References m_data, m_type, s(), Slic3r::client::expr::Data::s, Slic3r::client::expr::Data::set(), type(), and TYPE_STRING.

Referenced by set_s(), set_s(), and set_s().

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

◆ throw_exception()

void Slic3r::client::expr::throw_exception ( const char *  message) const
inline

◆ throw_if_not_numeric() [1/2]

void Slic3r::client::expr::throw_if_not_numeric ( const char *  message) const
inline
740 {
741 if (! this->numeric_type())
742 this->throw_exception(message);
743 }
bool numeric_type() const
Definition PlaceholderParser.cpp:256

References numeric_type(), and throw_exception().

+ Here is the call graph for this function:

◆ throw_if_not_numeric() [2/2]

static void Slic3r::client::expr::throw_if_not_numeric ( const expr param)
inlinestatic
569 {
570 const char *err_msg = "Not a numeric type.";
571 param.throw_if_not_numeric(err_msg);
572 }

References throw_if_not_numeric().

Referenced by digits(), function_2params(), operator%=(), operator*=(), operator+=(), operator-=(), operator/=(), random(), and throw_if_not_numeric().

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

◆ to_string()

std::string Slic3r::client::expr::to_string ( ) const
inline
295 {
296 std::string out;
297 switch (this->type()) {
298 case TYPE_EMPTY:
299 // Inside an if / else block to be skipped.
300 break;
301 case TYPE_BOOL: out = this->b() ? "true" : "false"; break;
302 case TYPE_INT: out = std::to_string(this->i()); break;
303 case TYPE_DOUBLE:
304#if 0
305 // The default converter produces trailing zeros after the decimal point.
306 out = std::to_string(data.d);
307#else
308 // ostringstream default converter produces no trailing zeros after the decimal point.
309 // It seems to be doing what the old boost::to_string() did.
310 {
311 std::ostringstream ss;
312 ss << this->d();
313 out = ss.str();
314 }
315#endif
316 break;
317 case TYPE_STRING: out = this->s(); break;
318 default: break;
319 }
320 return out;
321 }
constexpr auto data(C &c) -> decltype(c.data())
Definition span.hpp:195

References b(), d(), i(), s(), type(), TYPE_BOOL, TYPE_DOUBLE, TYPE_EMPTY, TYPE_INT, and TYPE_STRING.

Referenced by compare_op(), operator+=(), Slic3r::client::MyContext::scalar_variable_assign_scalar(), to_string2(), Slic3r::client::MyContext::vector_variable_assign_expr_with_count(), and Slic3r::client::MyContext::vector_variable_element_assign_scalar().

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

◆ to_string2()

static void Slic3r::client::expr::to_string2 ( expr self,
std::string &  out 
)
inlinestatic
495 {
496 if (self.type() != TYPE_EMPTY)
497 // Not inside an if / else block to be skipped
498 out = self.to_string();
499 }

References to_string(), type(), and TYPE_EMPTY.

Referenced by Slic3r::client::macro_processor::macro_processor().

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

◆ type()

◆ unary_integer()

expr Slic3r::client::expr::unary_integer ( const Iterator  start_pos) const
inline
346 {
347 switch (this->type()) {
348 case TYPE_EMPTY:
349 // Inside an if / else block to be skipped.
350 return expr();
351 case TYPE_INT:
352 return expr(this->i(), start_pos, this->it_range.end());
353 case TYPE_DOUBLE:
354 return expr(static_cast<int>(this->d()), start_pos, this->it_range.end());
355 default:
356 this->throw_exception("Cannot convert to integer.");
357 }
358 assert(false);
359 // Suppress compiler warnings.
360 return expr();
361 }

References expr(), d(), i(), throw_exception(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_INT.

Referenced by Slic3r::client::FactorActions::to_int().

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

◆ unary_minus()

expr Slic3r::client::expr::unary_minus ( const Iterator  start_pos) const
inline
328 {
329 switch (this->type()) {
330 case TYPE_EMPTY:
331 // Inside an if / else block to be skipped.
332 return expr();
333 case TYPE_INT :
334 return expr(- this->i(), start_pos, this->it_range.end());
335 case TYPE_DOUBLE:
336 return expr(- this->d(), start_pos, this->it_range.end());
337 default:
338 this->throw_exception("Cannot apply unary minus operator.");
339 }
340 assert(false);
341 // Suppress compiler warnings.
342 return expr();
343 }

References expr(), d(), i(), throw_exception(), type(), TYPE_DOUBLE, TYPE_EMPTY, and TYPE_INT.

Referenced by Slic3r::client::FactorActions::minus_().

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

◆ unary_not()

expr Slic3r::client::expr::unary_not ( const Iterator  start_pos) const
inline
382 {
383 switch (this->type()) {
384 case TYPE_EMPTY:
385 // Inside an if / else block to be skipped.
386 return expr();
387 case TYPE_BOOL:
388 return expr(! this->b(), start_pos, this->it_range.end());
389 default:
390 this->throw_exception("Cannot apply a not operator.");
391 }
392 assert(false);
393 // Suppress compiler warnings.
394 return expr();
395 }

References expr(), b(), throw_exception(), type(), TYPE_BOOL, and TYPE_EMPTY.

Referenced by Slic3r::client::FactorActions::not_().

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

Member Data Documentation

◆ it_range

◆ m_data

◆ m_type


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