The Battle for Wesnoth  1.19.7+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
wfl::variant_callable Class Reference

#include <variant_value.hpp>

Inheritance diagram for wfl::variant_callable:

Public Member Functions

 variant_callable (const_formula_callable_ptr callable)
 
 ~variant_callable ()
 
virtual bool as_bool () const override
 Returns a bool expression of the variant value. More...
 
virtual std::size_t num_elements () const override
 Returns the number of elements in a type. More...
 
const_formula_callable_ptr get_callable () const
 
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 bool equals (variant_value_base &other) const override
 Called to determine if this variant is equal to another of the same type. More...
 
virtual bool less_than (variant_value_base &other) const override
 Called to determine if this variant is less than another of the same type. More...
 
virtual const formula_variant::type & get_type () const override
 Returns the id of the variant type. More...
 
virtual boost::iterator_range< variant_iteratormake_iterator () const override
 Creates an iterator pair that can be used for iteration. More...
 
virtual variant deref_iterator (const utils::any &iter) const override
 Implements the dereference functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_inc (utils::any &iter) const override
 Implements the increment functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_dec (utils::any &iter) const override
 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 override
 Implements the equality functionality of variant_iterator for a value of this type. More...
 
- Public Member Functions inherited from wfl::variant_value_base
virtual bool is_empty () const
 Whether the stored value is considered empty or not. More...
 
virtual ~variant_value_base ()
 

Private Member Functions

void notify_dead () override
 
- Private Member Functions inherited from wfl::callable_die_subscriber
virtual ~callable_die_subscriber ()
 

Private Attributes

formula_input_vector inputs
 
const_formula_callable_ptr callable_
 

Detailed Description

Definition at line 299 of file variant_value.hpp.

Constructor & Destructor Documentation

◆ variant_callable()

wfl::variant_callable::variant_callable ( const_formula_callable_ptr  callable)
explicit

Definition at line 81 of file variant_value.cpp.

References callable_.

◆ ~variant_callable()

wfl::variant_callable::~variant_callable ( )

Definition at line 89 of file variant_value.cpp.

References callable_.

Member Function Documentation

◆ as_bool()

virtual bool wfl::variant_callable::as_bool ( ) const
inlineoverridevirtual

Returns a bool expression of the variant value.

Reimplemented from wfl::variant_value_base.

Definition at line 305 of file variant_value.hpp.

References callable_.

◆ deref_iterator()

variant wfl::variant_callable::deref_iterator ( const utils::any &  iter) const
overridevirtual

Implements the dereference functionality of variant_iterator for a value of this type.

Parameters
iterThe opaque reference that was passed to the variant_iterator by make_iterator.

Reimplemented from wfl::variant_value_base.

Definition at line 171 of file variant_value.cpp.

References callable_.

◆ equals()

bool wfl::variant_callable::equals ( variant_value_base ) const
overridevirtual

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 from wfl::variant_value_base.

Definition at line 146 of file variant_value.cpp.

References callable_.

◆ get_callable()

const_formula_callable_ptr wfl::variant_callable::get_callable ( ) const
inline

Definition at line 315 of file variant_value.hpp.

References callable_.

◆ get_debug_string()

std::string wfl::variant_callable::get_debug_string ( formula_seen_stack ,
bool   
) const
overridevirtual

Returns debug info for the variant value.

Reimplemented from wfl::variant_value_base.

Definition at line 106 of file variant_value.cpp.

References callable_, utils::find(), wfl::read_write, and wfl::write_only.

◆ get_serialized_string()

std::string wfl::variant_callable::get_serialized_string ( ) const
overridevirtual

Returns the stored variant value in formula syntax.

Reimplemented from wfl::variant_value_base.

Definition at line 95 of file variant_value.cpp.

References callable_.

◆ get_type()

virtual const formula_variant::type& wfl::variant_callable::get_type ( ) const
inlineoverridevirtual

Returns the id of the variant type.

Reimplemented from wfl::variant_value_base.

Definition at line 332 of file variant_value.hpp.

◆ iterator_dec()

void wfl::variant_callable::iterator_dec ( utils::any &  ) const
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 185 of file variant_value.cpp.

◆ iterator_equals()

virtual bool wfl::variant_callable::iterator_equals ( const utils::any &  ,
const utils::any &   
) const
inlineoverridevirtual

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 343 of file variant_value.hpp.

◆ iterator_inc()

void wfl::variant_callable::iterator_inc ( utils::any &  ) const
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 180 of file variant_value.cpp.

◆ less_than()

bool wfl::variant_callable::less_than ( variant_value_base ) const
overridevirtual

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 from wfl::variant_value_base.

Definition at line 152 of file variant_value.cpp.

References callable_.

◆ make_iterator()

boost::iterator_range< variant_iterator > wfl::variant_callable::make_iterator ( ) const
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 158 of file variant_value.cpp.

References callable_, inputs, and wfl::variant_value_base::make_iterator().

◆ notify_dead()

void wfl::variant_callable::notify_dead ( )
inlineoverrideprivatevirtual

Reimplemented from wfl::callable_die_subscriber.

Definition at line 349 of file variant_value.hpp.

References callable_.

◆ num_elements()

virtual std::size_t wfl::variant_callable::num_elements ( ) const
inlineoverridevirtual

Returns the number of elements in a type.

Not relevant for every derivative.

Reimplemented from wfl::variant_value_base.

Definition at line 310 of file variant_value.hpp.

◆ string_cast()

virtual std::string wfl::variant_callable::string_cast ( ) const
inlineoverridevirtual

Returns the stored variant value in plain string form.

Reimplemented from wfl::variant_value_base.

Definition at line 320 of file variant_value.hpp.

Member Data Documentation

◆ callable_

const_formula_callable_ptr wfl::variant_callable::callable_
private

◆ inputs

formula_input_vector wfl::variant_callable::inputs
mutableprivate

Definition at line 351 of file variant_value.hpp.

Referenced by make_iterator().


The documentation for this class was generated from the following files: