The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ai::lua_object< T > Class Template Reference

#include <lua_object.hpp>

Inheritance diagram for ai::lua_object< T >:
Inheritance graph

Public Member Functions

 lua_object ()
 
 lua_object (const T &init)
 
std::shared_ptr< T > get ()
 
void store (lua_State *L, int n)
 
void push (lua_State *L)
 
- Public Member Functions inherited from ai::lua_object_base
 lua_object_base ()
 
virtual ~lua_object_base ()
 

Protected Member Functions

std::shared_ptr< T > to_type (lua_State *, int)
 
void from_type (lua_State *L, std::shared_ptr< T >)
 
template<>
std::shared_ptr< aspect_attacks_lua_filterto_type (lua_State *L, int n)
 
template<>
std::shared_ptr< double > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< double > value)
 
template<>
std::shared_ptr< std::string > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< boost::variant< bool, std::vector< std::string >>> value)
 
template<>
std::shared_ptr< boost::variant< bool, std::vector< std::string > > > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< std::string > value)
 
template<>
std::shared_ptr< bool > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< bool > value)
 
template<>
std::shared_ptr< int > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< int > value)
 
template<>
std::shared_ptr< std::vector< std::string > > to_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< std::vector< std::string > > value)
 
template<>
std::shared_ptr< configto_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< config > value)
 
template<>
std::shared_ptr< terrain_filterto_type (lua_State *L, int n)
 
template<>
void from_type (lua_State *L, std::shared_ptr< terrain_filter > value)
 
template<>
std::shared_ptr< std::vector< target > > to_type (lua_State *L, int n)
 
template<>
std::shared_ptr< unit_advancements_aspectto_type (lua_State *L, int n)
 
template<>
std::shared_ptr< aspect_attacks_lua_filterto_type (lua_State *L, int n)
 

Protected Attributes

std::shared_ptr< T > value_
 

Detailed Description

template<typename T>
class ai::lua_object< T >

Definition at line 53 of file lua_object.hpp.

Constructor & Destructor Documentation

◆ lua_object() [1/2]

template<typename T>
ai::lua_object< T >::lua_object ( )
inline

Definition at line 58 of file lua_object.hpp.

◆ lua_object() [2/2]

template<typename T>
ai::lua_object< T >::lua_object ( const T &  init)
inline

Definition at line 64 of file lua_object.hpp.

Member Function Documentation

◆ from_type() [1/9]

template<typename T>
void ai::lua_object< T >::from_type ( lua_State L,
std::shared_ptr< T >   
)
inlineprotected

Definition at line 94 of file lua_object.hpp.

References lua_error(), and lua_pushliteral.

◆ from_type() [2/9]

template<>
void ai::lua_object< double >::from_type ( lua_State L,
std::shared_ptr< double >  value 
)
inlineprotected

Definition at line 110 of file lua_object.hpp.

References lua_pushnil(), and lua_pushnumber().

◆ from_type() [3/9]

template<>
void ai::lua_object< boost::variant< bool, std::vector< std::string > > >::from_type ( lua_State L,
std::shared_ptr< boost::variant< bool, std::vector< std::string >>>  value 
)
inlineprotected

◆ from_type() [4/9]

template<>
void ai::lua_object< std::string >::from_type ( lua_State L,
std::shared_ptr< std::string >  value 
)
inlineprotected

Definition at line 161 of file lua_object.hpp.

References lua_pushlstring(), and lua_pushnil().

◆ from_type() [5/9]

template<>
void ai::lua_object< bool >::from_type ( lua_State L,
std::shared_ptr< bool >  value 
)
inlineprotected

Definition at line 174 of file lua_object.hpp.

References lua_pushboolean(), and lua_pushnil().

◆ from_type() [6/9]

template<>
void ai::lua_object< int >::from_type ( lua_State L,
std::shared_ptr< int >  value 
)
inlineprotected

Definition at line 187 of file lua_object.hpp.

References lua_pushnil(), and lua_pushnumber().

◆ from_type() [7/9]

template<>
void ai::lua_object< std::vector< std::string > >::from_type ( lua_State L,
std::shared_ptr< std::vector< std::string > >  value 
)
inlineprotected

