🔥 removed deprecated constructor #480
The constructor basic_json(std::istream&, const parser_callback_t) has been deprecated since version 2.0.0. This commit removes it together with its code example, deprecation macro, and test cases. The code now also compiles with -W-deprecated-declarations.
This commit is contained in:
parent
6b3912d936
commit
7b8fd864e2
7 changed files with 0 additions and 218 deletions
|
@ -1,57 +0,0 @@
|
|||
#include <json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
int main()
|
||||
{
|
||||
// a JSON text
|
||||
auto text = R"(
|
||||
{
|
||||
"Image": {
|
||||
"Width": 800,
|
||||
"Height": 600,
|
||||
"Title": "View from 15th Floor",
|
||||
"Thumbnail": {
|
||||
"Url": "http://www.example.com/image/481989943",
|
||||
"Height": 125,
|
||||
"Width": 100
|
||||
},
|
||||
"Animated" : false,
|
||||
"IDs": [116, 943, 234, 38793]
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
// fill a stream with JSON text
|
||||
std::stringstream ss;
|
||||
ss << text;
|
||||
|
||||
// create JSON from stream
|
||||
json j_complete(ss); // deprecated!
|
||||
// shall be replaced by: json j_complete = json::parse(ss);
|
||||
std::cout << std::setw(4) << j_complete << "\n\n";
|
||||
|
||||
|
||||
// define parser callback
|
||||
json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
|
||||
{
|
||||
// skip object elements with key "Thumbnail"
|
||||
if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// fill a stream with JSON text
|
||||
ss.clear();
|
||||
ss << text;
|
||||
|
||||
// create JSON from stream (with callback)
|
||||
json j_filtered(ss, cb);
|
||||
// shall be replaced by: json j_filtered = json::parse(ss, cb);
|
||||
std::cout << std::setw(4) << j_filtered << '\n';
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<a target="_blank" href="http://melpon.org/wandbox/permlink/R6dzpKXlxrttShf7"><b>online</b></a>
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"Image": {
|
||||
"Animated": false,
|
||||
"Height": 600,
|
||||
"IDs": [
|
||||
116,
|
||||
943,
|
||||
234,
|
||||
38793
|
||||
],
|
||||
"Thumbnail": {
|
||||
"Height": 125,
|
||||
"Url": "http://www.example.com/image/481989943",
|
||||
"Width": 100
|
||||
},
|
||||
"Title": "View from 15th Floor",
|
||||
"Width": 800
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"Image": {
|
||||
"Animated": false,
|
||||
"Height": 600,
|
||||
"IDs": [
|
||||
116,
|
||||
943,
|
||||
234,
|
||||
38793
|
||||
],
|
||||
"Title": "View from 15th Floor",
|
||||
"Width": 800
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue