GemaLuaCoreLib
The GeMA Lua Core library
Loading...
Searching...
No Matches
gmLuaStateDump.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMALUA_STATE_DUMP_H_
25#define _GEMALUA_STATE_DUMP_H_
26
27#include "gmLuaObject.h"
28
29class GmStateDump;
30#include <assert.h>
31
33class GML_API_EXPORT GmLuaStateDump : public GmLuaObject
34{
35public:
36 GmLuaStateDump(GmStateDump* state, const GmLogCategory& logger, bool ownership = false);
37 virtual ~GmLuaStateDump();
38
39 // See comments on the base class
40 virtual const char* typeName() const { return "stateDump"; }
41
42 virtual QString toString() const;
43
44 virtual void fillMetatable(lua_State* L, int index);
45
47 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
48
50 GmStateDump* stateDump() const { return _state; }
51
53 bool ownership() const { return _ownsState; }
54
56 void takeOwnership() { assert(_ownsState); _ownsState = false; }
57
58private:
59 int addStateItem (lua_State* L);
60 int addGroupItem (lua_State* L);
61 int itemGroup (lua_State* L);
62 int numItems (lua_State* L);
63 int findItem (lua_State* L);
64 int setGroupActive (lua_State* L);
65 int init (lua_State* L);
66 int save (lua_State* L);
67 int load (lua_State* L);
68 int saveItem (lua_State* L);
69 int loadItem (lua_State* L);
70 int saveActiveGroups(lua_State* L);
71 int loadActiveGroups(lua_State* L);
72 int flush (lua_State* L);
73 int clear (lua_State* L);
74
77};
78
79#endif
A proxy class to export object methods to the Lua environment.
Definition gmLuaObject.h:36
virtual QString toString() const
Default method used by the __tostring metamethod to capture the result of tostring() over an object.
Definition gmLuaObject.h:55
virtual void fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
A proxy class to export GmStateDump methods to the Lua environment.
Definition gmLuaStateDump.h:34
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmValueInfo object.
Definition gmLuaStateDump.h:47
GmStateDump * stateDump() const
Returns a pointer to the internal state dump object.
Definition gmLuaStateDump.h:50
bool ownership() const
Returns true if the state dump object is owned by the proxy object.
Definition gmLuaStateDump.h:53
void takeOwnership()
Takes the state dump ownership from the proxy object.
Definition gmLuaStateDump.h:56
bool _ownsState
Are we the owner of _state?
Definition gmLuaStateDump.h:76
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaStateDump.h:40
GmStateDump * _state
The wrapped state dump object.
Definition gmLuaStateDump.h:75
Declaration of the GmLuaObject class.