Skip to content

Commit 98e981d

Browse files
committed
Use macro for override
b/c MS VS2010 is supposed to be C++11 but does not fulfull the entire standard. Resolves #410. Re: #430.
1 parent 1c47796 commit 98e981d

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

Diff for: include/json/config.h

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777

7878
#endif // defined(_MSC_VER)
7979

80+
#if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
81+
# define JSONCPP_OVERRIDE
82+
#else
83+
# define JSONCPP_OVERRIDE override
84+
#endif // MSVC <= 2010
85+
8086

8187
#ifndef JSON_HAS_RVALUE_REFERENCES
8288

Diff for: include/json/reader.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
333333
Json::Value settings_;
334334

335335
CharReaderBuilder();
336-
~CharReaderBuilder() override;
336+
~CharReaderBuilder() JSONCPP_OVERRIDE;
337337

338-
CharReader* newCharReader() const override;
338+
CharReader* newCharReader() const JSONCPP_OVERRIDE;
339339

340340
/** \return true if 'settings' are legal and consistent;
341341
* otherwise, indicate bad settings via 'invalid'.

Diff for: include/json/value.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ namespace Json {
5353
class JSON_API Exception : public std::exception {
5454
public:
5555
Exception(JSONCPP_STRING const& msg);
56-
~Exception() throw() override;
57-
char const* what() const throw() override;
56+
~Exception() throw() JSONCPP_OVERRIDE;
57+
char const* what() const throw() JSONCPP_OVERRIDE;
5858
protected:
5959
JSONCPP_STRING msg_;
6060
};

Diff for: include/json/writer.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
112112
Json::Value settings_;
113113

114114
StreamWriterBuilder();
115-
~StreamWriterBuilder() override;
115+
~StreamWriterBuilder() JSONCPP_OVERRIDE;
116116

117117
/**
118118
* \throw std::exception if something goes wrong (e.g. invalid settings)
119119
*/
120-
StreamWriter* newStreamWriter() const override;
120+
StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
121121

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

159159
public:
160160
FastWriter();
161-
~FastWriter() override {}
161+
~FastWriter() JSONCPP_OVERRIDE {}
162162

163163
void enableYAMLCompatibility();
164164

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

174174
public: // overridden from Writer
175-
JSONCPP_STRING write(const Value& root) override;
175+
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
176176

177177
private:
178178
void writeValue(const Value& value);
@@ -210,14 +210,14 @@ class JSON_API FastWriter : public Writer {
210210
class JSON_API StyledWriter : public Writer {
211211
public:
212212
StyledWriter();
213-
~StyledWriter() override {}
213+
~StyledWriter() JSONCPP_OVERRIDE {}
214214

215215
public: // overridden from Writer
216216
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
217217
* \param root Value to serialize.
218218
* \return String containing the JSON document that represents the root value.
219219
*/
220-
JSONCPP_STRING write(const Value& root) override;
220+
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
221221

222222
private:
223223
void writeValue(const Value& value);

Diff for: src/lib_json/json_reader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ class OurCharReader : public CharReader {
19071907
{}
19081908
bool parse(
19091909
char const* beginDoc, char const* endDoc,
1910-
Value* root, JSONCPP_STRING* errs) override {
1910+
Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
19111911
bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
19121912
if (errs) {
19131913
*errs = reader_.getFormattedErrorMessages();

Diff for: src/lib_json/json_writer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
839839
JSONCPP_STRING const& endingLineFeedSymbol,
840840
bool useSpecialFloats,
841841
unsigned int precision);
842-
int write(Value const& root, JSONCPP_OSTREAM* sout) override;
842+
int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
843843
private:
844844
void writeValue(Value const& value);
845845
void writeArrayValue(Value const& value);

Diff for: src/test_lib_json/jsontest.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ TestResult& checkStringEqual(TestResult& result,
271271
} \
272272
\
273273
public: /* overidden from TestCase */ \
274-
const char* testName() const override { return #FixtureType "/" #name; } \
275-
void runTestCase() override; \
274+
const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
275+
void runTestCase() JSONCPP_OVERRIDE; \
276276
}; \
277277
\
278278
void Test##FixtureType##name::runTestCase()

0 commit comments

Comments
 (0)