Mercurial > hg > orthanc
diff Core/Enumerations.h @ 3364:ea299aca479b
Added workaround for lack of support of __cplusplus in Visual Studio
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 07 May 2019 13:21:41 +0200 |
parents | 45e1631febbb |
children | 56ea9c476dba |
line wrap: on
line diff
--- a/Core/Enumerations.h Tue May 07 11:12:29 2019 +0000 +++ b/Core/Enumerations.h Tue May 07 13:21:41 2019 +0200 @@ -49,17 +49,33 @@ // Macros "ORTHANC_OVERRIDE" and "ORTHANC_FINAL" wrap the "override" // and "final" keywords introduced in C++11, to do compile-time // checking of virtual methods +// The __cplusplus macro is broken in Visual Studio up to 15.6 and, in +// later versions, require the usage of the /Zc:__cplusplus flag +// We thus use an alternate way of checking for 'override' support +#ifdef ORTHANC_OVERRIDE_SUPPORTED +#error ORTHANC_OVERRIDE_SUPPORTED cannot be defined at this point +#endif + #if __cplusplus >= 201103L -// C++11 is enabled -# define ORTHANC_OVERRIDE override +# define ORTHANC_OVERRIDE_SUPPORTED 1 +#else +# ifdef _MSC_VER +# if _MSC_VER >= 1600 +# define ORTHANC_OVERRIDE_SUPPORTED 1 +# endif +# endif +#endif + +#if ORTHANC_OVERRIDE_SUPPORTED +// The override keyword (C++11) is enabled +# define ORTHANC_OVERRIDE override # define ORTHANC_FINAL final #else -// C++11 is disabled +// The override keyword (C++11) is not available # define ORTHANC_OVERRIDE # define ORTHANC_FINAL #endif - namespace Orthanc { static const char* const URI_SCHEME_PREFIX_BINARY = "data:application/octet-stream;base64,";