The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
game_events::filter_dynamic Struct Reference

This is a dynamic wrapper for any filter type, specified via [insert_tag]. More...

Inheritance diagram for game_events::filter_dynamic:

Public Member Functions

 filter_dynamic (const std::string &tag, const std::string &var)
 
bool operator() (const queued_event &event_info) const override
 Runs the filter and returns whether it passes on the given event. More...
 
void serialize (config &cfg) const override
 Serializes the filter into a config, if possible. More...
 
bool can_serialize () const override
 Returns true if it is possible to serialize the filter into a config. More...
 
- Public Member Functions inherited from game_events::event_filter
virtual ~event_filter ()=default
 
 event_filter ()=default
 

Private Attributes

std::string tag_
 
std::string var_
 

Detailed Description

This is a dynamic wrapper for any filter type, specified via [insert_tag].

It loads the filter contents from a variable and forwards it to the appropriate filter class.

Definition at line 338 of file handlers.cpp.

Constructor & Destructor Documentation

◆ filter_dynamic()

game_events::filter_dynamic::filter_dynamic ( const std::string &  tag,
const std::string &  var 
)
inline

Definition at line 339 of file handlers.cpp.

Member Function Documentation

◆ can_serialize()

bool game_events::filter_dynamic::can_serialize ( ) const
inlineoverridevirtual

Returns true if it is possible to serialize the filter into a config.

Reimplemented from game_events::event_filter.

Definition at line 355 of file handlers.cpp.

◆ operator()()

bool game_events::filter_dynamic::operator() ( const queued_event event_info) const
inlineoverridevirtual

Runs the filter and returns whether it passes on the given event.

Implements game_events::event_filter.

Definition at line 340 of file handlers.cpp.

References variable_info< V >::as_container(), variable_info< V >::exists_as_container(), resources::gamedata, game_events::make_filter(), tag_, and var_.

◆ serialize()

void game_events::filter_dynamic::serialize ( config cfg) const
inlineoverridevirtual

Serializes the filter into a config, if possible.

Reimplemented from game_events::event_filter.

Definition at line 349 of file handlers.cpp.

References config::add_child(), markup::tag(), tag_, and var_.

Member Data Documentation

◆ tag_

std::string game_events::filter_dynamic::tag_
private

Definition at line 360 of file handlers.cpp.

Referenced by operator()(), and serialize().

◆ var_

std::string game_events::filter_dynamic::var_
private

Definition at line 360 of file handlers.cpp.

Referenced by operator()(), and serialize().


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