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 @@ public: 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 @@ namespace Json { 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 @@ public: 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 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter : public Writer { public: FastWriter(); - ~FastWriter() JSONCPP_OVERRIDE {} + ~FastWriter() override {} void enableYAMLCompatibility(); @@ -183,7 +183,7 @@ public: 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 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWriter : public Writer { public: StyledWriter(); - ~StyledWriter() JSONCPP_OVERRIDE {} + ~StyledWriter() override {} public: // overridden from Writer /** \brief Serialize a Value in JSON 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); diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index 65bfad3..d024c22 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -1907,7 +1907,7 @@ public: bool parse(char const* beginDoc, char const* endDoc, Value* root, - JSONCPP_STRING* errs) JSONCPP_OVERRIDE { + JSONCPP_STRING* errs) override { bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); if (errs) { *errs = reader_.getFormattedErrorMessages(); diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 36cf055..748b7e8 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -880,7 +880,7 @@ struct BuiltStyledStreamWriter : public StreamWriter { bool useSpecialFloats, unsigned int precision, PrecisionType precisionType); - int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE; + int write(Value const& root, JSONCPP_OSTREAM* sout) override; private: void writeValue(Value const& value); diff --git a/src/test_lib_json/jsontest.h b/src/test_lib_json/jsontest.h index 48761c5..e508282 100644 --- a/src/test_lib_json/jsontest.h +++ b/src/test_lib_json/jsontest.h @@ -262,10 +262,10 @@ TestResult& checkStringEqual(TestResult& result, } \ \ public: /* overridden from TestCase */ \ - const char* testName() const JSONCPP_OVERRIDE { \ + const char* testName() const override { \ return #FixtureType "/" #name; \ } \ - void runTestCase() JSONCPP_OVERRIDE; \ + void runTestCase() override; \ }; \ \ void Test##FixtureType##name::runTestCase()