Generalized interface for container variants. More...
#include <variant_value.hpp>
Public Member Functions | |
| variant_container (const Container &c) | |
| variant_container (Container &&c) | |
| const Container & | get_container () const |
| virtual bool | is_empty () const override |
| Whether the stored value is considered empty or not. More... | |
| virtual std::size_t | num_elements () const override |
| Returns the number of elements in a type. More... | |
| virtual bool | as_bool () const override |
| Returns a bool expression of the variant value. More... | |
| virtual std::string | string_cast () const override |
| Returns the stored variant value in plain string form. More... | |
| virtual std::string | get_serialized_string () const override |
| Returns the stored variant value in formula syntax. More... | |
| virtual std::string | get_debug_string (formula_seen_stack &seen, bool verbose) const override |
| Returns debug info for the variant value. More... | |
| virtual boost::iterator_range< variant_iterator > | make_iterator () const override |
| Creates an iterator pair that can be used for iteration. More... | |
| virtual void | iterator_inc (utils::any &) const override |
| Implements the increment functionality of variant_iterator for a value of this type. More... | |
| virtual void | iterator_dec (utils::any &) const override |
| Implements the decrement functionality of variant_iterator for a value of this type. More... | |
| 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. More... | |
| virtual bool | equals (const variant_value_base &other) const override |
| Inherited from variant_value_base. More... | |
| virtual bool | less_than (const variant_value_base &other) const override |
| Inherited from variant_value_base. More... | |
Public Member Functions inherited from wfl::variant_value_base | |
| virtual formula_variant::type | get_type () const |
| Returns the id of the variant type. 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 | ~variant_value_base () |
Protected Types | |
| using | iterator = typename Container::iterator |
| using | const_iterator = typename Container::const_iterator |
Static Protected Member Functions | |
| static const_iterator & | as_container_iterator (utils::any &iter) |
| Casts opaque iter to a mutable const_iterator reference. More... | |
| static const const_iterator & | as_container_iterator (const utils::any &iter) |
| Casts opaque iter to a constant const_iterator reference. More... | |
Private Attributes | |
| Container | container_ |
Additional Inherited Members | |
Static Public Attributes inherited from wfl::variant_value_base | |
| static constexpr auto | value_type = formula_variant::type::null |
| Each 'final' derived class should define a static type flag. More... | |
Generalized interface for container variants.
Definition at line 387 of file variant_value.hpp.
|
protected |
Definition at line 446 of file variant_value.hpp.
|
protected |
Definition at line 445 of file variant_value.hpp.
|
inlineexplicit |
Definition at line 390 of file variant_value.hpp.
|
inlineexplicit |
Definition at line 395 of file variant_value.hpp.
|
inlineoverridevirtual |
Returns a bool expression of the variant value.
Reimplemented from wfl::variant_value_base.
Definition at line 415 of file variant_value.hpp.
References wfl::variant_container< Container >::is_empty().
|
inlinestaticprotected |
Casts opaque iter to a constant const_iterator reference.
Definition at line 455 of file variant_value.hpp.
|
inlinestaticprotected |
Casts opaque iter to a mutable const_iterator reference.
Definition at line 449 of file variant_value.hpp.
|
inlineoverridevirtual |
Inherited from variant_value_base.
Reimplemented from wfl::variant_value_base.
Definition at line 433 of file variant_value.hpp.
References utils::cast_as(), and wfl::variant_container< Container >::container_.
|
inline |
Definition at line 400 of file variant_value.hpp.
References wfl::variant_container< Container >::container_.
|
overridevirtual |
Returns debug info for the variant value.
Reimplemented from wfl::variant_value_base.
Definition at line 305 of file variant_value.cpp.
References wfl::implementation::as_literal(), and wfl::variant::to_debug_string().
|
overridevirtual |
Returns the stored variant value in formula syntax.
Reimplemented from wfl::variant_value_base.
Definition at line 299 of file variant_value.cpp.
References wfl::implementation::as_literal(), and wfl::variant::serialize_to_string().
|
inlineoverridevirtual |
Whether the stored value is considered empty or not.
Reimplemented from wfl::variant_value_base.
Definition at line 405 of file variant_value.hpp.
References wfl::variant_container< Container >::container_.
Referenced by wfl::variant_container< Container >::as_bool().
|
overridevirtual |
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 from wfl::variant_value_base.
Definition at line 324 of file variant_value.cpp.
|
overridevirtual |
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 from wfl::variant_value_base.
Definition at line 330 of file variant_value.cpp.
|
overridevirtual |
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 from wfl::variant_value_base.
Definition at line 318 of file variant_value.cpp.
|
inlineoverridevirtual |
Inherited from variant_value_base.
Reimplemented from wfl::variant_value_base.
Definition at line 439 of file variant_value.hpp.
References utils::cast_as(), and wfl::variant_container< Container >::container_.
|
overridevirtual |
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 from wfl::variant_value_base.
Definition at line 312 of file variant_value.cpp.
References wfl::implementation::make_iterator_range().
|
inlineoverridevirtual |
Returns the number of elements in a type.
Not relevant for every derivative.
Reimplemented from wfl::variant_value_base.
Definition at line 410 of file variant_value.hpp.
References wfl::variant_container< Container >::container_.
|
overridevirtual |
Returns the stored variant value in plain string form.
Reimplemented from wfl::variant_value_base.
Definition at line 293 of file variant_value.cpp.
References wfl::variant::string_cast(), and wfl::implementation::to_string().
|
private |
Definition at line 461 of file variant_value.hpp.
Referenced by wfl::variant_container< Container >::equals(), wfl::variant_container< Container >::get_container(), wfl::variant_container< Container >::is_empty(), wfl::variant_container< Container >::less_than(), and wfl::variant_container< Container >::num_elements().