use abstract sax class in parser tests
This commit is contained in:
parent
9bbb133094
commit
38f8a51a8f
3 changed files with 15 additions and 13 deletions
|
@ -212,6 +212,7 @@ class basic_json
|
||||||
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
||||||
|
|
||||||
using input_format_t = detail::input_format_t;
|
using input_format_t = detail::input_format_t;
|
||||||
|
using json_sax_t = json_sax<basic_json>;
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// exceptions //
|
// exceptions //
|
||||||
|
|
|
@ -11078,6 +11078,7 @@ class basic_json
|
||||||
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
||||||
|
|
||||||
using input_format_t = detail::input_format_t;
|
using input_format_t = detail::input_format_t;
|
||||||
|
using json_sax_t = json_sax<basic_json>;
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// exceptions //
|
// exceptions //
|
||||||
|
|
|
@ -129,68 +129,68 @@ class SaxEventLogger
|
||||||
bool errored = false;
|
bool errored = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SaxCountdown
|
class SaxCountdown : public nlohmann::json::json_sax_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SaxCountdown(const int count) : events_left(count)
|
explicit SaxCountdown(const int count) : events_left(count)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool null()
|
bool null() override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool boolean(bool)
|
bool boolean(bool) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_integer(json::number_integer_t)
|
bool number_integer(json::number_integer_t) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_unsigned(json::number_unsigned_t)
|
bool number_unsigned(json::number_unsigned_t) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_float(json::number_float_t, const std::string&)
|
bool number_float(json::number_float_t, const std::string&) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string(std::string&)
|
bool string(std::string&) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool start_object(std::size_t)
|
bool start_object(std::size_t) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool key(std::string&)
|
bool key(std::string&) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end_object()
|
bool end_object() override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool start_array(std::size_t)
|
bool start_array(std::size_t) override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end_array()
|
bool end_array() override
|
||||||
{
|
{
|
||||||
return events_left-- > 0;
|
return events_left-- > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse_error(std::size_t, const std::string&, const json::exception&)
|
bool parse_error(std::size_t, const std::string&, const json::exception&) override
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue