♻️ rename internal_binary_t with binary_t

This commit is contained in:
Niels Lohmann 2020-05-17 22:50:27 +02:00
parent dead99eb0e
commit 904642f261
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
59 changed files with 536 additions and 457 deletions

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_array()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_array() << '\n';
std::cout << j_array.is_array() << '\n';
std::cout << j_string.is_array() << '\n';
std::cout << j_binary.is_array() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/EXdpfHah1530TPIE"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/qO60NqUznleA1S7v"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
true
false
false

View file

@ -0,0 +1,30 @@
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_binary()
std::cout << std::boolalpha;
std::cout << j_null.is_binary() << '\n';
std::cout << j_boolean.is_binary() << '\n';
std::cout << j_number_integer.is_binary() << '\n';
std::cout << j_number_unsigned_integer.is_binary() << '\n';
std::cout << j_number_float.is_binary() << '\n';
std::cout << j_object.is_binary() << '\n';
std::cout << j_array.is_binary() << '\n';
std::cout << j_string.is_binary() << '\n';
std::cout << j_binary.is_binary() << '\n';
}

View file

@ -0,0 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/xR6eTQqSySLjtpn6"><b>online</b></a>

View file

@ -0,0 +1,9 @@
false
false
false
false
false
false
false
false
true

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_boolean()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_boolean() << '\n';
std::cout << j_array.is_boolean() << '\n';
std::cout << j_string.is_boolean() << '\n';
std::cout << j_binary.is_boolean() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/7sniyNPobbQQdBHJ"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/QVbXnPfNZdvuDHwy"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_discarded()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_discarded() << '\n';
std::cout << j_array.is_discarded() << '\n';
std::cout << j_string.is_discarded() << '\n';
std::cout << j_binary.is_discarded() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/hWqzRJtSjY0cSoQV"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/jg033y5pdOFOst14"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_null()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_null() << '\n';
std::cout << j_array.is_null() << '\n';
std::cout << j_string.is_null() << '\n';
std::cout << j_binary.is_null() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/r0Z6mhqY20XowAPj"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/uDLxYO1TseoNS5Iu"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_number()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_number() << '\n';
std::cout << j_array.is_number() << '\n';
std::cout << j_string.is_number() << '\n';
std::cout << j_binary.is_number() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/e0RMOkVT4QrwhPV9"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/a7j4EG9Hvjbby3x0"><b>online</b></a>

View file

@ -6,3 +6,4 @@ true
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_number_float()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_number_float() << '\n';
std::cout << j_array.is_number_float() << '\n';
std::cout << j_string.is_number_float() << '\n';
std::cout << j_binary.is_number_float() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/Thh18DVuOoaiYidD"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/cT9J60hwwflg88M9"><b>online</b></a>

View file

@ -6,3 +6,4 @@ true
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_number_integer()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_number_integer() << '\n';
std::cout << j_array.is_number_integer() << '\n';
std::cout << j_string.is_number_integer() << '\n';
std::cout << j_binary.is_number_integer() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/wFZSC6RswWXwSncb"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/j0TgXy0oyXxKkhLN"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_number_unsigned()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_number_unsigned() << '\n';
std::cout << j_array.is_number_unsigned() << '\n';
std::cout << j_string.is_number_unsigned() << '\n';
std::cout << j_binary.is_number_unsigned() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/ajo1F1VJwoszcD7Y"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/u5wlpVX9Za6lEC2f"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_object()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_object() << '\n';
std::cout << j_array.is_object() << '\n';
std::cout << j_string.is_object() << '\n';
std::cout << j_binary.is_object() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/ojKk5AMVK9xF9bmQ"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/QJQ2avqtJEd4uI23"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
true
false
false
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_primitive()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_primitive() << '\n';
std::cout << j_array.is_primitive() << '\n';
std::cout << j_string.is_primitive() << '\n';
std::cout << j_binary.is_primitive() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/B7F0eMkW0EKdZGcC"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/a4WQ1RXZbD1YQELx"><b>online</b></a>

View file

@ -6,3 +6,4 @@ true
false
false
true
true

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_string()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_string() << '\n';
std::cout << j_array.is_string() << '\n';
std::cout << j_string.is_string() << '\n';
std::cout << j_binary.is_string() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/2Iq9wtaxEvrb5B68"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/vj3Wo1roaNjE3fPo"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
false
false
true
false

View file

@ -14,6 +14,7 @@ int main()
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
json j_binary = json::binary_array({1, 2, 3});
// call is_structured()
std::cout << std::boolalpha;
@ -25,4 +26,5 @@ int main()
std::cout << j_object.is_structured() << '\n';
std::cout << j_array.is_structured() << '\n';
std::cout << j_string.is_structured() << '\n';
std::cout << j_binary.is_structured() << '\n';
}

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/44jkAs0G7D0XB24j"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/BoS03RLCyI6oDMbc"><b>online</b></a>

View file

@ -6,3 +6,4 @@ false
true
true
false
false

View file

@ -79,7 +79,7 @@ class sax_event_consumer : public json::json_sax_t
return true;
}
bool binary(binary_t& val) override
bool binary(json::binary_t& val) override
{
events.push_back("binary");
return true;

View file

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/AoOilNQQoDbzgBYz"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/SbFNpOHK4By29meM"><b>online</b></a>