mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 18:51:04 +08:00
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.
This commit is contained in:
parent
8b31c6f0fd
commit
2853b1cdac
@ -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
|
||||
|
@ -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'.
|
||||
|
@ -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_;
|
||||
|
@ -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 <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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user