Skip to content

Commit 5c003ec

Browse files
authored
Fix clang format issues (open-source-parsers#1555)
1 parent 6668fa5 commit 5c003ec

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

include/json/allocator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ template <typename T> class SecureAllocator {
6969
// Boilerplate
7070
SecureAllocator() {}
7171
template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
72-
template <typename U> struct rebind { using other = SecureAllocator<U>; };
72+
template <typename U> struct rebind {
73+
using other = SecureAllocator<U>;
74+
};
7375
};
7476

7577
template <typename T, typename U>

include/json/reader.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class JSON_API Reader {
5151
};
5252

5353
/** \brief Constructs a Reader allowing all features for parsing.
54-
* \deprecated Use CharReader and CharReaderBuilder.
54+
* \deprecated Use CharReader and CharReaderBuilder.
5555
*/
5656
Reader();
5757

5858
/** \brief Constructs a Reader allowing the specified feature set for parsing.
59-
* \deprecated Use CharReader and CharReaderBuilder.
59+
* \deprecated Use CharReader and CharReaderBuilder.
6060
*/
6161
Reader(const Features& features);
6262

@@ -272,7 +272,7 @@ class JSON_API CharReader {
272272
*/
273273
virtual CharReader* newCharReader() const = 0;
274274
}; // Factory
275-
}; // CharReader
275+
}; // CharReader
276276

277277
/** \brief Build a CharReader implementation.
278278
*

include/json/value.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,19 +586,23 @@ class JSON_API Value {
586586
iterator end();
587587

588588
/// \brief Returns a reference to the first element in the `Value`.
589-
/// Requires that this value holds an array or json object, with at least one element.
589+
/// Requires that this value holds an array or json object, with at least one
590+
/// element.
590591
const Value& front() const;
591592

592593
/// \brief Returns a reference to the first element in the `Value`.
593-
/// Requires that this value holds an array or json object, with at least one element.
594+
/// Requires that this value holds an array or json object, with at least one
595+
/// element.
594596
Value& front();
595597

596598
/// \brief Returns a reference to the last element in the `Value`.
597-
/// Requires that value holds an array or json object, with at least one element.
599+
/// Requires that value holds an array or json object, with at least one
600+
/// element.
598601
const Value& back() const;
599602

600603
/// \brief Returns a reference to the last element in the `Value`.
601-
/// Requires that this value holds an array or json object, with at least one element.
604+
/// Requires that this value holds an array or json object, with at least one
605+
/// element.
602606
Value& back();
603607

604608
// Accessors for the [start, limit) range of bytes within the JSON text from

include/json/writer.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class JSON_API StreamWriter {
6464
*/
6565
virtual StreamWriter* newStreamWriter() const = 0;
6666
}; // Factory
67-
}; // StreamWriter
67+
}; // StreamWriter
6868

6969
/** \brief Write into stringstream, then return string, for convenience.
7070
* A StreamWriter will be created from the factory, used, and then deleted.
@@ -168,8 +168,7 @@ class JSON_API Writer {
168168
#pragma warning(push)
169169
#pragma warning(disable : 4996) // Deriving from deprecated class
170170
#endif
171-
class JSON_API FastWriter
172-
: public Writer {
171+
class JSON_API FastWriter : public Writer {
173172
public:
174173
FastWriter();
175174
~FastWriter() override = default;
@@ -228,8 +227,7 @@ class JSON_API FastWriter
228227
#pragma warning(push)
229228
#pragma warning(disable : 4996) // Deriving from deprecated class
230229
#endif
231-
class JSON_API
232-
StyledWriter : public Writer {
230+
class JSON_API StyledWriter : public Writer {
233231
public:
234232
StyledWriter();
235233
~StyledWriter() override = default;
@@ -297,8 +295,7 @@ class JSON_API
297295
#pragma warning(push)
298296
#pragma warning(disable : 4996) // Deriving from deprecated class
299297
#endif
300-
class JSON_API
301-
StyledStreamWriter {
298+
class JSON_API StyledStreamWriter {
302299
public:
303300
/**
304301
* \param indentation Each level will be indented by this amount extra.

src/lib_json/json_reader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ bool Reader::decodeDouble(Token& token, Value& decoded) {
608608
value = -std::numeric_limits<double>::infinity();
609609
else if (!std::isinf(value))
610610
return addError(
611-
"'" + String(token.start_, token.end_) + "' is not a number.", token);
611+
"'" + String(token.start_, token.end_) + "' is not a number.", token);
612612
}
613613
decoded = value;
614614
return true;
@@ -1660,7 +1660,7 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
16601660
value = -std::numeric_limits<double>::infinity();
16611661
else if (!std::isinf(value))
16621662
return addError(
1663-
"'" + String(token.start_, token.end_) + "' is not a number.", token);
1663+
"'" + String(token.start_, token.end_) + "' is not a number.", token);
16641664
}
16651665
decoded = value;
16661666
return true;

src/lib_json/json_writer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ String valueToString(double value, bool useSpecialFloats,
132132
if (!isfinite(value)) {
133133
static const char* const reps[2][3] = {{"NaN", "-Infinity", "Infinity"},
134134
{"null", "-1e+9999", "1e+9999"}};
135-
return reps[useSpecialFloats ? 0 : 1]
136-
[isnan(value) ? 0 : (value < 0) ? 1 : 2];
135+
return reps[useSpecialFloats ? 0 : 1][isnan(value) ? 0
136+
: (value < 0) ? 1
137+
: 2];
137138
}
138139

139140
String buffer(size_t(36), '\0');

0 commit comments

Comments
 (0)