Prusa Slicer 2.6.0
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 noexpr (expr &out)
 

Detailed Description

Member Function Documentation

◆ bool_()

static void Slic3r::client::FactorActions::bool_ ( const MyContext ctx,
bool &  value,
Iterator end_pos,
expr out 
)
inlinestatic
1842 {
1843 if (ctx->skipping()) {
1844 out.reset();
1845 out.it_range.end() = end_pos;
1846 } else
1847 out = expr(value, out.it_range.begin(), end_pos);
1848 }

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:

◆ double_()

static void Slic3r::client::FactorActions::double_ ( const MyContext ctx,
double &  value,
Iterator end_pos,
expr out 
)
inlinestatic
1835 {
1836 if (ctx->skipping()) {
1837 out.reset();
1838 out.it_range.end() = end_pos;
1839 } else
1840 out = expr(value, out.it_range.begin(), end_pos);
1841 }

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

static void Slic3r::client::FactorActions::expr_ ( expr value,
Iterator end_pos,
expr out 
)
inlinestatic
1898 { 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:

◆ int_()

static void Slic3r::client::FactorActions::int_ ( const MyContext ctx,
int &  value,
Iterator end_pos,
expr out 
)
inlinestatic
1828 {
1829 if (ctx->skipping()) {
1830 out.reset();
1831 out.it_range.end() = end_pos;
1832 } else
1833 out = expr(value, out.it_range.begin(), end_pos);
1834 }

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

static void Slic3r::client::FactorActions::minus_ ( expr value,
expr out 
)
inlinestatic
1900 { 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()

static void Slic3r::client::FactorActions::noexpr ( expr out)
inlinestatic
1908{ 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_()

static void Slic3r::client::FactorActions::not_ ( expr value,
expr out 
)
inlinestatic
1902 { 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()

static void Slic3r::client::FactorActions::round ( expr value,
expr out 
)
inlinestatic
1906 { 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()

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

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

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

+ Here is the caller graph for this function:

◆ string_()

static void Slic3r::client::FactorActions::string_ ( const MyContext ctx,
IteratorRange it_range,
expr out 
)
inlinestatic
1849 {
1850 if (ctx->skipping()) {
1851 out.reset();
1852 out.it_range = it_range;
1853 } else {
1854 // Unescape the string, UTF-8 safe.
1855 std::string s;
1856 auto begin = std::next(it_range.begin());
1857 auto end = std::prev(it_range.end());
1858 assert(begin <= end);
1859 {
1860 // 1) Get the size of the string after unescaping.
1861 size_t len = 0;
1862 for (auto it = begin; it != end;) {
1863 if (*it == '\\') {
1864 if (++ it == end ||
1865 (*it != 'r' && *it != 'n' && *it != '"' && *it != '\\'))
1866 ctx->throw_exception("Invalid escape sequence", {std::prev(it), std::next(it) });
1867 ++ len;
1868 ++ it;
1869 } else {
1870 size_t n = get_utf8_sequence_length(&*it, end - it);
1871 len += n;
1872 it += n;
1873 }
1874 }
1875 // and reserve the string.
1876 s.reserve(len);
1877 }
1878 // 2) Copy & unescape the string.
1879 for (auto it = begin; it != end;) {
1880 if (*it == '\\') {
1881 char c = *(++ it);
1882 if (c == 'r')
1883 c = '\r';
1884 else if (c == 'n')
1885 c = '\n';
1886 s += c;
1887 ++ it;
1888 } else {
1889 size_t n = get_utf8_sequence_length(&*it, end - it);
1890 s.append(&*it, n);
1891 it += n;
1892 }
1893 }
1894 out = expr(std::move(s), it_range.begin(), it_range.end());
1895 }
1896 }
size_t get_utf8_sequence_length(const std::string &text, size_t pos)
Definition utils.cpp:820
S::iterator begin(S &sh, const PathTag &)
Definition geometry_traits.hpp:614
S::iterator end(S &sh, const PathTag &)
Definition geometry_traits.hpp:620

References Slic3r::get_utf8_sequence_length(), Slic3r::client::expr::it_range, 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()

static void Slic3r::client::FactorActions::to_int ( expr value,
expr out 
)
inlinestatic
1904 { 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: