run clang format

This commit is contained in:
Jordan Bayles 2024-09-09 18:47:01 -07:00
parent 7f7b02b95e
commit 2ff6cbcb97
3 changed files with 20 additions and 15 deletions

View File

@ -272,7 +272,7 @@ public:
/** \brief Returns a vector of structured errors encountered while parsing. /** \brief Returns a vector of structured errors encountered while parsing.
* Each parse call resets the stored list of errors. * Each parse call resets the stored list of errors.
*/ */
std::vector<StructuredError> getStructuredErrors() const; std::vector<StructuredError> getStructuredErrors() const;
class JSON_API Factory { class JSON_API Factory {
@ -287,17 +287,17 @@ public:
protected: protected:
class Impl { class Impl {
public: public:
virtual ~Impl() = default; virtual ~Impl() = default;
virtual bool parse(char const* beginDoc, char const* endDoc, Value* root, virtual bool parse(char const* beginDoc, char const* endDoc, Value* root,
String* errs) = 0; String* errs) = 0;
virtual std::vector<StructuredError> getStructuredErrors() const = 0; virtual std::vector<StructuredError> getStructuredErrors() const = 0;
}; };
explicit CharReader(std::unique_ptr<Impl> impl) : _impl(std::move(impl)) { } explicit CharReader(std::unique_ptr<Impl> impl) : _impl(std::move(impl)) {}
private: private:
std::unique_ptr<Impl> _impl; std::unique_ptr<Impl> _impl;
}; // CharReader }; // CharReader
/** \brief Build a CharReader implementation. /** \brief Build a CharReader implementation.
* *

View File

@ -1831,7 +1831,8 @@ String OurReader::getFormattedErrorMessages() const {
return formattedMessage; return formattedMessage;
} }
std::vector<CharReader::StructuredError> OurReader::getStructuredErrors() const { std::vector<CharReader::StructuredError>
OurReader::getStructuredErrors() const {
std::vector<CharReader::StructuredError> allErrors; std::vector<CharReader::StructuredError> allErrors;
for (const auto& error : errors_) { for (const auto& error : errors_) {
CharReader::StructuredError structured; CharReader::StructuredError structured;
@ -1847,7 +1848,8 @@ class OurCharReader : public CharReader {
public: public:
OurCharReader(bool collectComments, OurFeatures const& features) OurCharReader(bool collectComments, OurFeatures const& features)
: CharReader(std::unique_ptr<OurImpl>(new OurImpl(collectComments, features))) {} : CharReader(
std::unique_ptr<OurImpl>(new OurImpl(collectComments, features))) {}
protected: protected:
class OurImpl : public Impl { class OurImpl : public Impl {
@ -1864,7 +1866,8 @@ protected:
return ok; return ok;
} }
std::vector<CharReader::StructuredError> getStructuredErrors() const override { std::vector<CharReader::StructuredError>
getStructuredErrors() const override {
return reader_.getStructuredErrors(); return reader_.getStructuredErrors();
} }
@ -1961,13 +1964,14 @@ void CharReaderBuilder::setDefaults(Json::Value* settings) {
//! [CharReaderBuilderDefaults] //! [CharReaderBuilderDefaults]
} }
std::vector<CharReader::StructuredError> CharReader::getStructuredErrors() const { std::vector<CharReader::StructuredError>
return _impl->getStructuredErrors(); CharReader::getStructuredErrors() const {
return _impl->getStructuredErrors();
} }
bool CharReader::parse(char const* beginDoc, char const* endDoc, Value* root, bool CharReader::parse(char const* beginDoc, char const* endDoc, Value* root,
String* errs) { String* errs) {
return _impl->parse(beginDoc, endDoc, root, errs); return _impl->parse(beginDoc, endDoc, root, errs);
} }
////////////////////////////////// //////////////////////////////////

View File

@ -3918,8 +3918,9 @@ JSONTEST_FIXTURE_LOCAL(FuzzTest, fuzzDoesntCrash) {
} }
struct ParseWithStructuredErrorsTest : JsonTest::TestCase { struct ParseWithStructuredErrorsTest : JsonTest::TestCase {
void testErrors(const std::string& doc, bool success, void testErrors(
const std::vector<Json::CharReader::StructuredError>& expectedErrors) { const std::string& doc, bool success,
const std::vector<Json::CharReader::StructuredError>& expectedErrors) {
Json::CharReaderBuilder b; Json::CharReaderBuilder b;
CharReaderPtr reader(b.newCharReader()); CharReaderPtr reader(b.newCharReader());
Json::Value root; Json::Value root;