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

Public Member Functions

 plugins_context (const std::string &name)
 
 plugins_context (const std::string &name, const std::vector< Reg > &callbacks, const std::vector< aReg > &accessors)
 
template<int N, int M>
 plugins_context (const std::string &name, const Reg(&callbacks)[N], const aReg(&accessors)[M])
 
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)
 
size_t erase_callback (const std::string &name)
 
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)>)
 
size_t erase_accessor (const std::string &name)
 
size_t clear_accessors ()
 

Private Types

typedef std::map< std::string,
callback_function
callback_list
 
typedef std::map< std::string,
accessor_function
accessor_list
 

Private Member Functions

void initialize (const std::vector< Reg > &callbacks, const std::vector< aReg > &accessors)
 

Private Attributes

callback_list callbacks_
 
accessor_list accessors_
 
std::string name_
 

Friends

class application_lua_kernel
 

Detailed Description

Definition at line 31 of file context.hpp.

Member Typedef Documentation

Definition at line 37 of file context.hpp.

Definition at line 76 of file context.hpp.

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

Definition at line 34 of file context.hpp.

Definition at line 75 of file context.hpp.

Constructor & Destructor Documentation

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

Definition at line 25 of file context.cpp.

plugins_context::plugins_context ( const std::string name,
const std::vector< Reg > &  callbacks,
const std::vector< aReg > &  accessors 
)

Definition at line 31 of file context.cpp.

References initialize().

template<int N, int M>
plugins_context::plugins_context ( const std::string name,
const Reg(&)  callbacks[N],
const aReg(&)  accessors[M] 
)
inline

Definition at line 43 of file context.hpp.

References i, and initialize().

Member Function Documentation

size_t plugins_context::clear_accessors ( )

Definition at line 97 of file context.cpp.

References accessors_.

size_t plugins_context::clear_callbacks ( )

Definition at line 63 of file context.cpp.

References callbacks_.

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

Definition at line 92 of file context.cpp.

References accessors_.

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

Definition at line 58 of file context.cpp.

References callbacks_.

void plugins_context::initialize ( const std::vector< Reg > &  callbacks,
const std::vector< aReg > &  accessors 
)
private

Definition at line 39 of file context.cpp.

References accessors_, and callbacks_.

Referenced by plugins_context().

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

Definition at line 70 of file context.cpp.

References accessors_.

Referenced by set_accessor_int(), and set_accessor_string().

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

Definition at line 86 of file context.cpp.

References set_accessor().

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

Definition at line 81 of file context.cpp.

References set_accessor().

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

Definition at line 53 of file context.cpp.

References callbacks_.

Referenced by do_gameloop(), set_callback(), and gui::dialog::show().

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

Definition at line 116 of file context.cpp.

References set_callback(), and shim().

Friends And Related Function Documentation

friend class application_lua_kernel
friend

Definition at line 72 of file context.hpp.

Member Data Documentation

accessor_list plugins_context::accessors_
private
callback_list plugins_context::callbacks_
private
std::string plugins_context::name_
private

Definition at line 82 of file context.hpp.

Referenced by application_lua_kernel::thread::run_script().


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