GemaLuaCoreLib
The GeMA Lua Core library
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
GmLuaObject Class Referenceabstract

A proxy class to export object methods to the Lua environment. More...

#include <gmLuaObject.h>

Inheritance diagram for GmLuaObject:
Inheritance graph
[legend]
Collaboration diagram for GmLuaObject:
Collaboration graph
[legend]

Public Member Functions

virtual ~GmLuaObject ()
 Destrutor.
 
virtual void populateMetatable (lua_State *L, int index)
 Fills the object metatable to allow for the proxy to export its methods.
 
QVariant ptrToVariant ()
 Constructs a QVariant storing a POINTER to the current object.
 
void ref ()
 Increments the object reference count. Use with care.
 
- Public Member Functions inherited from LuaProxy::Base
virtual void * getClassMetatableID ()=0
 

Protected Member Functions

 GmLuaObject (const GmLogCategory &logger)
 Construtor protegido. Somente classes derivadas devem ser instanciadas.
 
virtual const char * typeName () const =0
 Returns the object type as will be stored in the object metatable.
 
virtual QString toString () const
 Default method used by the __tostring metamethod to capture the result of tostring() over an object.
 
virtual void fillMetatable (lua_State *L, int index)=0
 Function called by populateMetatable() to fill the metatable with exported methods by derived classes.
 

Protected Attributes

const GmLogCategory_logger
 A logger used by the proxy when needed.
 
QAtomicInteger< int > _refCount
 Lua objects are reference counted to enable sharing them among different states. This is needed to allow for passing objects as parameters in a parallel call. The garbage collection method releases memory only for the last reference.
 

Private Member Functions

 Q_DISABLE_COPY (GmLuaObject)
 
int gc (lua_State *L)
 Garbage collection function for proxy objects. Deletes the proxy (which can then release memory, if needed, in its own destructor)
 
int tostring (lua_State *L)
 Tostring metamethod.
 

Detailed Description

A proxy class to export object methods to the Lua environment.


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