Base class for all variant types. More...
#include <variant_value.hpp>
Public Member Functions | |
virtual std::size_t | num_elements () const |
Returns the number of elements in a type. More... | |
virtual bool | is_empty () const |
Whether the stored value is considered empty or not. More... | |
virtual std::string | string_cast () const |
Returns the stored variant value in plain string form. More... | |
virtual std::string | get_serialized_string () const |
Returns the stored variant value in formula syntax. More... | |
virtual std::string | get_debug_string (formula_seen_stack &, bool) const |
Returns debug info for the variant value. More... | |
virtual bool | as_bool () const |
Returns a bool expression of the variant value. More... | |
virtual bool | equals (variant_value_base &) const |
Called to determine if this variant is equal to another of the same type. More... | |
virtual bool | less_than (variant_value_base &) const |
Called to determine if this variant is less than another of the same type. More... | |
virtual const formula_variant::type & | get_type () const |
Returns the id of the variant type. More... | |
virtual boost::iterator_range< variant_iterator > | make_iterator () const |
Creates an iterator pair that can be used for iteration. More... | |
virtual variant | deref_iterator (const utils::any &iter) const |
Implements the dereference functionality of variant_iterator for a value of this type. More... | |
virtual void | iterator_inc (utils::any &) const |
Implements the increment functionality of variant_iterator for a value of this type. More... | |
virtual void | iterator_dec (utils::any &) const |
Implements the decrement functionality of variant_iterator for a value of this type. More... | |
virtual bool | iterator_equals (const utils::any &, const utils::any &) const |
Implements the equality functionality of variant_iterator for a value of this type. More... | |
virtual | ~variant_value_base () |
Base class for all variant types.
This provides a common interface for all type classes to implement, as well as giving variant a base pointer type for its value member. It also serves as the implementation of the 'null' variant value.
Do note this class should not implement any data members.
Definition at line 75 of file variant_value.hpp.
|
inlinevirtual |
Definition at line 187 of file variant_value.hpp.
|
inlinevirtual |
Returns a bool expression of the variant value.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, wfl::variant_string, wfl::variant_callable, and wfl::variant_numeric.
Definition at line 109 of file variant_value.hpp.
|
virtual |
Implements the dereference functionality of variant_iterator for a value of this type.
iter | The opaque reference that was passed to the variant_iterator by make_iterator. |
Reimplemented in wfl::variant_callable, wfl::variant_map, and wfl::variant_list.
Definition at line 29 of file variant_value.cpp.
Referenced by wfl::variant_iterator::operator*().
|
inlinevirtual |
Called to determine if this variant is equal to another of the same type.
This function is only called if get_type() returns the same result for both arguments.
Reimplemented in wfl::variant_map, wfl::variant_list, wfl::variant_string, wfl::variant_callable, and wfl::variant_numeric.
Definition at line 118 of file variant_value.hpp.
|
inlinevirtual |
Returns debug info for the variant value.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, wfl::variant_callable, wfl::variant_string, wfl::variant_decimal, and wfl::variant_int.
Definition at line 103 of file variant_value.hpp.
References get_serialized_string().
|
inlinevirtual |
Returns the stored variant value in formula syntax.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, wfl::variant_string, wfl::variant_callable, wfl::variant_decimal, and wfl::variant_int.
Definition at line 97 of file variant_value.hpp.
Referenced by get_debug_string().
|
inlinevirtual |
Returns the id of the variant type.
Reimplemented in wfl::variant_map, wfl::variant_list, wfl::variant_string, wfl::variant_callable, wfl::variant_decimal, and wfl::variant_int.
Definition at line 133 of file variant_value.hpp.
|
inlinevirtual |
Whether the stored value is considered empty or not.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_string.
Definition at line 85 of file variant_value.hpp.
|
inlinevirtual |
Implements the decrement functionality of variant_iterator for a value of this type.
The parameter is an opaque reference that was passed to the variant_iterator by make_iterator.
Reimplemented in wfl::variant_callable, wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, and wfl::variant_container< variant_vector >.
Definition at line 171 of file variant_value.hpp.
Referenced by wfl::variant_iterator::operator--().
|
inlinevirtual |
Implements the equality functionality of variant_iterator for a value of this type.
Note that this is only called if the two iterators are already known to be of the same type.
The first parameter is an opaque reference that was passed to the variant_iterator by make_iterator. The second parameter is an opaque reference that was passed to the variant_iterator by make_iterator.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_callable.
Definition at line 182 of file variant_value.hpp.
Referenced by wfl::variant_iterator::operator==().
|
inlinevirtual |
Implements the increment functionality of variant_iterator for a value of this type.
The parameter is an opaque reference that was passed to the variant_iterator by make_iterator.
Reimplemented in wfl::variant_callable, wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, and wfl::variant_container< variant_vector >.
Definition at line 163 of file variant_value.hpp.
Referenced by wfl::variant_iterator::operator++().
|
inlinevirtual |
Called to determine if this variant is less than another of the same type.
This function is only called if get_type() returns the same result for both arguments.
Reimplemented in wfl::variant_map, wfl::variant_list, wfl::variant_string, wfl::variant_callable, and wfl::variant_numeric.
Definition at line 127 of file variant_value.hpp.
|
virtual |
Creates an iterator pair that can be used for iteration.
For an iterable type, it should use the two-argument constructor of variant-iterator, passing the underlying iterator as the utils::any parameter.
This creates both the begin and end iterator, but the variant implementation discards one of the two.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_callable.
Definition at line 24 of file variant_value.cpp.
Referenced by wfl::variant_callable::make_iterator().
|
inlinevirtual |
Returns the number of elements in a type.
Not relevant for every derivative.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_callable.
Definition at line 79 of file variant_value.hpp.
Referenced by wfl::variant_list::equals(), and wfl::variant_list::less_than().
|
inlinevirtual |
Returns the stored variant value in plain string form.
Reimplemented in wfl::variant_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, wfl::variant_string, wfl::variant_callable, wfl::variant_decimal, and wfl::variant_int.
Definition at line 91 of file variant_value.hpp.