The Battle for Wesnoth  1.15.2+dev
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
plugins_context Class Reference

#include <context.hpp>

Classes

struct  aReg
 
struct  Reg
 

Public Types

typedef std::function< bool(config)> callback_function
 
typedef std::function< config(config)> accessor_function
 
using reg_vec = std::vector< Reg >
 
using areg_vec = std::vector< aReg >
 

Public Member Functions

 plugins_context (const std::string &name)
 
 plugins_context (const std::string &name, const reg_vec &callbacks, const areg_vec &accessors)
 
void play_slice ()
 
void set_callback (const std::string &name, callback_function)
 
void set_callback (const std::string &name, std::function< void(config)> function, bool preserves_context)
 
std::size_t erase_callback (const std::string &name)
 
std::size_t clear_callbacks ()
 
void set_accessor (const std::string &name, accessor_function)
 
void set_accessor_string (const std::string &name, std::function< std::string(config)>)
 
void set_accessor_int (const std::string &name, std::function< int(config)>)
 
std::size_t erase_accessor (const std::string &name)
 
std::size_t clear_accessors ()
 

Private Types

typedef std::map< std::string, callback_functioncallback_list
 
typedef std::map< std::string, accessor_functionaccessor_list
 

Private Member Functions

void initialize (const reg_vec &callbacks, const areg_vec &accessors)
 

Private Attributes

callback_list callbacks_
 
accessor_list accessors_
 
std::string name_
 

Friends

class application_lua_kernel
 

Detailed Description

Definition at line 30 of file context.hpp.

Member Typedef Documentation

◆ accessor_function

Definition at line 36 of file context.hpp.

◆ accessor_list

typedef std::map<std::string, accessor_function > plugins_context::accessor_list
private

Definition at line 62 of file context.hpp.

◆ areg_vec

using plugins_context::areg_vec = std::vector<aReg>

Definition at line 40 of file context.hpp.

◆ callback_function

typedef std::function<bool(config)> plugins_context::callback_function

Definition at line 33 of file context.hpp.

◆ callback_list

typedef std::map<std::string, callback_function > plugins_context::callback_list
private

Definition at line 61 of file context.hpp.

◆ reg_vec

using plugins_context::reg_vec = std::vector<Reg>

Definition at line 39 of file context.hpp.

Constructor & Destructor Documentation

◆ plugins_context() [1/2]

plugins_context::plugins_context ( const std::string &  name)

Definition at line 23 of file context.cpp.

References accessors_, callbacks_, initialize(), and name_.

◆ plugins_context() [2/2]

plugins_context::plugins_context ( const std::string &  name,
const reg_vec callbacks,
const areg_vec accessors 
)

Member Function Documentation

◆ clear_accessors()

std::size_t plugins_context::clear_accessors ( )

Definition at line 89 of file context.cpp.

References accessors_.

◆ clear_callbacks()

std::size_t plugins_context::clear_callbacks ( )

Definition at line 61 of file context.cpp.

References callbacks_.

◆ erase_accessor()

std::size_t plugins_context::erase_accessor ( const std::string &  name)

Definition at line 84 of file context.cpp.

References accessors_.

◆ erase_callback()

std::size_t plugins_context::erase_callback ( const std::string &  name)

Definition at line 56 of file context.cpp.

References callbacks_.

◆ initialize()

void plugins_context::initialize ( const reg_vec callbacks,
const areg_vec accessors 
)
private

Definition at line 37 of file context.cpp.

References accessors_, and callbacks_.

Referenced by plugins_context().

◆ play_slice()

void plugins_context::play_slice ( )

◆ set_accessor()

void plugins_context::set_accessor ( const std::string &  name,
accessor_function  func 
)

Definition at line 68 of file context.cpp.

References accessors_.

Referenced by set_accessor_int(), and set_accessor_string().

◆ set_accessor_int()

void plugins_context::set_accessor_int ( const std::string &  name,
std::function< int(config)>  func 
)

Definition at line 78 of file context.cpp.

References set_accessor().

◆ set_accessor_string()

void plugins_context::set_accessor_string ( const std::string &  name,
std::function< std::string(config)>  func 
)

Definition at line 73 of file context.cpp.

References set_accessor().

◆ set_callback() [1/2]

void plugins_context::set_callback ( const std::string &  name,
callback_function  func 
)

Definition at line 51 of file context.cpp.

References callbacks_.

Referenced by do_gameloop(), set_callback(), and gui2::dialogs::modal_dialog::show().

◆ set_callback() [2/2]

void plugins_context::set_callback ( const std::string &  name,
std::function< void(config)>  function,
bool  preserves_context 
)

Definition at line 102 of file context.cpp.

References set_callback().

Friends And Related Function Documentation

◆ application_lua_kernel

friend class application_lua_kernel
friend

Definition at line 58 of file context.hpp.

Member Data Documentation

◆ accessors_

accessor_list plugins_context::accessors_
private

◆ callbacks_

callback_list plugins_context::callbacks_
private

◆ name_

std::string plugins_context::name_
private

Definition at line 68 of file context.hpp.

Referenced by plugins_context(), and application_lua_kernel::thread::run_script().


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