COMP: Use C++11 override directly
The override support in C++11 is required so avoid aliasing
this feature. Compilers that do not support the override keyword
are no longer supported.
diff --git a/include/json/config.h b/include/json/config.h
index a36ca15..5049c73 100644
--- a/include/json/config.h
+++ b/include/json/config.h
@@ -89,12 +89,11 @@
// In c++11 the override keyword allows you to explicitly define that a function
// is intended to override the base-class version. This makes the code more
// manageable and fixes a set of common hard-to-find bugs.
+#define JSONCPP_OVERRIDE override // Define maintained for backwards compatibility of external tools. C++11 should be used directly in JSONCPP
#if __cplusplus >= 201103L
-#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT noexcept
#define JSONCPP_OP_EXPLICIT explicit
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
-#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT throw()
#if _MSC_VER >= 1800 // MSVC 2013
#define JSONCPP_OP_EXPLICIT explicit
@@ -102,11 +101,9 @@
#define JSONCPP_OP_EXPLICIT
#endif
#elif defined(_MSC_VER) && _MSC_VER >= 1900
-#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT noexcept
#define JSONCPP_OP_EXPLICIT explicit
#else
-#define JSONCPP_OVERRIDE
#define JSONCPP_NOEXCEPT throw()
#define JSONCPP_OP_EXPLICIT
#endif
diff --git a/include/json/reader.h b/include/json/reader.h
index 9a7fba2..58cb58b 100644
--- a/include/json/reader.h
+++ b/include/json/reader.h
@@ -347,9 +347,9 @@
Json::Value settings_;
CharReaderBuilder();
- ~CharReaderBuilder() JSONCPP_OVERRIDE;
+ ~CharReaderBuilder() override;
- CharReader* newCharReader() const JSONCPP_OVERRIDE;
+ CharReader* newCharReader() const override;
/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
diff --git a/include/json/value.h b/include/json/value.h
index 3d765ec..3fdd884 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -55,8 +55,8 @@
class JSON_API Exception : public std::exception {
public:
Exception(JSONCPP_STRING const& msg);
- ~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
- char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
+ ~Exception() JSONCPP_NOEXCEPT override;
+ char const* what() const JSONCPP_NOEXCEPT override;
protected:
JSONCPP_STRING msg_;
diff --git a/include/json/writer.h b/include/json/writer.h
index d70ca1c..7faaa02 100644
--- a/include/json/writer.h
+++ b/include/json/writer.h
@@ -119,12 +119,12 @@
Json::Value settings_;
StreamWriterBuilder();
- ~StreamWriterBuilder() JSONCPP_OVERRIDE;
+ ~StreamWriterBuilder() override;
/**
* \throw std::exception if something goes wrong (e.g. invalid settings)
*/
- StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
+ StreamWriter* newStreamWriter() const override;
/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
@@ -169,7 +169,7 @@
: public Writer {
public:
FastWriter();
- ~FastWriter() JSONCPP_OVERRIDE {}
+ ~FastWriter() override {}
void enableYAMLCompatibility();
@@ -183,7 +183,7 @@
void omitEndingLineFeed();
public: // overridden from Writer
- JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
+ JSONCPP_STRING write(const Value& root) override;
private:
void writeValue(const Value& value);
@@ -229,14 +229,14 @@
StyledWriter : public Writer {
public:
StyledWriter();
- ~StyledWriter() JSONCPP_OVERRIDE {}
+ ~StyledWriter() override {}
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize.
* \return String containing the JSON document that represents the root value.
*/
- JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
+ JSONCPP_STRING write(const Value& root) override;
private:
void writeValue(const Value& value);