changeset 3993:7e8bfda62b43

fix msvc builds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Jun 2020 16:52:09 +0200
parents f9863630ec7f
children aba6b6b490ea 1f405a3fdeca
files Core/Enumerations.h Core/Logging.h Resources/CMake/OrthancFrameworkConfiguration.cmake
diffstat 3 files changed, 144 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Enumerations.h	Fri Jun 05 16:07:01 2020 +0200
+++ b/Core/Enumerations.h	Fri Jun 05 16:52:09 2020 +0200
@@ -807,97 +807,142 @@
   };
 
 
-  const char* EnumerationToString(ErrorCode code) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(ErrorCode code);
 
-  const char* EnumerationToString(HttpMethod method) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(HttpMethod method);
 
-  const char* EnumerationToString(HttpStatus status) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(HttpStatus status);
 
-  const char* EnumerationToString(ResourceType type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(ResourceType type);
 
-  const char* EnumerationToString(ImageFormat format) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(ImageFormat format);
 
-  const char* EnumerationToString(Encoding encoding) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(Encoding encoding);
 
-  const char* EnumerationToString(PhotometricInterpretation photometric) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(PhotometricInterpretation photometric);
 
-  const char* EnumerationToString(LogLevel level) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(LogLevel level);
 
-  const char* EnumerationToString(RequestOrigin origin) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(RequestOrigin origin);
 
-  const char* EnumerationToString(PixelFormat format) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(PixelFormat format);
 
-  const char* EnumerationToString(ModalityManufacturer manufacturer) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(ModalityManufacturer manufacturer);
 
-  const char* EnumerationToString(DicomRequestType type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(DicomRequestType type);
 
-  const char* EnumerationToString(TransferSyntax syntax) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(TransferSyntax syntax);
 
-  const char* EnumerationToString(DicomVersion version) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(DicomVersion version);
 
-  const char* EnumerationToString(ValueRepresentation vr) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(ValueRepresentation vr);
 
-  const char* EnumerationToString(JobState state) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(JobState state);
 
-  const char* EnumerationToString(MimeType mime) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(MimeType mime);
 
-  const char* EnumerationToString(Endianness endianness) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(Endianness endianness);
 
-  const char* EnumerationToString(StorageCommitmentFailureReason reason) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* EnumerationToString(StorageCommitmentFailureReason reason);
 
-  Encoding StringToEncoding(const char* encoding) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  Encoding StringToEncoding(const char* encoding);
 
-  ResourceType StringToResourceType(const char* type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  ResourceType StringToResourceType(const char* type);
 
-  ImageFormat StringToImageFormat(const char* format) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  ImageFormat StringToImageFormat(const char* format);
 
-  LogLevel StringToLogLevel(const char* level) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  LogLevel StringToLogLevel(const char* level);
 
+  ORTHANC_PUBLIC
   ValueRepresentation StringToValueRepresentation(const std::string& vr,
-                                                  bool throwIfUnsupported) ORTHANC_PUBLIC;
+                                                  bool throwIfUnsupported);
 
-  PhotometricInterpretation StringToPhotometricInterpretation(const char* value) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  PhotometricInterpretation StringToPhotometricInterpretation(const char* value);
 
-  ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer);
 
-  DicomVersion StringToDicomVersion(const std::string& version) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  DicomVersion StringToDicomVersion(const std::string& version);
 
-  JobState StringToJobState(const std::string& state) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  JobState StringToJobState(const std::string& state);
   
-  RequestOrigin StringToRequestOrigin(const std::string& origin) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  RequestOrigin StringToRequestOrigin(const std::string& origin);
 
-  MimeType StringToMimeType(const std::string& mime) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  MimeType StringToMimeType(const std::string& mime);
   
-  unsigned int GetBytesPerPixel(PixelFormat format) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  unsigned int GetBytesPerPixel(PixelFormat format);
 
+  ORTHANC_PUBLIC
   bool GetDicomEncoding(Encoding& encoding,
-                        const char* specificCharacterSet) ORTHANC_PUBLIC;
+                        const char* specificCharacterSet);
+
+  ORTHANC_PUBLIC
+  ResourceType GetChildResourceType(ResourceType type);
 
-  ResourceType GetChildResourceType(ResourceType type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  ResourceType GetParentResourceType(ResourceType type);
 
-  ResourceType GetParentResourceType(ResourceType type) ORTHANC_PUBLIC;
-
+  ORTHANC_PUBLIC
   bool IsResourceLevelAboveOrEqual(ResourceType level,
-                                   ResourceType reference) ORTHANC_PUBLIC;
+                                   ResourceType reference);
 
-  DicomModule GetModule(ResourceType type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  DicomModule GetModule(ResourceType type);
 
-  const char* GetDicomSpecificCharacterSet(Encoding encoding) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* GetDicomSpecificCharacterSet(Encoding encoding);
 
-  HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error);
 
-  bool IsUserContentType(FileContentType type) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  bool IsUserContentType(FileContentType type);
 
-  bool IsBinaryValueRepresentation(ValueRepresentation vr) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  bool IsBinaryValueRepresentation(ValueRepresentation vr);
   
-  Encoding GetDefaultDicomEncoding() ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  Encoding GetDefaultDicomEncoding();
 
-  void SetDefaultDicomEncoding(Encoding encoding) ORTHANC_PUBLIC;
-
-  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  void SetDefaultDicomEncoding(Encoding encoding);
 
-  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax) ORTHANC_PUBLIC;
+  ORTHANC_PUBLIC
+  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax);
 
+  ORTHANC_PUBLIC
+  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax);
+
+  ORTHANC_PUBLIC
   bool LookupTransferSyntax(DicomTransferSyntax& target,
-                            const std::string& uid) ORTHANC_PUBLIC;
+                            const std::string& uid);
 }
--- a/Core/Logging.h	Fri Jun 05 16:07:01 2020 +0200
+++ b/Core/Logging.h	Fri Jun 05 16:52:09 2020 +0200
@@ -69,28 +69,28 @@
   namespace Logging
   {
 #if ORTHANC_ENABLE_LOGGING_PLUGIN == 1
-    void Initialize(OrthancPluginContext* context) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void Initialize(OrthancPluginContext* context);
 #else
-    void Initialize() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void Initialize();
 #endif
 
-    void Finalize() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void Finalize();
 
-    void Reset() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void Reset();
 
-    void Flush() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void Flush();
 
-    void EnableInfoLevel(bool enabled) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void EnableInfoLevel(bool enabled);
 
-    void EnableTraceLevel(bool enabled) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void EnableTraceLevel(bool enabled);
 
-    bool IsTraceLevelEnabled() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC bool IsTraceLevelEnabled();
 
-    bool IsInfoLevelEnabled() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC bool IsInfoLevelEnabled();
 
-    void SetTargetFile(const std::string& path) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void SetTargetFile(const std::string& path);
 
-    void SetTargetFolder(const std::string& path) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void SetTargetFolder(const std::string& path);
 
 #if ORTHANC_ENABLE_LOGGING_STDIO == 1
     typedef void (*LoggingFunction)(const char*);
@@ -128,9 +128,9 @@
        ORTHANC_ENABLE_LOGGING_STDIO == 1)
 
 #  include <boost/noncopyable.hpp>
