Skip to content

Commit 81ae1d5

Browse files
authored
Just run clang format (open-source-parsers#1025)
1 parent 18f790f commit 81ae1d5

File tree

6 files changed

+64
-68
lines changed

6 files changed

+64
-68
lines changed

include/json/reader.h

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ namespace Json {
3636
*
3737
* \deprecated Use CharReader and CharReaderBuilder.
3838
*/
39-
class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_API Reader {
39+
class [[deprecated(
40+
"deprecated Use CharReader and CharReaderBuilder.")]] JSON_API Reader {
4041
public:
4142
typedef char Char;
4243
typedef const Char* Location;
@@ -74,8 +75,8 @@ class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_AP
7475
* \return \c true if the document was successfully parsed, \c false if an
7576
* error occurred.
7677
*/
77-
bool
78-
parse(const std::string& document, Value& root, bool collectComments = true);
78+
bool parse(const std::string& document, Value& root,
79+
bool collectComments = true);
7980

8081
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
8182
* document.
@@ -93,14 +94,12 @@ class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_AP
9394
* \return \c true if the document was successfully parsed, \c false if an
9495
* error occurred.
9596
*/
96-
bool parse(const char* beginDoc,
97-
const char* endDoc,
98-
Value& root,
97+
bool parse(const char* beginDoc, const char* endDoc, Value& root,
9998
bool collectComments = true);
10099

101100
/// \brief Parse from input stream.
102101
/// \see Json::operator>>(std::istream&, Json::Value&).
103-
bool parse(IStream& is, Value& root, bool collectComments = true);
102+
bool parse(IStream & is, Value & root, bool collectComments = true);
104103

105104
/** \brief Returns a user friendly string that list errors in the parsed
106105
* document.
@@ -110,8 +109,8 @@ class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_AP
110109
* occurred during parsing.
111110
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
112111
*/
113-
[[deprecated("Use getFormattedErrorMessages() instead.")]]
114-
String getFormatedErrorMessages() const;
112+
[[deprecated("Use getFormattedErrorMessages() instead.")]] String
113+
getFormatedErrorMessages() const;
115114

116115
/** \brief Returns a user friendly string that list errors in the parsed
117116
* document.
@@ -191,7 +190,7 @@ class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_AP
191190

192191
typedef std::deque<ErrorInfo> Errors;
193192

194-
bool readToken(Token& token);
193+
bool readToken(Token & token);
195194
void skipSpaces();
196195
bool match(const Char* pattern, int patternLength);
197196
bool readComment();
@@ -200,35 +199,30 @@ class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_AP
200199
bool readString();
201200
void readNumber();
202201
bool readValue();
203-
bool readObject(Token& token);
204-
bool readArray(Token& token);
205-
bool decodeNumber(Token& token);
206-
bool decodeNumber(Token& token, Value& decoded);
207-
bool decodeString(Token& token);
208-
bool decodeString(Token& token, String& decoded);
209-
bool decodeDouble(Token& token);
210-
bool decodeDouble(Token& token, Value& decoded);
211-
bool decodeUnicodeCodePoint(Token& token,
212-
Location& current,
213-
Location end,
202+
bool readObject(Token & token);
203+
bool readArray(Token & token);
204+
bool decodeNumber(Token & token);
205+
bool decodeNumber(Token & token, Value & decoded);
206+
bool decodeString(Token & token);
207+
bool decodeString(Token & token, String & decoded);
208+
bool decodeDouble(Token & token);
209+
bool decodeDouble(Token & token, Value & decoded);
210+
bool decodeUnicodeCodePoint(Token & token, Location & current, Location end,
214211
unsigned int& unicode);
215-
bool decodeUnicodeEscapeSequence(Token& token,
216-
Location& current,
217-
Location end,
218-
unsigned int& unicode);
212+
bool decodeUnicodeEscapeSequence(Token & token, Location & current,
213+
Location end, unsigned int& unicode);
219214
bool addError(const String& message, Token& token, Location extra = nullptr);
220215
bool recoverFromError(TokenType skipUntilToken);
221-
bool addErrorAndRecover(const String& message,
222-
Token& token,
216+
bool addErrorAndRecover(const String& message, Token& token,
223217
TokenType skipUntilToken);
224218
void skipUntilSpace();
225219
Value& currentValue();
226220
Char getNextChar();
227-
void
228-
getLocationLineAndColumn(Location location, int& line, int& column) const;
221+
void getLocationLineAndColumn(Location location, int& line, int& column)
222+
const;
229223
String getLocationLineAndColumn(Location location) const;
230224
void addComment(Location begin, Location end, CommentPlacement placement);
231-
void skipCommentTokens(Token& token);
225+
void skipCommentTokens(Token & token);
232226

233227
static bool containsNewLine(Location begin, Location end);
234228
static String normalizeEOL(Location begin, Location end);

include/json/value.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ class JSON_API Value {
203203
static Value const& nullSingleton();
204204

205205
/// Minimum signed integer value that can be stored in a Json::Value.
206-
static constexpr LargestInt minLargestInt = LargestInt(~(LargestUInt(-1) / 2));
206+
static constexpr LargestInt minLargestInt =
207+
LargestInt(~(LargestUInt(-1) / 2));
207208
/// Maximum signed integer value that can be stored in a Json::Value.
208209
static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(-1) / 2);
209210
/// Maximum unsigned integer value that can be stored in a Json::Value.
@@ -566,8 +567,8 @@ class JSON_API Value {
566567
//# endif
567568

568569
/// \deprecated Always pass len.
569-
[[deprecated("Use setComment(String const&) instead.")]]
570-
void setComment(const char* comment, CommentPlacement placement) {
570+
[[deprecated("Use setComment(String const&) instead.")]] void
571+
setComment(const char* comment, CommentPlacement placement) {
571572
setComment(String(comment, strlen(comment)), placement);
572573
}
573574
/// Comments must be //... or /* ... */
@@ -752,8 +753,7 @@ class JSON_API ValueIteratorBase {
752753
/// objectValue.
753754
/// \deprecated This cannot be used for UTF-8 strings, since there can be
754755
/// embedded nulls.
755-
[[deprecated("Use `key = name();` instead.")]]
756-
char const* memberName() const;
756+
[[deprecated("Use `key = name();` instead.")]] char const* memberName() const;
757757
/// Return the member name of the referenced Value, or NULL if it is not an
758758
/// objectValue.
759759
/// \note Better version than memberName(). Allows embedded nulls.

include/json/writer.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ namespace Json {
2727
class Value;
2828

2929
/**
30-
*
31-
* Usage:
32-
* \code
33-
* using namespace Json;
34-
* void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
35-
* std::unique_ptr<StreamWriter> const writer(
36-
* factory.newStreamWriter());
37-
* writer->write(value, &std::cout);
38-
* std::cout << std::endl; // add lf and flush
39-
* }
40-
* \endcode
41-
*/
30+
*
31+
* Usage:
32+
* \code
33+
* using namespace Json;
34+
* void writeToStdout(StreamWriter::Factory const& factory, Value const& value)
35+
* { std::unique_ptr<StreamWriter> const writer( factory.newStreamWriter());
36+
* writer->write(value, &std::cout);
37+
* std::cout << std::endl; // add lf and flush
38+
* }
39+
* \endcode
40+
*/
4241
class JSON_API StreamWriter {
4342
protected:
4443
OStream* sout_; // not owned; will not delete
4544
public:
4645
StreamWriter();
4746
virtual ~StreamWriter();
48-
/** Write Value into document as configured in sub-class.
49-
* Do not take ownership of sout, but maintain a reference during function.
50-
* \pre sout != NULL
51-
* \return zero on success (For now, we always return zero, so check the
52-
* stream instead.) \throw std::exception possibly, depending on configuration
53-
*/
47+
/** Write Value into document as configured in sub-class.
48+
* Do not take ownership of sout, but maintain a reference during function.
49+
* \pre sout != NULL
50+
* \return zero on success (For now, we always return zero, so check the
51+
* stream instead.) \throw std::exception possibly, depending on
52+
* configuration
53+
*/
5454
virtual int write(Value const& root, OStream* sout) = 0;
5555

5656
/** \brief A simple abstract factory.
@@ -225,8 +225,8 @@ class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API FastWriter
225225
#pragma warning(push)
226226
#pragma warning(disable : 4996) // Deriving from deprecated class
227227
#endif
228-
class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API
229-
StyledWriter : public Writer {
228+
class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API StyledWriter
229+
: public Writer {
230230
public:
231231
StyledWriter();
232232
~StyledWriter() override = default;
@@ -294,8 +294,8 @@ class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API
294294
#pragma warning(push)
295295
#pragma warning(disable : 4996) // Deriving from deprecated class
296296
#endif
297-
class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API
298-
StyledStreamWriter {
297+
class [[deprecated(
298+
"Use StreamWriterBuilder instead")]] JSON_API StyledStreamWriter {
299299
public:
300300
/**
301301
* \param indentation Each level will be indented by this amount extra.
@@ -310,7 +310,7 @@ class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API
310310
* \note There is no point in deriving from Writer, since write() should not
311311
* return a value.
312312
*/
313-
void write(OStream& out, const Value& root);
313+
void write(OStream & out, const Value& root);
314314

315315
private:
316316
void writeValue(const Value& value);

src/lib_json/json_value.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ Value const& Value::null = Value::nullSingleton();
8888
Value const& Value::nullRef = Value::nullSingleton();
8989
#endif
9090

91-
9291
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
9392
template <typename T, typename U>
9493
static inline bool InRange(double d, T min, U max) {

src/test_lib_json/jsontest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ void Runner::preventDialogOnCrash() {
378378
_CrtSetReportHook(&msvcrtSilentReportHook);
379379
#endif // if defined(_MSC_VER)
380380

381-
// @todo investigate this handler (for buffer overflow)
382-
// _set_security_error_handler
381+
// @todo investigate this handler (for buffer overflow)
382+
// _set_security_error_handler
383383

384384
#if defined(_WIN32)
385385
// Prevents the system from popping a dialog for debugging if the

src/test_lib_json/main.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,8 @@ JSONTEST_FIXTURE(StreamWriterTest, indentation) {
19201920
JSONTEST_ASSERT(Json::writeString(b, root) == "{\"hello\":\"world\"}");
19211921

19221922
b.settings_["indentation"] = "\t";
1923-
JSONTEST_ASSERT(Json::writeString(b, root) == "{\n\t\"hello\" : \"world\"\n}");
1923+
JSONTEST_ASSERT(Json::writeString(b, root) ==
1924+
"{\n\t\"hello\" : \"world\"\n}");
19241925
}
19251926

19261927
JSONTEST_FIXTURE(StreamWriterTest, writeZeroes) {
@@ -2198,9 +2199,10 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
21982199
Json::String errs;
21992200
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
22002201
JSONTEST_ASSERT(!ok);
2201-
JSONTEST_ASSERT_STRING_EQUAL("* Line 1, Column 1\n"
2202-
" A valid JSON document must be either an array or an object value.\n",
2203-
errs);
2202+
JSONTEST_ASSERT_STRING_EQUAL(
2203+
"* Line 1, Column 1\n"
2204+
" A valid JSON document must be either an array or an object value.\n",
2205+
errs);
22042206
JSONTEST_ASSERT_EQUAL("property", root);
22052207
delete reader;
22062208
}
@@ -2451,7 +2453,8 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
24512453
Json::String errs;
24522454
Json::CharReader* reader(b.newCharReader());
24532455
{
2454-
char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity,\"d\":+Infinity}";
2456+
char const doc[] =
2457+
"{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity,\"d\":+Infinity}";
24552458
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
24562459
JSONTEST_ASSERT(ok);
24572460
JSONTEST_ASSERT_STRING_EQUAL("", errs);
@@ -2487,7 +2490,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
24872490
{__LINE__, false, "{\"a\":.Infinity}"}, //
24882491
{__LINE__, false, "{\"a\":_Infinity}"}, //
24892492
{__LINE__, false, "{\"a\":_nfinity}"}, //
2490-
{__LINE__, true, "{\"a\":-Infinity}"}, //
2493+
{__LINE__, true, "{\"a\":-Infinity}"}, //
24912494
{__LINE__, true, "{\"a\":+Infinity}"} //
24922495
};
24932496
for (const auto& td : test_data) {
@@ -2594,7 +2597,7 @@ JSONTEST_FIXTURE(IteratorTest, const) {
25942597
Json::Value const v;
25952598
JSONTEST_ASSERT_THROWS(
25962599
Json::Value::iterator it(v.begin()) // Compile, but throw.
2597-
);
2600+
);
25982601

25992602
Json::Value value;
26002603

0 commit comments

Comments
 (0)