Debian Codegraph @

podofo/tools/podofoimpose/planreader_lua.h

raw
1 //
2 // C++ Header: planreader_lua
3 //
4 // Description:
5 //
6 //
7 // Author: Pierre Marchand <[email protected]>, (C) 2008
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef PLANREADERLUA_H
14 #define PLANREADERLUA_H
15
16 #include "impositionplan.h"
17
18 #include <string>
19
20 struct lua_State;
21
22 class LuaMachina
23 {
24 lua_State *L;
25 public:
26 LuaMachina();
27 ~LuaMachina();
28
29 inline lua_State* State()
30 {
31 return L;
32 }
33 };
34
35 // could be best to have a base class but we wont develop 36000
36 // readers after all.
37 class PlanReader_Lua
38 {
39 LuaMachina L;
40
41 public:
42 PlanReader_Lua(const std::string & planfile, PoDoFo::Impose::ImpositionPlan* ip);
43 ~PlanReader_Lua();
44
45 static int PushRecord(lua_State *L);
46
47 private:
48 PoDoFo::Impose::ImpositionPlan* plan;
49
50 /** Ask if a variable is available in script global scope */
51 bool hasGlobal(const std::string& name);
52
53 /** Get the value of the named global from the Lua environment */
54 double getNumber(const std::string& name);
55 /** Set a global to the passed value */
56 void setNumber(const std::string& name, double value);
57
58 std::string getString(const std::string& name);
59 };
60
61 #endif