♻️ rename internal_binary_t with binary_t
This commit is contained in:
parent
dead99eb0e
commit
904642f261
59 changed files with 536 additions and 457 deletions
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
|
|
30
doc/examples/is_binary.cpp
Normal file
30
doc/examples/is_binary.cpp
Normal 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';
|
||||
}
|
1
doc/examples/is_binary.link
Normal file
1
doc/examples/is_binary.link
Normal file
|
@ -0,0 +1 @@
|
|||
<a target="_blank" href="https://wandbox.org/permlink/xR6eTQqSySLjtpn6"><b>online</b></a>
|
9
doc/examples/is_binary.output
Normal file
9
doc/examples/is_binary.output
Normal file
|
@ -0,0 +1,9 @@
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ true
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ true
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ true
|
|||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -6,3 +6,4 @@ false
|
|||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
|
@ -22,12 +22,14 @@ These pages contain the API documentation of JSON for Modern C++, a C++11 header
|
|||
@link nlohmann::basic_json::is_object is_object @endlink,
|
||||
@link nlohmann::basic_json::is_array is_array @endlink,
|
||||
@link nlohmann::basic_json::is_string is_string @endlink,
|
||||
@link nlohmann::basic_json::is_discarded is_discarded @endlink -- check for value type
|
||||
@link nlohmann::basic_json::is_discarded is_discarded @endlink,
|
||||
@link nlohmann::basic_json::is_binary is_binary @endlink -- check for value type
|
||||
- @link nlohmann::basic_json::operator value_t() const operator value_t @endlink -- type of the value (implicit conversion)
|
||||
- value access
|
||||
- @link nlohmann::basic_json::get get @endlink -- get a value
|
||||
- @link nlohmann::basic_json::get_ptr get_ptr @endlink -- get a value pointer
|
||||
- @link nlohmann::basic_json::get_ref get_ref @endlink -- get a value reference
|
||||
- @link nlohmann::basic_json::get_binary get_binary @endlink -- get a binary value
|
||||
- @link nlohmann::basic_json::operator ValueType() const operator ValueType @endlink -- get a value (implicit conversion)
|
||||
- @link nlohmann::basic_json::value value @endlink -- get a value from an object and return default value if key is not present
|
||||
- exceptions
|
||||
|
@ -67,8 +69,9 @@ These pages contain the API documentation of JSON for Modern C++, a C++11 header
|
|||
- @link nlohmann::basic_json::number_integer_t signed integers @endlink
|
||||
- @link nlohmann::basic_json::number_unsigned_t unsigned integers @endlink
|
||||
- @link nlohmann::basic_json::number_float_t floating-point @endlink
|
||||
- @link nlohmann::basic_json::binary_t binary values @endlink
|
||||
- further JSON standards
|
||||
- @link nlohmann::json_pointer JSON Pointer @endlink (REF 6901)
|
||||
- @link nlohmann::json_pointer JSON Pointer @endlink (RFC 6901)
|
||||
- @link nlohmann::basic_json::patch JSON Patch @endlink (RFC 6902)
|
||||
- @link nlohmann::basic_json::merge_patch JSON Merge Patch @endlink (RFC 7396)
|
||||
|
||||
|
@ -324,7 +327,7 @@ Note that this table only lists those exceptions thrown due to the type. For ins
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
@copyright Copyright © 2013-2019 Niels Lohmann. The code is licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
@copyright Copyright © 2013-2020 Niels Lohmann. The code is licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
@author [Niels Lohmann](http://nlohmann.me)
|
||||
@see https://github.com/nlohmann/json to download the source code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue