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 79 of file variant_value.hpp.
|
inlinevirtual |
Definition at line 191 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 113 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_map, wfl::variant_list, and wfl::variant_callable.
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 122 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_string, wfl::variant_callable, wfl::variant_decimal, and wfl::variant_int.
Definition at line 107 of file variant_value.hpp.
|
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 101 of file variant_value.hpp.
|
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 137 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 89 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_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_callable.
Definition at line 175 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 186 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_container< T >, wfl::variant_container< variant_map_raw >, wfl::variant_container< variant_vector >, and wfl::variant_callable.
Definition at line 167 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 131 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 83 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 95 of file variant_value.hpp.