The Battle for Wesnoth  1.19.5+dev
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
luaW_Registry Struct Reference

Holds a lookup table for members of one type of object. More...

#include <lua_attributes.hpp>

Public Types

using getters_list = std::map< std::string, std::function< bool(lua_State *L, bool nop)> >
 
using setters_list = std::map< std::string, std::function< bool(lua_State *L, int idx, bool nop)> >
 
using validators_list = std::map< std::string, std::function< bool(lua_State *L)> >
 

Public Member Functions

 luaW_Registry ()=delete
 
 luaW_Registry (const std::initializer_list< std::string > &mt)
 
 ~luaW_Registry ()
 
int get (lua_State *L)
 Implement __index metamethod. More...
 
int set (lua_State *L)
 Implement __newindex metamethod. More...
 
int dir (lua_State *L)
 Implement __dir metamethod. More...
 

Public Attributes

getters_list getters
 A map of callbacks that read data from the object. More...
 
setters_list setters
 A map of callbacks that write data to the object. More...
 
validators_list validators
 A map of callbacks that check if a member is available. More...
 
std::string private_metatable
 The internal metatable string for the object (from __metatable) More...
 
std::vector< std::string > public_metatable
 Optional external metatable for the object (eg "wesnoth", "units") All entries of this table will be treated as members of the object. More...
 

Static Public Attributes

static std::map< std::string_view, std::reference_wrapper< luaW_Registry > > lookup
 

Detailed Description

Holds a lookup table for members of one type of object.

Definition at line 36 of file lua_attributes.hpp.

Member Typedef Documentation

◆ getters_list

using luaW_Registry::getters_list = std::map<std::string , std::function<bool(lua_State* L,bool nop)> >

Definition at line 38 of file lua_attributes.hpp.

◆ setters_list

using luaW_Registry::setters_list = std::map<std::string, std::function<bool(lua_State* L,int idx,bool nop)> >

Definition at line 41 of file lua_attributes.hpp.

◆ validators_list

using luaW_Registry::validators_list = std::map<std::string, std::function<bool(lua_State* L)> >

Definition at line 44 of file lua_attributes.hpp.

Constructor & Destructor Documentation

◆ luaW_Registry() [1/2]

luaW_Registry::luaW_Registry ( )
delete

◆ luaW_Registry() [2/2]

luaW_Registry::luaW_Registry ( const std::initializer_list< std::string > &  mt)

Definition at line 21 of file lua_attributes.cpp.

References lookup, private_metatable, and public_metatable.

◆ ~luaW_Registry()

luaW_Registry::~luaW_Registry ( )

Definition at line 27 of file lua_attributes.cpp.

References lookup, and private_metatable.

Member Function Documentation

◆ dir()

int luaW_Registry::dir ( lua_State *  L)

◆ get()

int luaW_Registry::get ( lua_State *  L)

◆ set()

int luaW_Registry::set ( lua_State *  L)

Member Data Documentation

◆ getters

getters_list luaW_Registry::getters

A map of callbacks that read data from the object.

Definition at line 40 of file lua_attributes.hpp.

Referenced by dir(), and get().

◆ lookup

std::map<std::string_view , std::reference_wrapper<luaW_Registry> > luaW_Registry::lookup
inlinestatic

Definition at line 37 of file lua_attributes.hpp.

Referenced by luaW_Registry(), register_lua_attribute(), and ~luaW_Registry().

◆ private_metatable

std::string luaW_Registry::private_metatable

The internal metatable string for the object (from __metatable)

Definition at line 48 of file lua_attributes.hpp.

Referenced by get(), luaW_Registry(), set(), and ~luaW_Registry().

◆ public_metatable

std::vector<std::string> luaW_Registry::public_metatable

Optional external metatable for the object (eg "wesnoth", "units") All entries of this table will be treated as members of the object.

Definition at line 51 of file lua_attributes.hpp.

Referenced by dir(), get(), and luaW_Registry().

◆ setters

setters_list luaW_Registry::setters

A map of callbacks that write data to the object.

Definition at line 43 of file lua_attributes.hpp.

Referenced by dir(), and set().

◆ validators

validators_list luaW_Registry::validators

A map of callbacks that check if a member is available.

Definition at line 46 of file lua_attributes.hpp.

Referenced by dir().


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