Ardour  8.7-15-gadf511264b
LuaRef::Proxy Class Reference

Public Member Functions

 Proxy (lua_State *L, int tableRef)
 
 Proxy (Proxy const &other)
 
 ~Proxy ()
 
int createRef () const
 
template<class T >
Proxyoperator= (T v)
 
Proxyclone_instance (const void *key, void *p)
 
template<class T >
Proxyrawset (T v)
 
lua_Statestate () const
 
void push (lua_State *L) const
 
int type () const
 
bool isNil () const
 
bool isBoolean () const
 
bool isNumber () const
 
bool isString () const
 
bool isTable () const
 
bool isFunction () const
 
bool isUserdata () const
 
bool isThread () const
 
bool isLightUserdata () const
 
template<class T >
cast () const
 
template<class T >
 operator T () const
 
template<class T >
Proxy operator[] (T key) const
 
template<class T >
LuaRef rawget (T key) const
 
template<class T >
void append (T v) const
 
int length () const
 
template<class T >
bool operator== (T rhs) const
 
template<class T >
bool operator< (T rhs) const
 
template<class T >
bool operator<= (T rhs) const
 
template<class T >
bool operator> (T rhs) const
 
template<class T >
bool operator>= (T rhs) const
 
template<class T >
bool rawequal (T rhs) const
 
LuaRef const operator() () const
 
template<class P1 >
LuaRef const operator() (P1 p1) const
 
template<class P1 , class P2 >
LuaRef const operator() (P1 p1, P2 p2) const
 
template<class P1 , class P2 , class P3 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3) const
 
template<class P1 , class P2 , class P3 , class P4 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4) const
 
template<class P1 , class P2 , class P3 , class P4 , class P5 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const
 
template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const
 
template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const
 
template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const
 

Private Attributes

lua_Statem_L
 
int m_tableRef
 
int m_keyRef
 

Detailed Description

A proxy for representing table values.

Definition at line 105 of file LuaRef.h.

Constructor & Destructor Documentation

◆ Proxy() [1/2]

LuaRef::Proxy::Proxy ( lua_State L,
int  tableRef 
)
inline

Construct a Proxy from a table value.

The table is in the registry, and the key is at the top of the stack. The key is popped off the stack.

Definition at line 120 of file LuaRef.h.

◆ Proxy() [2/2]

LuaRef::Proxy::Proxy ( Proxy const &  other)
inline

Create a Proxy via copy constructor.

It is best to avoid code paths that invoke this, because it creates an extra temporary Lua reference. Typically this is done by passing the Proxy parameter as a const reference.

Definition at line 135 of file LuaRef.h.

◆ ~Proxy()

LuaRef::Proxy::~Proxy ( )
inline

Destroy the proxy.

This does not destroy the table value.

Definition at line 154 of file LuaRef.h.

Member Function Documentation

◆ append()

template<class T >
void LuaRef::Proxy::append ( v) const
inline

Append a value to the table.

If the table is a sequence this will add another element to it.

Definition at line 396 of file LuaRef.h.

◆ cast()

template<class T >
T LuaRef::Proxy::cast ( ) const
inline

Perform an explicit conversion.

Definition at line 262 of file LuaRef.h.

◆ clone_instance()

Proxy& LuaRef::Proxy::clone_instance ( const void *  key,
void *  p 
)

◆ createRef()

int LuaRef::Proxy::createRef ( ) const
inline

Return a reference to the table value.

Definition at line 163 of file LuaRef.h.

◆ isBoolean()

bool LuaRef::Proxy::isBoolean ( ) const
inline

Definition at line 248 of file LuaRef.h.

◆ isFunction()

bool LuaRef::Proxy::isFunction ( ) const
inline

Definition at line 252 of file LuaRef.h.

◆ isLightUserdata()

bool LuaRef::Proxy::isLightUserdata ( ) const
inline

Definition at line 255 of file LuaRef.h.

◆ isNil()

bool LuaRef::Proxy::isNil ( ) const
inline

Definition at line 247 of file LuaRef.h.

◆ isNumber()

bool LuaRef::Proxy::isNumber ( ) const
inline

Definition at line 249 of file LuaRef.h.

◆ isString()

bool LuaRef::Proxy::isString ( ) const
inline

Definition at line 250 of file LuaRef.h.

◆ isTable()

bool LuaRef::Proxy::isTable ( ) const
inline

Definition at line 251 of file LuaRef.h.

◆ isThread()

bool LuaRef::Proxy::isThread ( ) const
inline

Definition at line 254 of file LuaRef.h.

◆ isUserdata()

bool LuaRef::Proxy::isUserdata ( ) const
inline

Definition at line 253 of file LuaRef.h.

◆ length()

int LuaRef::Proxy::length ( ) const
inline

Call the length operator.

This is identical to applying the Lua # operator.

