25 class formula_callable;
26 class variant_iterator;
37 explicit variant(
const std::vector<variant>& array);
38 explicit variant(
const std::string& str);
39 explicit variant(
const std::map<variant, variant>& map);
62 bool is_null()
const {
return type() == formula_variant::type::null; }
63 bool is_int()
const {
return type() == formula_variant::type::integer; }
66 bool is_list()
const {
return type() == formula_variant::type::list; }
67 bool is_string()
const {
return type() == formula_variant::type::string; }
68 bool is_map()
const {
return type() == formula_variant::type::map; }
78 const std::vector<variant>&
as_list()
const;
79 const std::map<variant, variant>&
as_map()
const;
85 must_be(formula_variant::type::object);
86 return value_cast<variant_callable>()->get_callable();
96 return std::dynamic_pointer_cast<T>(std::const_pointer_cast<formula_callable>(
as_callable()));
102 std::shared_ptr<T> res = std::dynamic_pointer_cast<T>(std::const_pointer_cast<formula_callable>(
as_callable()));
159 return wfl::value_cast<T>(
value_);
168 return value_->get_type();
Iterator class for the variant.
bool operator!=(const variant_iterator &that) const
const variant_value_base * container_
variant operator*() const
bool operator==(const variant_iterator &that) const
variant_iterator & operator--()
std::bidirectional_iterator_tag iterator_category
formula_variant::type type_
variant_iterator()
Constructor for a no-op iterator.
variant_iterator & operator++()
Base class for all variant types.
variant execute_variant(const variant &to_exec)
value_base_ptr value_
Variant value.
std::shared_ptr< T > try_convert() const
std::shared_ptr< T > value_cast() const
variant operator-() const
variant operator^(const variant &) const
int as_decimal() const
Returns variant's internal representation of decimal number: ie, 1.234 is represented as 1234.
variant concatenate(const variant &v) const
variant_iterator begin() const
variant & operator=(const variant &v)=default
variant operator/(const variant &) const
variant get_values() const
void serialize_from_string(const std::string &str)
const_formula_callable_ptr as_callable() const
bool operator>=(const variant &) const
void must_both_be(formula_variant::type t, const variant &second) const
variant(variant &&v)=default
std::size_t num_elements() const
variant(std::shared_ptr< T > callable)
formula_variant::type type() const
variant(const variant &v)=default
std::shared_ptr< T > convert_to() const
bool operator!=(const variant &) const
variant operator+(const variant &) const
bool contains(const variant &other) const
bool operator==(const variant &) const
bool operator>(const variant &) const
variant operator*(const variant &) const
variant get_member(const std::string &name) const
variant list_elements_mul(const variant &v) const
std::string serialize_to_string() const
variant list_elements_add(const variant &v) const
const std::string & as_string() const
std::string string_cast() const
variant list_elements_div(const variant &v) const
variant_iterator end() const
bool as_bool() const
Returns a boolean state of the variant value.
bool operator<(const variant &) const
variant & operator=(variant &&v)=default
variant operator[](std::size_t n) const
variant build_range(const variant &v) const
std::string type_string() const
Gets string name of the current value type.
variant operator%(const variant &) const
const std::vector< variant > & as_list() const
bool operator<=(const variant &) const
void must_be(formula_variant::type t) const
std::string to_debug_string(bool verbose=false, formula_seen_stack *seen=nullptr) const
const std::map< variant, variant > & as_map() const
bool is_null() const
Functions to test the type of the internal value.
variant list_elements_sub(const variant &v) const
std::shared_ptr< variant_value_base > value_base_ptr
std::vector< const_formula_callable_ptr > formula_seen_stack
std::shared_ptr< const formula_callable > const_formula_callable_ptr
static std::string get_string(enum_type key)
Converts a enum to its string equivalent.
static map_location::direction n