diff Core/Lua/LuaContext.h @ 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 f9863630ec7f
children 100fbe970762
line wrap: on
line diff
--- a/Core/Lua/LuaContext.h	Tue Jun 09 09:20:09 2020 +0200
+++ b/Core/Lua/LuaContext.h	Tue Jun 09 16:26:57 2020 +0200
@@ -44,6 +44,10 @@
 #  error Macro ORTHANC_HAS_EMBEDDED_RESOURCES must be defined
 #endif
 
+#if !defined(ORTHANC_ENABLE_CURL)
+#  error Macro ORTHANC_ENABLE_CURL must be defined
+#endif
+
 #if ORTHANC_ENABLE_LUA == 0
 #  error The Lua support is disabled, cannot include this file
 #endif
@@ -52,7 +56,9 @@
 #  include <EmbeddedResources.h>   // Autogenerated file
 #endif
 
-#include "../HttpClient.h"
+#if ORTHANC_ENABLE_CURL == 1
+#  include "../HttpClient.h"
+#endif
 
 extern "C" 
 {
@@ -60,6 +66,7 @@
 }
 
 #include <boost/noncopyable.hpp>
+#include <json/value.h>
 
 namespace Orthanc
 {
@@ -70,20 +77,24 @@
 
     lua_State *lua_;
     std::string log_;
+
+#if ORTHANC_ENABLE_CURL == 1
     HttpClient httpClient_;
+#endif
 
     static int PrintToLog(lua_State *state);
     static int ParseJson(lua_State *state);
     static int DumpJson(lua_State *state);
 
+#if ORTHANC_ENABLE_CURL == 1
     static int SetHttpCredentials(lua_State *state);
-
     static int CallHttpPostOrPut(lua_State *state,
                                  HttpMethod method);
     static int CallHttpGet(lua_State *state);
     static int CallHttpPost(lua_State *state);
     static int CallHttpPut(lua_State *state);
     static int CallHttpDelete(lua_State *state);
+#endif
 
     bool AnswerHttpQuery(lua_State* state);
 
@@ -122,11 +133,13 @@
 
     bool IsExistingFunction(const char* name);
 
+#if ORTHANC_ENABLE_CURL == 1
     void SetHttpCredentials(const char* username,
                             const char* password)
     {
       httpClient_.SetCredentials(username, password);
     }
+#endif
 
     void RegisterFunction(const char* name,
                           lua_CFunction func);