◆ from_type() [8/9]

template<>
void ai::lua_object< config >::from_type ( lua_State L,
std::shared_ptr< config value 
)
inlineprotected

Definition at line 231 of file lua_object.hpp.

References lua_pushnil(), and luaW_pushconfig().

◆ from_type() [9/9]

template<>
void ai::lua_object< terrain_filter >::from_type ( lua_State L,
std::shared_ptr< terrain_filter value 
)
inlineprotected

◆ get()

template<typename T>
std::shared_ptr<T> ai::lua_object< T >::get ( )
inline

Definition at line 70 of file lua_object.hpp.

◆ push()

template<typename T>
void ai::lua_object< T >::push ( lua_State L)
inline

Definition at line 80 of file lua_object.hpp.

Referenced by ai::typesafe_aspect< attacks_vector >::get_lua().

◆ store()

template<typename T>
void ai::lua_object< T >::store ( lua_State L,
int  n 
)
inlinevirtual

Implements ai::lua_object_base.

Definition at line 75 of file lua_object.hpp.

References lua_absindex().

◆ to_type() [1/13]

template<>
std::shared_ptr< aspect_attacks_lua_filter > ai::lua_object< aspect_attacks_lua_filter >::to_type ( lua_State L,
int  n 
)
protected

◆ to_type() [2/13]

template<typename T>
std::shared_ptr<T> ai::lua_object< T >::to_type ( lua_State ,
int   
)
inlineprotected

Definition at line 88 of file lua_object.hpp.

Referenced by ai::lua_object< T >::to_type().

◆ to_type() [3/13]

template<>
std::shared_ptr< double > ai::lua_object< double >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 104 of file lua_object.hpp.

References lua_tonumber.

◆ to_type() [4/13]

template<>
std::shared_ptr< std::string > ai::lua_object< std::string >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 117 of file lua_object.hpp.

References lua_tostring.

◆ to_type() [5/13]

template<>
std::shared_ptr< boost::variant< bool, std::vector< std::string > > > ai::lua_object< boost::variant< bool, std::vector< std::string > > >::to_type ( lua_State L,
int  n 
)
inlineprotected

◆ to_type() [6/13]

template<>
std::shared_ptr< bool > ai::lua_object< bool >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 168 of file lua_object.hpp.

References luaW_toboolean().

◆ to_type() [7/13]

template<>
std::shared_ptr< int > ai::lua_object< int >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 181 of file lua_object.hpp.

References lua_tointeger.

◆ to_type() [8/13]

template<>
std::shared_ptr< std::vector< std::string > > ai::lua_object< std::vector< std::string > >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 194 of file lua_object.hpp.

References i, lua_gettable(), lua_pushinteger(), lua_rawlen(), lua_settop(), lua_tostring, and s.

◆ to_type() [9/13]

template<>
std::shared_ptr< config > ai::lua_object< config >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 223 of file lua_object.hpp.

References luaW_toconfig().

◆ to_type() [10/13]

template<>
std::shared_ptr< terrain_filter > ai::lua_object< terrain_filter >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 238 of file lua_object.hpp.

References resources::filter_con, and luaW_tovconfig().

◆ to_type() [11/13]

template<>
std::shared_ptr< std::vector< target > > ai::lua_object< std::vector< target > >::to_type ( lua_State L,
int  n 
)
inlineprotected

◆ to_type() [12/13]

template<>
std::shared_ptr< unit_advancements_aspect > ai::lua_object< unit_advancements_aspect >::to_type ( lua_State L,
int  n 
)
inlineprotected

Definition at line 314 of file lua_object.hpp.

References n, and ai::lua_object< T >::to_type().

◆ to_type() [13/13]

template<>
std::shared_ptr< aspect_attacks_lua_filter > ai::lua_object< aspect_attacks_lua_filter >::to_type ( lua_State L,
int  n 
)
protected

Member Data Documentation

◆ value_

template<typename T>
std::shared_ptr<T> ai::lua_object< T >::value_
protected

Definition at line 100 of file lua_object.hpp.


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