38 const int len = std::abs(limit -
value_) + 1;
40 std::vector<variant> res;
43 for(
int i =
value_; res.size() != res.capacity();
value_ < limit ? ++
i : --
i) {
52 std::ostringstream ss;
54 int fractional =
value_ % 1000;
55 int integer = (
value_ - fractional) / 1000;
59 if(integer == 0 &&
value_ < 0) {
66 fractional = std::abs(fractional);
68 if(fractional < 100) {
82 : callable_(std::move(callable))
108 std::ostringstream ss;
121 for(
const auto& input : v) {
127 ss << input.name <<
" ";
130 ss <<
"(read-write) ";
132 ss <<
"(writeonly) ";
135 ss <<
"-> " <<
callable_->query_value(input.name).to_debug_string(verbose, &seen);
148 const variant_callable& other_ref = value_ref_cast<variant_callable>(other);
154 const variant_callable& other_ref = value_ref_cast<variant_callable>(other);
177 return callable_->query_value(utils::any_cast<const formula_input_vector::const_iterator&>(iter)->name);
182 ++utils::any_cast<formula_input_vector::const_iterator&>(iter);
187 --utils::any_cast<formula_input_vector::const_iterator&>(iter);
192 std::ostringstream ss;
220 std::ostringstream ss;
226 bool first_time =
true;
228 for(
const auto& member : container()) {
235 ss << T::to_string_detail(member, mod_func);
239 if(annotate_empty && is_empty()) {
253 return to_string_impl(
false,
false, [](
const variant& v) {
return v.
string_cast(); });
280 ++utils::any_cast<decltype(std::cbegin(container()))&>(iter);
286 --utils::any_cast<decltype(std::cbegin(container()))&>(iter);
292 return utils::any_cast<decltype(std::cbegin(container()))>(first)
293 == utils::any_cast<decltype(std::cbegin(container()))>(second);
302 return *utils::any_cast<const variant_vector::const_iterator&>(iter);
307 std::ostringstream ss;
309 ss << op(value.first);
311 ss << op(value.second);
318 const variant_map_raw::value_type&
p = *utils::any_cast<const variant_map_raw::const_iterator&>(iter);
319 auto the_pair = std::make_shared<key_value_pair>(
p.first,
p.second);
virtual bool equals(const variant_value_base &other) const override
Called to determine if this variant is equal to another of the same type.
virtual std::string get_debug_string(formula_seen_stack &seen, bool verbose) const override
Returns debug info for the variant value.
variant_callable(const_formula_callable_ptr callable)
virtual std::string get_serialized_string() const override
Returns the stored variant value in formula syntax.
virtual variant deref_iterator(const utils::any &iter) const override
Implements the dereference functionality of variant_iterator for a value of this type.
virtual void iterator_inc(utils::any &iter) const override
Implements the increment functionality of variant_iterator for a value of this type.
virtual boost::iterator_range< variant_iterator > make_iterator() const override
Creates an iterator pair that can be used for iteration.
formula_input_vector inputs
virtual void iterator_dec(utils::any &iter) const override
Implements the decrement functionality of variant_iterator for a value of this type.
const_formula_callable_ptr callable_
virtual bool less_than(const variant_value_base &other) const override
Called to determine if this variant is less than another of the same type.
virtual std::string get_serialized_string() const override
Returns the stored variant value in formula syntax.
virtual std::string string_cast() const override
Returns the stored variant value in plain string form.
virtual void iterator_dec(utils::any &) const override
Implements the decrement functionality of variant_iterator for a value of this type.
virtual std::string get_debug_string(formula_seen_stack &seen, bool verbose) const override
Returns debug info for the variant value.
virtual boost::iterator_range< variant_iterator > make_iterator() const override
Creates an iterator pair that can be used for iteration.
std::function< std::string(const variant &)> to_string_op
virtual bool iterator_equals(const utils::any &first, const utils::any &second) const override
Implements the equality functionality of variant_iterator for a value of this type.
virtual void iterator_inc(utils::any &) const override
Implements the increment functionality of variant_iterator for a value of this type.
std::string to_string_impl(bool annotate, bool annotate_empty, const to_string_op &mod_func) const
String conversion helper for string_cast, get_serialized_string, and get_debug_string.
std::string to_string_impl(const bool sign_value) const
variant build_range_variant(int limit) const
Iterator class for the variant.
virtual variant deref_iterator(const utils::any &) const override
Implements the dereference functionality of variant_iterator for a value of this type.
virtual variant deref_iterator(const utils::any &) const override
Implements the dereference functionality of variant_iterator for a value of this type.
static std::string to_string_detail(const variant_map_raw::value_type &value, const to_string_op &op)
Helper for variant_container::to_string_impl.
virtual std::string get_serialized_string() const override
Returns the stored variant value in formula syntax.
Base class for all variant types.
virtual boost::iterator_range< variant_iterator > make_iterator() const
Creates an iterator pair that can be used for iteration.
virtual variant deref_iterator(const utils::any &iter) const
Implements the dereference functionality of variant_iterator for a value of this type.
std::string serialize_to_string() const
std::string string_cast() const
std::string to_debug_string(bool verbose=false, formula_seen_stack *seen=nullptr) const
bool contains(const Container &container, const Value &value)
Returns true iff value is found in container.
std::vector< const_formula_callable_ptr > formula_seen_stack
std::vector< formula_input > formula_input_vector
std::shared_ptr< const formula_callable > const_formula_callable_ptr