OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::client::FactorActions Struct Reference

Static Public Member Functions

static void set_start_pos (Iterator &start_pos, expr &out)
static void int_ (const MyContext *ctx, int &value, Iterator &end_pos, expr &out)
static void double_ (const MyContext *ctx, double &value, Iterator &end_pos, expr &out)
static void bool_ (const MyContext *ctx, bool &value, Iterator &end_pos, expr &out)
static void string_ (const MyContext *ctx, IteratorRange &it_range, expr &out)
static void expr_ (expr &value, Iterator &end_pos, expr &out)
static void minus_ (expr &value, expr &out)
static void not_ (expr &value, expr &out)
static void to_int (expr &value, expr &out)
static void round (expr &value, expr &out)
static void floor (expr &value, expr &out)
static void ceil (expr &value, expr &out)
static void noexpr (expr &out)

Detailed Description

Member Function Documentation

◆ bool_()

void Slic3r::client::FactorActions::bool_ ( const MyContext * ctx,
bool & value,
Iterator & end_pos,
expr & out )
inlinestatic
2168 {
2169 if (ctx->skipping()) {
2170 out.reset();
2171 out.it_range.end() = end_pos;
2172 } else
2173 out = expr(value, out.it_range.begin(), end_pos);
2174 }

References Slic3r::client::expr::it_range, Slic3r::client::expr::reset(), and Slic3r::client::MyContext::skipping().

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

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

◆ ceil()

void Slic3r::client::FactorActions::ceil ( expr & value,
expr & out )
inlinestatic
2236 { out = value.ceil(out.it_range.begin());}

References Slic3r::client::expr::ceil(), and Slic3r::client::expr::it_range.

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

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

◆ double_()

void Slic3r::client::FactorActions::double_ ( const MyContext * ctx,
double & value,
Iterator & end_pos,
expr & out )
inlinestatic
2161 {
2162 if (ctx->skipping()) {
2163 out.reset();
2164 out.it_range.end() = end_pos;
2165 } else
2166 out = expr(value, out.it_range.begin(), end_pos);
2167 }

References Slic3r::client::expr::it_range, Slic3r::client::expr::reset(), and Slic3r::client::MyContext::skipping().

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

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

◆ expr_()

void Slic3r::client::FactorActions::expr_ ( expr & value,
Iterator & end_pos,
expr & out )
inlinestatic
2224 { auto begin_pos = out.it_range.begin(); out = expr(std::move(value), begin_pos, end_pos); }

References Slic3r::client::expr::it_range.

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

Here is the caller graph for this function:

◆ floor()

void Slic3r::client::FactorActions::floor ( expr & value,
expr & out )
inlinestatic
2234 { out = value.floor(out.it_range.begin()); }

References Slic3r::client::expr::floor(), and Slic3r::client::expr::it_range.

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

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

◆ int_()

void Slic3r::client::FactorActions::int_ ( const MyContext * ctx,
int & value,
Iterator & end_pos,
expr & out )
inlinestatic
2154 {
2155 if (ctx->skipping()) {
2156 out.reset();
2157 out.it_range.end() = end_pos;
2158 } else
2159 out = expr(value, out.it_range.begin(), end_pos);
2160 }

References Slic3r::client::expr::it_range, Slic3r::client::expr::reset(), and Slic3r::client::MyContext::skipping().

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

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

◆ minus_()

void Slic3r::client::FactorActions::minus_ ( expr & value,
expr & out )
inlinestatic
2226 { out = value.unary_minus(out.it_range.begin()); }

References Slic3r::client::expr::it_range, and Slic3r::client::expr::unary_minus().

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

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

◆ noexpr()

void Slic3r::client::FactorActions::noexpr ( expr & out)
inlinestatic
2238{ out.reset(); }

References Slic3r::client::expr::reset().

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_()

void Slic3r::client::FactorActions::not_ ( expr & value,
expr & out )
inlinestatic
2228 { out = value.unary_not(out.it_range.begin()); }

References Slic3r::client::expr::it_range, and Slic3r::client::expr::unary_not().

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

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

◆ round()

void Slic3r::client::FactorActions::round ( expr & value,
expr & out )
inlinestatic
2232 { out = value.round(out.it_range.begin()); }

References Slic3r::client::expr::it_range, and Slic3r::client::expr::round().

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

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

◆ set_start_pos()

void Slic3r::client::FactorActions::set_start_pos ( Iterator & start_pos,
expr & out )
inlinestatic
2153 { out.it_range = IteratorRange(start_pos, start_pos); }
boost::iterator_range< Iterator > IteratorRange
Definition PlaceholderParser.cpp:222

References Slic3r::client::expr::it_range.

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

Here is the caller graph for this function:

◆ string_()

void Slic3r::client::FactorActions::string_ ( const MyContext * ctx,
IteratorRange & it_range,
expr & out )
inlinestatic
2175 {
2176 if (ctx->skipping()) {
2177 out.reset();
2178 out.it_range = it_range;
2179 } else {
2180 // Unescape the string, UTF-8 safe.
2181 std::string s;
2182 auto begin = std::next(it_range.begin());
2183 auto end = std::prev(it_range.end());
2184 assert(begin <= end);
2185 {
2186 // 1) Get the size of the string after unescaping.
2187 size_t len = 0;
2188 for (auto it = begin; it != end;) {
2189 if (*it == '\\') {
2190 if (++ it == end ||
2191 (*it != 'r' && *it != 'n' && *it != '"' && *it != '\\'))
2192 ctx->throw_exception(L("Invalid escape sequence"), {std::prev(it), std::next(it) });
2193 ++ len;
2194 ++ it;
2195 } else {
2196 size_t n = get_utf8_sequence_length(&*it, end - it);
2197 len += n;
2198 it += n;
2199 }
2200 }
2201 // and reserve the string.
2202 s.reserve(len);
2203 }
2204 // 2) Copy & unescape the string.
2205 for (auto it = begin; it != end;) {
2206 if (*it == '\\') {
2207 char c = *(++ it);
2208 if (c == 'r')
2209 c = '\r';
2210 else if (c == 'n')
2211 c = '\n';
2212 s += c;
2213 ++ it;
2214 } else {
2215 size_t n = get_utf8_sequence_length(&*it, end - it);
2216 s.append(&*it, n);
2217 it += n;
2218 }
2219 }
2220 out = expr(std::move(s), it_range.begin(), it_range.end());
2221 }
2222 }
#define L(s)
Definition ExtrusionEntity.cpp:25
T * begin(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:838
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:841
size_t get_utf8_sequence_length(const std::string &text, size_t pos)
Definition utils.cpp:1311

References Slic3r::get_utf8_sequence_length(), Slic3r::client::expr::it_range, L, Slic3r::client::expr::reset(), Slic3r::client::MyContext::skipping(), and Slic3r::client::MyContext::throw_exception().

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

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

◆ to_int()

void Slic3r::client::FactorActions::to_int ( expr & value,
expr & out )
inlinestatic
2230 { out = value.unary_integer(out.it_range.begin()); }

References Slic3r::client::expr::it_range, and Slic3r::client::expr::unary_integer().

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

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

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