QLua
Lua-Qt bindings
Public Member Functions
qlua::LArgWrapper Class Reference

Wrapper for objects returned from QObject method invocation or passes to Lua callbacks in response to emitted signals. More...

#include <LuaArguments.h>

Collaboration diagram for qlua::LArgWrapper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LArgWrapper ()
 Default constructor.
 LArgWrapper (const LArgWrapper &other)
 Copy constructor: Clones the internal Return constructor instance.
 LArgWrapper (const QString &type)
 Create instance from type name.
void Push (lua_State *L) const
 Push values stored in the inner LArgConstructor instance on the Lua stack.
void Push (lua_State *L, void *value) const
 Push values stored in passed memory location on the Lua stack.
QGenericReturnArgument Arg () const
 Return the location where the return argument passed to a method invocation shall be stored.
const QString & Type () const
 Type name.
QMetaType::Type MetaType () const
 Meta type.
bool IsQObjectPtr () const
 Return true if wrapped type is QObject pointer.
 ~LArgWrapper ()
 Delete LArgConstructor instance.

Detailed Description

Wrapper for objects returned from QObject method invocation or passes to Lua callbacks in response to emitted signals.

This class translates C++ values to Lua values and is used to both return values from method invocations and translate the parameters received from a signal to Lua values whenever a Lua callback invocation is triggered by an emitted signal.


Constructor & Destructor Documentation

qlua::LArgWrapper::LArgWrapper ( const QString &  type) [inline]

Create instance from type name.

An instance of LArgConstructor is created from the passes type name.


Member Function Documentation

QGenericReturnArgument qlua::LArgWrapper::Arg ( ) const [inline]

Return the location where the return argument passed to a method invocation shall be stored.

This method is invoked to provide QMetaMethod::invoke with the location where the return value will be stored, which is the storage space provided by the LArgConstructor instance stored in instances of this class. After the method invocation returns the value in the LArgConstructor instance is pushed on the Lua stack through a call to LArgConstructor::Push(lua_State*).

void qlua::LArgWrapper::Push ( lua_State *  L,
void *  value 
) const [inline]

Push values stored in passed memory location on the Lua stack.

This is the method invoked when a Lua callback is called through QObject::qt_metacall (e.g. through a triggered signal). When Lua functions are called through qt_metacall the list of arguments is stored inside an array of void pointers; each parameter must therefore be converted to the proper C++ type first and then translated to a Lua values.

Parameters:
LLua state
valuememory location to read from
void qlua::LArgWrapper::Push ( lua_State *  L) const [inline]

Push values stored in the inner LArgConstructor instance on the Lua stack.

This is the method invoked to return values from a QObject method invocation.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator