mirror of
https://github.com/nlohmann/json.git
synced 2025-07-29 23:01:16 +03:00
🔨 changed SAX interface
This commit is contained in:
@ -64,7 +64,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool string(std::string&&) override
|
||||
bool string(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool key(std::string&&) override
|
||||
bool key(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class SaxEventLogger : public nlohmann::json::json_sax_t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool string(std::string&& val) override
|
||||
bool string(std::string& val) override
|
||||
{
|
||||
events.push_back("string(" + val + ")");
|
||||
return true;
|
||||
@ -86,7 +86,7 @@ class SaxEventLogger : public nlohmann::json::json_sax_t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool key(std::string&& val) override
|
||||
bool key(std::string& val) override
|
||||
{
|
||||
events.push_back("key(" + val + ")");
|
||||
return true;
|
||||
@ -159,7 +159,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool string(std::string&&) override
|
||||
bool string(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
@ -169,7 +169,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool key(std::string&&) override
|
||||
bool key(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ struct SaxEventLogger : public nlohmann::json::json_sax_t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool string(std::string&& val) override
|
||||
bool string(std::string& val) override
|
||||
{
|
||||
events.push_back("string(" + val + ")");
|
||||
return true;
|
||||
@ -85,7 +85,7 @@ struct SaxEventLogger : public nlohmann::json::json_sax_t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool key(std::string&& val) override
|
||||
bool key(std::string& val) override
|
||||
{
|
||||
events.push_back("key(" + val + ")");
|
||||
return true;
|
||||
@ -143,7 +143,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
|
||||
|
||||
struct SaxEventLoggerExitAfterKey : public SaxEventLogger
|
||||
{
|
||||
bool key(std::string&& val) override
|
||||
bool key(std::string& val) override
|
||||
{
|
||||
events.push_back("key(" + val + ")");
|
||||
return false;
|
||||
|
@ -64,7 +64,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool string(std::string&&) override
|
||||
bool string(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool key(std::string&&) override
|
||||
bool key(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool string(std::string&&) override
|
||||
bool string(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class SaxCountdown : public nlohmann::json::json_sax_t
|
||||
return events_left-- > 0;
|
||||
}
|
||||
|
||||
bool key(std::string&&) override
|
||||
bool key(std::string&) override
|
||||
{
|
||||
return events_left-- > 0;
|
||||
}
|
||||
@ -1668,12 +1668,12 @@ TEST_CASE("UBJSON")
|
||||
std::vector<uint8_t> vST1 = {'{', '$', 'd', '#', 'i', 2, 'i', 1, 'a'};
|
||||
CHECK_THROWS_AS(json::from_ubjson(vST1), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_ubjson(vST1), "[json.exception.parse_error.110] parse error at 10: unexpected end of input");
|
||||
CHECK(json::from_ubjson(vST1, true, false).is_discarded());
|
||||
CHECK(json::from_ubjson(vST1, true, false).is_discarded());
|
||||
|
||||
std::vector<uint8_t> vST2 = {'{', '#', 'i', 2, 'i', 1, 'a'};
|
||||
CHECK_THROWS_AS(json::from_ubjson(vST2), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_ubjson(vST2), "[json.exception.parse_error.110] parse error at 8: unexpected end of input");
|
||||
CHECK(json::from_ubjson(vST2, true, false).is_discarded());
|
||||
CHECK(json::from_ubjson(vST2, true, false).is_discarded());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user