The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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:
Inheritance graph

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 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 VARIANT_TYPE & get_type () const override
 Returns the id of the variant type. More...
 
virtual boost::iterator_range
< variant_iterator
make_iterator () const override
 Creates an iterator pair that can be used for iteration. More...
 
virtual variant deref_iterator (const boost::any &iter) const override
 Implements the dereference functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_inc (boost::any &iter) const override
 Implements the increment functionality of variant_iterator for a value of this type. More...
 
virtual void iterator_dec (boost::any &iter) const override
 Implements the decrement functionality of variant_iterator for a value of this type. More...
 
virtual bool iterator_equals (const boost::any &, const boost::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 313 of file variant_value.hpp.

Constructor & Destructor Documentation

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

Definition at line 78 of file variant_value.cpp.

References callable_.

wfl::variant_callable::~variant_callable ( )

Definition at line 86 of file variant_value.cpp.

References callable_.

Member Function Documentation

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

References callable_.

variant wfl::variant_callable::deref_iterator ( const boost::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 168 of file variant_value.cpp.

References callable_, and name().

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 143 of file variant_value.cpp.

References callable_, and wfl::value_ref_cast().

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

Definition at line 329 of file variant_value.hpp.

References callable_.

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 103 of file variant_value.cpp.

References callable_, gui2::event::find(), wfl::FORMULA_READ_WRITE, and wfl::FORMULA_WRITE_ONLY.

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 92 of file variant_value.cpp.

References callable_.

virtual const 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 346 of file variant_value.hpp.

void wfl::variant_callable::iterator_dec ( boost::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 182 of file variant_value.cpp.

virtual bool wfl::variant_callable::iterator_equals ( const boost::any &  ,
const boost::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 357 of file variant_value.hpp.

void wfl::variant_callable::iterator_inc ( boost::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 177 of file variant_value.cpp.

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 149 of file variant_value.cpp.

References callable_, and wfl::value_ref_cast().

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 boost::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 155 of file variant_value.cpp.

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

void wfl::variant_callable::notify_dead ( )
inlineoverrideprivatevirtual

Reimplemented from wfl::callable_die_subscriber.

Definition at line 363 of file variant_value.hpp.

References callable_.

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

Referenced by wfl::variant_list::equals(), wfl::variant_list::less_than(), and wfl::variant_list::list_op().

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

Member Data Documentation

const_formula_callable_ptr wfl::variant_callable::callable_
private
formula_input_vector wfl::variant_callable::inputs
mutableprivate

Definition at line 365 of file variant_value.hpp.

Referenced by make_iterator().


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