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

#include <callable.hpp>

Inheritance diagram for wfl::map_formula_callable:

Public Types

typedef std::map< std::string, variant >::const_iterator const_iterator
 

Public Member Functions

 map_formula_callable (const_formula_callable_ptr fallback=nullptr)
 
map_formula_callableadd (const std::string &key, const variant &value)
 
map_formula_callableadd (const std::string &key, variant &&value)
 
void set_fallback (const_formula_callable_ptr fallback)
 
bool empty () const
 
void clear ()
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from wfl::formula_callable
 formula_callable (bool has_self=true)
 
virtual ~formula_callable ()
 
formula_callable_ptr fake_ptr ()
 
const_formula_callable_ptr fake_ptr () const
 
variant query_value (const std::string &key) const
 
void mutate_value (const std::string &key, const variant &value)
 
formula_input_vector inputs () const
 
bool equals (const formula_callable &other) const
 
bool less (const formula_callable &other) const
 
bool has_key (const std::string &key) const
 
void serialize (std::string &str) const
 
void subscribe_dtor (callable_die_subscriber *d) const
 
void unsubscribe_dtor (callable_die_subscriber *d) const
 

Private Member Functions

void set_value (const std::string &key, const variant &value) override
 
variant get_value (const std::string &key) const override
 
void get_inputs (formula_input_vector &inputs) const override
 

Private Attributes

std::map< std::string, variantvalues_
 
const_formula_callable_ptr fallback_
 

Additional Inherited Members

- Protected Types inherited from wfl::formula_callable
enum  TYPE {
  FORMULA_C , TERRAIN_C , LOCATION_C , UNIT_TYPE_C ,
  UNIT_C , ATTACK_TYPE_C , MOVE_PARTIAL_C , MOVE_C ,
  ATTACK_C , MOVE_MAP_C
}
 
- Protected Member Functions inherited from wfl::formula_callable
virtual int do_compare (const formula_callable *callable) const
 
virtual void serialize_to_string (std::string &) const
 
- Static Protected Member Functions inherited from wfl::formula_callable
template<typename T , typename K >
static variant convert_map (const std::map< T, K > &input_map)
 
template<typename T >
static variant convert_set (const std::set< T > &input_set)
 
template<typename T >
static variant convert_vector (const std::vector< T > &input_vector)
 
static void add_input (formula_input_vector &inputs, const std::string &key, formula_access access_type=formula_access::read_only)
 
- Protected Attributes inherited from wfl::formula_callable
TYPE type_
 
std::set< callable_die_subscriber * > dtor_notify
 

Detailed Description

Definition at line 244 of file callable.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 274 of file callable.hpp.

Constructor & Destructor Documentation

◆ map_formula_callable()

wfl::map_formula_callable::map_formula_callable ( const_formula_callable_ptr  fallback = nullptr)
inlineexplicit

Definition at line 247 of file callable.hpp.

Member Function Documentation

◆ add() [1/2]

map_formula_callable& wfl::map_formula_callable::add ( const std::string &  key,
const variant value 
)
inline

◆ add() [2/2]

map_formula_callable& wfl::map_formula_callable::add ( const std::string &  key,
variant &&  value 
)
inline

Definition at line 259 of file callable.hpp.

References values_.

◆ begin()

const_iterator wfl::map_formula_callable::begin ( ) const
inline

Definition at line 276 of file callable.hpp.

References values_.

Referenced by ai::formula_ai::to_config().

◆ clear()

void wfl::map_formula_callable::clear ( )
inline

Definition at line 272 of file callable.hpp.

References values_.

◆ empty()

bool wfl::map_formula_callable::empty ( ) const
inline

Definition at line 270 of file callable.hpp.

References values_.

Referenced by ai::formula_ai::to_config().

◆ end()

const_iterator wfl::map_formula_callable::end ( ) const
inline

Definition at line 277 of file callable.hpp.

References values_.

Referenced by ai::formula_ai::to_config().

◆ get_inputs()

void wfl::map_formula_callable::get_inputs ( formula_input_vector inputs) const
inlineoverrideprivatevirtual

◆ get_value()

variant wfl::map_formula_callable::get_value ( const std::string &  key) const
inlineoverrideprivatevirtual

Implements wfl::formula_callable.

Definition at line 285 of file callable.hpp.

References fallback_, and values_.

◆ set_fallback()

void wfl::map_formula_callable::set_fallback ( const_formula_callable_ptr  fallback)
inline

Definition at line 265 of file callable.hpp.

References fallback_.

Referenced by wfl::formula_function_expression::execute().

◆ set_value()

void wfl::map_formula_callable::set_value ( const std::string &  key,
const variant value 
)
inlineoverrideprivatevirtual

Reimplemented from wfl::formula_callable.

Definition at line 280 of file callable.hpp.

References values_.

Member Data Documentation

◆ fallback_

const_formula_callable_ptr wfl::map_formula_callable::fallback_
private

Definition at line 309 of file callable.hpp.

Referenced by get_inputs(), get_value(), and set_fallback().

◆ values_

std::map<std::string, variant> wfl::map_formula_callable::values_
private

Definition at line 308 of file callable.hpp.

Referenced by add(), begin(), clear(), empty(), end(), get_inputs(), get_value(), and set_value().


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