-#  define LOG(level)  ::Orthanc::Logging::InternalLogger \
+#  define LOG(level)  ::Orthanc::Logging::InternalLogger                \
   (::Orthanc::Logging::InternalLevel_ ## level, __FILE__, __LINE__)
-#  define VLOG(level) ::Orthanc::Logging::InternalLogger \
+#  define VLOG(level) ::Orthanc::Logging::InternalLogger        \
   (::Orthanc::Logging::InternalLevel_TRACE, __FILE__, __LINE__)
 
 namespace Orthanc
@@ -159,7 +159,7 @@
       ~InternalLogger();
       
       template <typename T>
-      InternalLogger& operator<< (const T& message)
+        InternalLogger& operator<< (const T& message)
       {
         messageStream_ << message;
         return *this;
@@ -198,74 +198,74 @@
       ~InternalLogger();
       
       template <typename T>
-      std::ostream& operator<< (const T& message)
+        std::ostream& operator<< (const T& message)
       {
         return (*stream_) << boost::lexical_cast<std::string>(message);
       }
     };
 
     /**
-    opaque pointer that represents the state of the logging configuration
+       opaque pointer that represents the state of the logging configuration
     */
     typedef void* LoggingMemento;
 
     /**
-    Returns an object that contains the logging configuration.
+       Returns an object that contains the logging configuration.
 
-    This function allocates resources that you must dispose of by
-    using either RestoreLoggingMemento or DiscardLoggingMemento.
+       This function allocates resources that you must dispose of by
+       using either RestoreLoggingMemento or DiscardLoggingMemento.
 
-    This function is only to be used by tests.
+       This function is only to be used by tests.
     */
-    LoggingMemento CreateLoggingMemento() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC LoggingMemento CreateLoggingMemento();
 
     /**
-    Restores the logging configuration. The logging system is restored in 
-    the state it was in when the memento object was created through 
-    GetLoggingMemento().
+       Restores the logging configuration. The logging system is restored in 
+       the state it was in when the memento object was created through 
+       GetLoggingMemento().
 
-    After calling this function, the memento object may not be used 
-    again
+       After calling this function, the memento object may not be used 
+       again
 
-    This function is only to be used by tests.
+       This function is only to be used by tests.
     */
-    void RestoreLoggingMemento(LoggingMemento memento) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void RestoreLoggingMemento(LoggingMemento memento);
 
     /**
-    Call this function if you do not plan on restoring the logging 
-    configuration state that you captured with CreateLoggingMemento
+       Call this function if you do not plan on restoring the logging 
+       configuration state that you captured with CreateLoggingMemento
 
-    This function is only to be used by tests.
+       This function is only to be used by tests.
     */
-    void DiscardLoggingMemento(LoggingMemento memento) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void DiscardLoggingMemento(LoggingMemento memento);
 
     /**
-      Set custom logging streams for the error, warning and info logs.
-      This function may not be called if a log file or folder has been 
-      set beforehand. All three pointers must be valid and cannot be NULL.
+       Set custom logging streams for the error, warning and info logs.
+       This function may not be called if a log file or folder has been 
+       set beforehand. All three pointers must be valid and cannot be NULL.
 
-      Please ensure the supplied streams remain alive and valid as long as
-      logging calls are performed.
+       Please ensure the supplied streams remain alive and valid as long as
+       logging calls are performed.
 
-      In order to prevent dangling pointer usage, it is recommended to call
-      Orthanc::Logging::Reset() before the stream objects are destroyed and 
-      the pointers become invalid.
+       In order to prevent dangling pointer usage, it is recommended to call
+       Orthanc::Logging::Reset() before the stream objects are destroyed and 
+       the pointers become invalid.
     */
-    void SetErrorWarnInfoLoggingStreams(std::ostream* errorStream,
-                                        std::ostream* warningStream, 
-                                        std::ostream* infoStream) ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void SetErrorWarnInfoLoggingStreams(std::ostream* errorStream,
+                                                       std::ostream* warningStream, 
+                                                       std::ostream* infoStream);
 
 #ifdef __EMSCRIPTEN__
     /**
-      This function will change the logging streams so that the logging functions 
-      provided by emscripten html5.h API functions are used : it will change the 
-      error_, warning_ and info_  stream objects so that their operator<< writes 
-      into the browser console using emscripten_console_error(), 
-      emscripten_console_warn() and emscripten_console_log(). This will allow for
-      logging levels to be correctly handled by the browser when the code executes
-      in Web Assembly
+       This function will change the logging streams so that the logging functions 
+       provided by emscripten html5.h API functions are used : it will change the 
+       error_, warning_ and info_  stream objects so that their operator<< writes 
+       into the browser console using emscripten_console_error(), 
+       emscripten_console_warn() and emscripten_console_log(). This will allow for
+       logging levels to be correctly handled by the browser when the code executes
+       in Web Assembly
     */
-    void EnableEmscriptenLogging() ORTHANC_PUBLIC;
+    ORTHANC_PUBLIC void EnableEmscriptenLogging();
 #endif
   }
 }
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri Jun 05 16:07:01 2020 +0200
+++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri Jun 05 16:52:09 2020 +0200
@@ -544,6 +544,7 @@
 if (ORTHANC_SANDBOXED)
   add_definitions(
     -DORTHANC_SANDBOXED=1
+    -DORTHANC_ENABLE_LOGGING_PLUGIN=0
     )
 
   if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
@@ -590,12 +591,6 @@
   add_definitions(-DORTHANC_ENABLE_LOGGING=0)
 endif()
 
-if (ORTHANC_ENABLE_LOGGING_PLUGIN)
-  add_definitions(-DORTHANC_ENABLE_LOGGING_PLUGIN=1)
-else()
-  add_definitions(-DORTHANC_ENABLE_LOGGING_PLUGIN=0)
-endif()
-
 if (ORTHANC_ENABLE_LOGGING_STDIO)
   add_definitions(-DORTHANC_ENABLE_LOGGING_STDIO=1)
 else()