Mercurial > hg > orthanc
diff Core/Lua/LuaContext.cpp @ 4026:05a363186da6
ORTHANC_BUILDING_FRAMEWORK_LIBRARY, Orthanc::InitializeFramework()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jun 2020 16:26:57 +0200 |
parents | 94f4a18a79cc |
children | e3b3af80732d |
line wrap: on
line diff
--- a/Core/Lua/LuaContext.cpp Tue Jun 09 09:20:09 2020 +0200 +++ b/Core/Lua/LuaContext.cpp Tue Jun 09 16:26:57 2020 +0200 @@ -167,6 +167,7 @@ } +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::SetHttpCredentials(lua_State *state) { LuaContext& that = GetLuaContext(state); @@ -189,8 +190,10 @@ return 0; } +#endif +#if ORTHANC_ENABLE_CURL == 1 bool LuaContext::AnswerHttpQuery(lua_State* state) { std::string str; @@ -209,8 +212,10 @@ return true; } +#endif +#if ORTHANC_ENABLE_CURL == 1 void LuaContext::SetHttpHeaders(int top) { std::map<std::string, std::string> headers; @@ -223,9 +228,11 @@ { httpClient_.AddHeader(it->first, it->second); } - } + } +#endif +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::CallHttpGet(lua_State *state) { LuaContext& that = GetLuaContext(state); @@ -256,8 +263,10 @@ return 1; } +#endif +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::CallHttpPostOrPut(lua_State *state, HttpMethod method) { @@ -308,20 +317,26 @@ return 1; } +#endif + - +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::CallHttpPost(lua_State *state) { return CallHttpPostOrPut(state, HttpMethod_Post); } +#endif +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::CallHttpPut(lua_State *state) { return CallHttpPostOrPut(state, HttpMethod_Put); } +#endif +#if ORTHANC_ENABLE_CURL == 1 int LuaContext::CallHttpDelete(lua_State *state) { LuaContext& that = GetLuaContext(state); @@ -356,6 +371,7 @@ return 1; } +#endif void LuaContext::PushJson(const Json::Value& value) @@ -554,11 +570,14 @@ lua_register(lua_, "print", PrintToLog); lua_register(lua_, "ParseJson", ParseJson); lua_register(lua_, "DumpJson", DumpJson); + +#if ORTHANC_ENABLE_CURL == 1 lua_register(lua_, "HttpGet", CallHttpGet); lua_register(lua_, "HttpPost", CallHttpPost); lua_register(lua_, "HttpPut", CallHttpPut); lua_register(lua_, "HttpDelete", CallHttpDelete); lua_register(lua_, "SetHttpCredentials", SetHttpCredentials); +#endif SetGlobalVariable("_LuaContext", this); }