comparison Core/Lua/LuaContext.h @ 1051:92f4bf2c5d73

HTTP GET in Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Jul 2014 12:59:28 +0200
parents cf52f3bcb2b3
children cc4ff680e2a0
comparison
equal deleted inserted replaced
1050:64f1842aae2e 1051:92f4bf2c5d73
31 31
32 32
33 #pragma once 33 #pragma once
34 34
35 #include "LuaException.h" 35 #include "LuaException.h"
36 #include "../HttpClient.h"
36 37
37 extern "C" 38 extern "C"
38 { 39 {
39 #include <lua.h> 40 #include <lua.h>
40 } 41 }
41 42
42 #include <EmbeddedResources.h> 43 #include <EmbeddedResources.h>
43
44 #include <boost/noncopyable.hpp> 44 #include <boost/noncopyable.hpp>
45 45
46 namespace Orthanc 46 namespace Orthanc
47 { 47 {
48 class LuaContext : public boost::noncopyable 48 class LuaContext : public boost::noncopyable
50 private: 50 private:
51 friend class LuaFunctionCall; 51 friend class LuaFunctionCall;
52 52
53 lua_State *lua_; 53 lua_State *lua_;
54 std::string log_; 54 std::string log_;
55 HttpClient httpClient_;
56
57 static LuaContext& GetLuaContext(lua_State *state);
55 58
56 static int PrintToLog(lua_State *L); 59 static int PrintToLog(lua_State *L);
60
61 static int CallHttpGet(lua_State *L);
57 62
58 void Execute(std::string* output, 63 void Execute(std::string* output,
59 const std::string& command); 64 const std::string& command);
60 65
66 void PushJson(const Json::Value& value);
67
61 public: 68 public:
62 LuaContext(); 69 LuaContext();
63 70
64 ~LuaContext(); 71 ~LuaContext();
65 72