The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Private Member Functions | List of all members
wfl::variant_list Class Reference

#include <variant_value.hpp>

Inheritance diagram for wfl::variant_list:

Public Member Functions

 variant_list (const variant_vector &vec)
 
variant list_op (value_base_ptr second, std::function< variant(variant &, variant &)> op_func)
 Applies the provided function to the corresponding variants in this and another list. 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 variant deref_iterator (const utils::any &) const override
 Implements the dereference functionality of variant_iterator for a value of this type. More...
 
- Public Member Functions inherited from wfl::variant_container< variant_vector >
 variant_container (const variant_vector &container)
 
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...
 
variant_vectorget_container ()
 
const variant_vectorget_container () 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...
 
bool contains (const variant &member) const
 
virtual boost::iterator_range< variant_iteratormake_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...
 
- Public Member Functions inherited from wfl::variant_value_base
virtual ~variant_value_base ()
 

Private Member Functions

virtual std::string to_string_detail (const variant_vector::value_type &container_val, mod_func_t mod_func) const override
 

Additional Inherited Members

- Protected Types inherited from wfl::variant_container< variant_vector >
using mod_func_t = std::function< std::string(const variant &)>
 
- Protected Member Functions inherited from wfl::variant_container< variant_vector >
virtual std::string to_string_detail (const typename T::value_type &value, mod_func_t mod_func) const=0
 

Detailed Description

Definition at line 488 of file variant_value.hpp.

Constructor & Destructor Documentation

◆ variant_list()

wfl::variant_list::variant_list ( const variant_vector vec)
inlineexplicit

Definition at line 491 of file variant_value.hpp.

Member Function Documentation

◆ deref_iterator()

variant wfl::variant_list::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 344 of file variant_value.cpp.

◆ equals()

bool wfl::variant_list::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 312 of file variant_value.cpp.

References wfl::variant_container< variant_vector >::get_container(), n, wfl::variant_value_base::num_elements(), and wfl::variant_container< variant_vector >::num_elements().

◆ get_type()

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

Returns the id of the variant type.

Reimplemented from wfl::variant_value_base.

Definition at line 503 of file variant_value.hpp.

◆ less_than()

bool wfl::variant_list::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 329 of file variant_value.cpp.

References wfl::variant_container< variant_vector >::get_container(), n, wfl::variant_value_base::num_elements(), and wfl::variant_container< variant_vector >::num_elements().

◆ list_op()

variant wfl::variant_list::list_op ( value_base_ptr  second,
std::function< variant(variant &, variant &)>  op_func 
)

Applies the provided function to the corresponding variants in this and another list.

Definition at line 294 of file variant_value.cpp.

References wfl::variant_container< variant_vector >::get_container(), i, and wfl::variant_container< variant_vector >::num_elements().

◆ to_string_detail()

virtual std::string wfl::variant_list::to_string_detail ( const variant_vector::value_type &  container_val,
mod_func_t  mod_func 
) const
inlineoverrideprivatevirtual

Definition at line 512 of file variant_value.hpp.


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