Definition at line 410 of file LuaRef.h.

◆ operator T()

template<class T >
LuaRef::Proxy::operator T ( ) const
inline

Universal implicit conversion operator.

NOTE: Visual Studio 2010 and 2012 have a bug where this function is not used. See:

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/e30b2664-a92d-445c-9db2-e8e0fbde2014 https://connect.microsoft.com/VisualStudio/feedback/details/771509/correct-code-doesnt-compile

// This code snippet fails to compile in vs2010,vs2012
struct S {
template <class T> inline operator T () const { return T (); }
};
int main () {
S () || false;
return 0;
}

Definition at line 295 of file LuaRef.h.

◆ operator()() [1/9]

LuaRef const LuaRef::Proxy::operator() ( ) const
inline

Call Lua code.

These overloads allow Lua code to be called with up to 8 parameters. The return value is provided as a LuaRef (which may be LUA_REFNIL). If an error occurs, a LuaException is thrown.

Definition at line 426 of file LuaRef.h.

◆ operator()() [2/9]

template<class P1 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1) const
inline

Definition at line 434 of file LuaRef.h.

◆ operator()() [3/9]

template<class P1 , class P2 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2 
) const
inline

Definition at line 443 of file LuaRef.h.

◆ operator()() [4/9]

template<class P1 , class P2 , class P3 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3 
) const
inline

Definition at line 453 of file LuaRef.h.

◆ operator()() [5/9]

template<class P1 , class P2 , class P3 , class P4 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
) const
inline

Definition at line 464 of file LuaRef.h.

◆ operator()() [6/9]

template<class P1 , class P2 , class P3 , class P4 , class P5 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
) const
inline

Definition at line 476 of file LuaRef.h.

◆ operator()() [7/9]

template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
) const
inline

Definition at line 489 of file LuaRef.h.

◆ operator()() [8/9]

template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
) const
inline

Definition at line 503 of file LuaRef.h.

◆ operator()() [9/9]

template<class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
LuaRef const LuaRef::Proxy::operator() ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7,
P8  p8 
) const
inline

Definition at line 518 of file LuaRef.h.

◆ operator<()

template<class T >
bool LuaRef::Proxy::operator< ( rhs) const
inline

Definition at line 315 of file LuaRef.h.

◆ operator<=()

template<class T >
bool LuaRef::Proxy::operator<= ( rhs) const
inline

Definition at line 324 of file LuaRef.h.

◆ operator=()

template<class T >
Proxy& LuaRef::Proxy::operator= ( v)
inline

Assign a new value to this table key.

This may invoke metamethods.

Definition at line 176 of file LuaRef.h.

◆ operator==()

template<class T >
bool LuaRef::Proxy::operator== ( rhs) const
inline

Universal comparison operators.

Definition at line 306 of file LuaRef.h.

◆ operator>()

template<class T >
bool LuaRef::Proxy::operator> ( rhs) const
inline

Definition at line 333 of file LuaRef.h.

◆ operator>=()

template<class T >
bool LuaRef::Proxy::operator>= ( rhs) const
inline

Definition at line 342 of file LuaRef.h.

◆ operator[]()

template<class T >
Proxy LuaRef::Proxy::operator[] ( key) const
inline

Access a table value using a key.

This invokes metamethods.

Definition at line 367 of file LuaRef.h.

◆ push()

void LuaRef::Proxy::push ( lua_State L) const
inline

Push the value onto the Lua stack.

Definition at line 223 of file LuaRef.h.

◆ rawequal()

template<class T >
bool LuaRef::Proxy::rawequal ( rhs) const
inline

Definition at line 351 of file LuaRef.h.

◆ rawget()

template<class T >
LuaRef LuaRef::Proxy::rawget ( key) const
inline

Access a table value using a key.

The operation is raw, metamethods are not invoked. The result is passed by value and may not be modified.

Definition at line 380 of file LuaRef.h.

◆ rawset()

template<class T >
Proxy& LuaRef::Proxy::rawset ( v)
inline

Assign a new value to this table key.

The assignment is raw, no metamethods are invoked.

Definition at line 198 of file LuaRef.h.

◆ state()

lua_State* LuaRef::Proxy::state ( void  ) const
inline

Retrieve the lua_State associated with the table value.

Definition at line 214 of file LuaRef.h.

◆ type()

int LuaRef::Proxy::type ( ) const
inline

Determine the object type.

The return values are the same as for lua_type.

Definition at line 238 of file LuaRef.h.

Member Data Documentation

◆ m_keyRef

int LuaRef::Proxy::m_keyRef
private

Definition at line 110 of file LuaRef.h.

◆ m_L

lua_State* LuaRef::Proxy::m_L
private

Definition at line 108 of file LuaRef.h.

◆ m_tableRef

int LuaRef::Proxy::m_tableRef
private

Definition at line 109 of file LuaRef.h.


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