Fix clang format issues (#1555)

This commit is contained in:
Jordan Bayles 2024-09-09 15:48:18 -07:00 committed by GitHub
parent 6668fa51ee
commit 5c003ecacc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 19 deletions

View File

@ -69,7 +69,9 @@ public:
// Boilerplate // Boilerplate
SecureAllocator() {} SecureAllocator() {}
template <typename U> SecureAllocator(const SecureAllocator<U>&) {} template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
template <typename U> struct rebind { using other = SecureAllocator<U>; }; template <typename U> struct rebind {
using other = SecureAllocator<U>;
};
}; };
template <typename T, typename U> template <typename T, typename U>

View File

@ -51,12 +51,12 @@ public:
}; };
/** \brief Constructs a Reader allowing all features for parsing. /** \brief Constructs a Reader allowing all features for parsing.
* \deprecated Use CharReader and CharReaderBuilder. * \deprecated Use CharReader and CharReaderBuilder.
*/ */
Reader(); Reader();
/** \brief Constructs a Reader allowing the specified feature set for parsing. /** \brief Constructs a Reader allowing the specified feature set for parsing.
* \deprecated Use CharReader and CharReaderBuilder. * \deprecated Use CharReader and CharReaderBuilder.
*/ */
Reader(const Features& features); Reader(const Features& features);
@ -272,7 +272,7 @@ public:
*/ */
virtual CharReader* newCharReader() const = 0; virtual CharReader* newCharReader() const = 0;
}; // Factory }; // Factory
}; // CharReader }; // CharReader
/** \brief Build a CharReader implementation. /** \brief Build a CharReader implementation.
* *

View File

@ -586,19 +586,23 @@ public:
iterator end(); iterator end();
/// \brief Returns a reference to the first element in the `Value`. /// \brief Returns a reference to the first element in the `Value`.
/// Requires that this value holds an array or json object, with at least one element. /// Requires that this value holds an array or json object, with at least one
/// element.
const Value& front() const; const Value& front() const;
/// \brief Returns a reference to the first element in the `Value`. /// \brief Returns a reference to the first element in the `Value`.
/// Requires that this value holds an array or json object, with at least one element. /// Requires that this value holds an array or json object, with at least one
/// element.
Value& front(); Value& front();
/// \brief Returns a reference to the last element in the `Value`. /// \brief Returns a reference to the last element in the `Value`.
/// Requires that value holds an array or json object, with at least one element. /// Requires that value holds an array or json object, with at least one
/// element.
const Value& back() const; const Value& back() const;
/// \brief Returns a reference to the last element in the `Value`. /// \brief Returns a reference to the last element in the `Value`.
/// Requires that this value holds an array or json object, with at least one element. /// Requires that this value holds an array or json object, with at least one
/// element.
Value& back(); Value& back();
// Accessors for the [start, limit) range of bytes within the JSON text from // Accessors for the [start, limit) range of bytes within the JSON text from

View File

@ -64,7 +64,7 @@ public:
*/ */
virtual StreamWriter* newStreamWriter() const = 0; virtual StreamWriter* newStreamWriter() const = 0;
}; // Factory }; // Factory
}; // StreamWriter }; // StreamWriter
/** \brief Write into stringstream, then return string, for convenience. /** \brief Write into stringstream, then return string, for convenience.
* A StreamWriter will be created from the factory, used, and then deleted. * A StreamWriter will be created from the factory, used, and then deleted.
@ -168,8 +168,7 @@ public:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSON_API FastWriter class JSON_API FastWriter : public Writer {
: public Writer {
public: public:
FastWriter(); FastWriter();
~FastWriter() override = default; ~FastWriter() override = default;
@ -228,8 +227,7 @@ private:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSON_API class JSON_API StyledWriter : public Writer {
StyledWriter : public Writer {
public: public:
StyledWriter(); StyledWriter();
~StyledWriter() override = default; ~StyledWriter() override = default;
@ -297,8 +295,7 @@ private:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSON_API class JSON_API StyledStreamWriter {
StyledStreamWriter {
public: public:
/** /**
* \param indentation Each level will be indented by this amount extra. * \param indentation Each level will be indented by this amount extra.

View File

@ -608,7 +608,7 @@ bool Reader::decodeDouble(Token& token, Value& decoded) {
value = -std::numeric_limits<double>::infinity(); value = -std::numeric_limits<double>::infinity();
else if (!std::isinf(value)) else if (!std::isinf(value))
return addError( return addError(
"'" + String(token.start_, token.end_) + "' is not a number.", token); "'" + String(token.start_, token.end_) + "' is not a number.", token);
} }
decoded = value; decoded = value;
return true; return true;
@ -1660,7 +1660,7 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
value = -std::numeric_limits<double>::infinity(); value = -std::numeric_limits<double>::infinity();
else if (!std::isinf(value)) else if (!std::isinf(value))
return addError( return addError(
"'" + String(token.start_, token.end_) + "' is not a number.", token); "'" + String(token.start_, token.end_) + "' is not a number.", token);
} }
decoded = value; decoded = value;
return true; return true;

View File

@ -132,8 +132,9 @@ String valueToString(double value, bool useSpecialFloats,
if (!isfinite(value)) { if (!isfinite(value)) {
static const char* const reps[2][3] = {{"NaN", "-Infinity", "Infinity"}, static const char* const reps[2][3] = {{"NaN", "-Infinity", "Infinity"},
{"null", "-1e+9999", "1e+9999"}}; {"null", "-1e+9999", "1e+9999"}};
return reps[useSpecialFloats ? 0 : 1] return reps[useSpecialFloats ? 0 : 1][isnan(value) ? 0
[isnan(value) ? 0 : (value < 0) ? 1 : 2]; : (value < 0) ? 1
: 2];
} }
String buffer(size_t(36), '\0'); String buffer(size_t(36), '\0');