Skip to content

Commit

Permalink
Use macro for override
Browse files Browse the repository at this point in the history
b/c MS VS2010 is supposed to be C++11 but does not fulfull
the entire standard.

Resolves open-source-parsers#410.
Re: open-source-parsers#430.
  • Loading branch information
cdunn2001 committed Mar 22, 2016
1 parent 1c47796 commit 98e981d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@

#endif // defined(_MSC_VER)

#if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
# define JSONCPP_OVERRIDE
#else
# define JSONCPP_OVERRIDE override
#endif // MSVC <= 2010


#ifndef JSON_HAS_RVALUE_REFERENCES

Expand Down
4 changes: 2 additions & 2 deletions include/json/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
Json::Value settings_;

CharReaderBuilder();
~CharReaderBuilder() override;
~CharReaderBuilder() JSONCPP_OVERRIDE;

CharReader* newCharReader() const override;
CharReader* newCharReader() const JSONCPP_OVERRIDE;

/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
Expand Down
4 changes: 2 additions & 2 deletions include/json/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ namespace Json {
class JSON_API Exception : public std::exception {
public:
Exception(JSONCPP_STRING const& msg);
~Exception() throw() override;
char const* what() const throw() override;
~Exception() throw() JSONCPP_OVERRIDE;
char const* what() const throw() JSONCPP_OVERRIDE;
protected:
JSONCPP_STRING msg_;
};
Expand Down
12 changes: 6 additions & 6 deletions include/json/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
Json::Value settings_;

StreamWriterBuilder();
~StreamWriterBuilder() override;
~StreamWriterBuilder() JSONCPP_OVERRIDE;

/**
* \throw std::exception if something goes wrong (e.g. invalid settings)
*/
StreamWriter* newStreamWriter() const override;
StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;

/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
Expand Down Expand Up @@ -158,7 +158,7 @@ class JSON_API FastWriter : public Writer {

public:
FastWriter();
~FastWriter() override {}
~FastWriter() JSONCPP_OVERRIDE {}

void enableYAMLCompatibility();

Expand All @@ -172,7 +172,7 @@ class JSON_API FastWriter : public Writer {
void omitEndingLineFeed();

public: // overridden from Writer
JSONCPP_STRING write(const Value& root) override;
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;

private:
void writeValue(const Value& value);
Expand Down Expand Up @@ -210,14 +210,14 @@ class JSON_API FastWriter : public Writer {
class JSON_API StyledWriter : public Writer {
public:
StyledWriter();
~StyledWriter() override {}
~StyledWriter() JSONCPP_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) override;
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;

private:
void writeValue(const Value& value);
Expand Down
2 changes: 1 addition & 1 deletion src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ class OurCharReader : public CharReader {
{}
bool parse(
char const* beginDoc, char const* endDoc,
Value* root, JSONCPP_STRING* errs) override {
Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
if (errs) {
*errs = reader_.getFormattedErrorMessages();
Expand Down
2 changes: 1 addition & 1 deletion src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
JSONCPP_STRING const& endingLineFeedSymbol,
bool useSpecialFloats,
unsigned int precision);
int write(Value const& root, JSONCPP_OSTREAM* sout) override;
int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
private:
void writeValue(Value const& value);
void writeArrayValue(Value const& value);
Expand Down
4 changes: 2 additions & 2 deletions src/test_lib_json/jsontest.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ TestResult& checkStringEqual(TestResult& result,
} \
\
public: /* overidden from TestCase */ \
const char* testName() const override { return #FixtureType "/" #name; } \
void runTestCase() override; \
const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
void runTestCase() JSONCPP_OVERRIDE; \
}; \
\
void Test##FixtureType##name::runTestCase()
Expand Down

0 comments on commit 98e981d

Please sign in to comment.