36 const int len = std::abs(limit -
value_) + 1;
38 std::vector<variant> res;
41 for(
int i =
value_; res.size() != res.capacity();
value_ < limit ? ++
i : --
i) {
50 std::ostringstream ss;
52 int fractional =
value_ % 1000;
53 int integer = (
value_ - fractional) / 1000;
57 if(integer == 0 &&
value_ < 0) {
64 fractional = std::abs(fractional);
66 if(fractional < 100) {
106 std::ostringstream ss;
111 }
else if(std::find(seen.begin(), seen.end(),
callable_) == seen.end()) {
119 for(
const auto& input : v) {
125 ss << input.name <<
" ";
128 ss <<
"(read-write) ";
130 ss <<
"(writeonly) ";
133 ss <<
"-> " <<
callable_->query_value(input.name).to_debug_string(verbose, &seen);
175 return callable_->query_value(utils::any_cast<const formula_input_vector::const_iterator&>(iter)->name);
180 ++utils::any_cast<formula_input_vector::const_iterator&>(iter);
185 --utils::any_cast<formula_input_vector::const_iterator&>(iter);
190 std::ostringstream ss;
218 std::ostringstream ss;
224 bool first_time =
true;
226 for(
const auto& member : container_) {
233 ss << to_string_detail(member, mod_func);
237 if(annotate_empty && container_.empty()) {
251 return to_string_impl(
false,
false, [](
const variant& v) {
return v.
string_cast(); });
275 ++utils::any_cast<typename T::const_iterator&>(iter);
281 --utils::any_cast<typename T::const_iterator&>(iter);
287 return utils::any_cast<typename T::const_iterator>(first) == utils::any_cast<typename T::const_iterator>(second);
301 const auto& other_list = value_cast<variant_list>(second);
304 throw type_error(
"List op requires two lists of the same length");
307 std::vector<variant> res;
311 res.push_back(op_func(
get_container()[
i], other_list->get_container()[
i]));
319 const auto& other_container = value_ref_cast<variant_list>(other).get_container();
336 const auto& other_container = value_ref_cast<variant_list>(other).get_container();
351 return *utils::any_cast<const variant_vector::const_iterator&>(iter);
356 std::ostringstream ss;
358 ss << mod_func(container_val.first);
360 ss << mod_func(container_val.second);
367 return get_container() == value_ref_cast<variant_map>(other).get_container();
372 return get_container() < value_ref_cast<variant_map>(other).get_container();
377 const variant_map_raw::value_type&
p = *utils::any_cast<const variant_map_raw::const_iterator&>(iter);
378 auto the_pair = std::make_shared<key_value_pair>(
p.first,
p.second);
virtual bool equals(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(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.
std::string to_string_impl(bool annotate, bool annotate_empty, mod_func_t mod_func) const
Implementation to handle string conversion for string_cast, get_serialized_string,...
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::size_t num_elements() const override
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.
variant_vector & get_container()
std::function< std::string(const variant &)> mod_func_t
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(const bool sign_value) const
variant build_range_variant(int limit) const
Iterator class for the variant.
variant_list(const variant_vector &vec)
virtual variant deref_iterator(const utils::any &) const override
Implements the dereference functionality of variant_iterator for a value of this type.
variant list_op(value_base_ptr second, std::function< variant(variant &, variant &)> op_func)
Applies the provided function to the corresponding variants in this and another list.
virtual bool less_than(variant_value_base &other) const override
Called to determine if this variant is less than another of the same type.
virtual bool equals(variant_value_base &other) const override
Called to determine if this variant is equal to another of the same type.
virtual std::string to_string_detail(const variant_map_raw::value_type &container_val, mod_func_t mod_func) const override
virtual variant deref_iterator(const utils::any &) const override
Implements the dereference functionality of variant_iterator for a value of this type.
virtual bool less_than(variant_value_base &other) const override
Called to determine if this variant is less than another of the same type.
virtual bool equals(variant_value_base &other) const override
Called to determine if this variant is equal to another of the same type.
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.
virtual std::size_t num_elements() const
Returns the number of elements in a 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
std::shared_ptr< variant_value_base > value_base_ptr
std::vector< variant > variant_vector
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
static map_location::direction n