overworked examples

This commit is contained in:
Niels 2016-01-26 20:07:03 +01:00
parent 707732a53e
commit 2468631dc9
41 changed files with 91 additions and 16 deletions

View file

@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "JSON for Modern C++"
PROJECT_NUMBER = 1.1.0
PROJECT_NUMBER = 2.0.0
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = .

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/WSW3gHHE4UcZ9K3G"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/vsDHoEGWuGiwM0oh"><b>online</b></a>

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_array() << '\n';
std::cout << j_boolean.is_array() << '\n';
std::cout << j_number_integer.is_array() << '\n';
std::cout << j_number_unsigned_integer.is_array() << '\n';
std::cout << j_number_float.is_array() << '\n';
std::cout << j_object.is_array() << '\n';
std::cout << j_array.is_array() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/pX9pR42isGha24Up"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/NTSNuQecVsmv3guC"><b>online</b></a>

View file

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

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_boolean() << '\n';
std::cout << j_boolean.is_boolean() << '\n';
std::cout << j_number_integer.is_boolean() << '\n';
std::cout << j_number_unsigned_integer.is_boolean() << '\n';
std::cout << j_number_float.is_boolean() << '\n';
std::cout << j_object.is_boolean() << '\n';
std::cout << j_array.is_boolean() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/yBDoHvFIsRqoo7Ca"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/3ZOet3bImwKg2vMb"><b>online</b></a>

View file

@ -5,3 +5,4 @@ false
false
false
false
false

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_discarded() << '\n';
std::cout << j_boolean.is_discarded() << '\n';
std::cout << j_number_integer.is_discarded() << '\n';
std::cout << j_number_unsigned_integer.is_discarded() << '\n';
std::cout << j_number_float.is_discarded() << '\n';
std::cout << j_object.is_discarded() << '\n';
std::cout << j_array.is_discarded() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/Fz9sE7wOVCDCxuqw"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/a0c6rKo8VbeOBAmD"><b>online</b></a>

View file

@ -5,3 +5,4 @@ false
false
false
false
false

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_null() << '\n';
std::cout << j_boolean.is_null() << '\n';
std::cout << j_number_integer.is_null() << '\n';
std::cout << j_number_unsigned_integer.is_null() << '\n';
std::cout << j_number_float.is_null() << '\n';
std::cout << j_object.is_null() << '\n';
std::cout << j_array.is_null() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CwckRKEAALOpqiq7"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/z9pBPy4eSYMCZgEr"><b>online</b></a>

View file

@ -5,3 +5,4 @@ false
false
false
false
false

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number() << '\n';
std::cout << j_boolean.is_number() << '\n';
std::cout << j_number_integer.is_number() << '\n';
std::cout << j_number_unsigned_integer.is_number() << '\n';
std::cout << j_number_float.is_number() << '\n';
std::cout << j_object.is_number() << '\n';
std::cout << j_array.is_number() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/xVKMzHSvo4XHFyxV"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/1rel3xdea4ADiKds"><b>online</b></a>

View file

@ -2,6 +2,7 @@ false
false
true
true
true
false
false
false

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number_float() << '\n';
std::cout << j_boolean.is_number_float() << '\n';
std::cout << j_number_integer.is_number_float() << '\n';
std::cout << j_number_unsigned_integer.is_number_float() << '\n';
std::cout << j_number_float.is_number_float() << '\n';
std::cout << j_object.is_number_float() << '\n';
std::cout << j_array.is_number_float() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/SbPvCBbOwWkIH5RX"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/vEZZNyL8GPbAfAsJ"><b>online</b></a>

View file

@ -1,6 +1,7 @@
false
false
false
false
true
false
false

View file

@ -8,6 +8,7 @@ int main()
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};
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number_integer() << '\n';
std::cout << j_boolean.is_number_integer() << '\n';
std::cout << j_number_integer.is_number_integer() << '\n';
std::cout << j_number_unsigned_integer.is_number_integer() << '\n';
std::cout << j_number_float.is_number_integer() << '\n';
std::cout << j_object.is_number_integer() << '\n';
std::cout << j_array.is_number_integer() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CVMYqyeIFOKcBZZU"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/bulo75cZB0cPINgL"><b>online</b></a>

View file

@ -1,6 +1,7 @@
false
false
true
true
false
false
false

View file

@ -0,0 +1,27 @@
#include <json.hpp>
using namespace nlohmann;
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";
// call is_number_unsigned()
std::cout << std::boolalpha;
std::cout << j_null.is_number_unsigned() << '\n';
std::cout << j_boolean.is_number_unsigned() << '\n';
std::cout << j_number_integer.is_number_unsigned() << '\n';
std::cout << j_number_unsigned_integer.is_number_unsigned() << '\n';
std::cout << j_number_float.is_number_unsigned() << '\n';
std::cout << j_object.is_number_unsigned() << '\n';
std::cout << j_array.is_number_unsigned() << '\n';
std::cout << j_string.is_number_unsigned() << '\n';
}

View file

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

View file

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

View file

@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_object() << '\n';
std::cout << j_boolean.is_object() << '\n';
std::cout << j_number_integer.is_object() << '\n';
std::cout << j_number_unsigned_integer.is_object() << '\n';
std::cout << j_number_float.is_object() << '\n';
std::cout << j_object.is_object() << '\n';
std::cout << j_array.is_object() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/uXT6peoqwN6DIFAr"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/40lrBaplftujclBr"><b>online</b></a>

View file

@ -2,6 +2,7 @@ false
false
false
false
false
true
false
false

View file

@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_primitive() << '\n';
std::cout << j_boolean.is_primitive() << '\n';
std::cout << j_number_integer.is_primitive() << '\n';
std::cout << j_number_unsigned_integer.is_primitive() << '\n';
std::cout << j_number_float.is_primitive() << '\n';
std::cout << j_object.is_primitive() << '\n';
std::cout << j_array.is_primitive() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/f5AMxY70IoQ4o0wb"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/zZYJHMvzYyYkNoAU"><b>online</b></a>

View file

@ -2,6 +2,7 @@ true
true
true
true
true
false
false
true

View file

@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_string() << '\n';
std::cout << j_boolean.is_string() << '\n';
std::cout << j_number_integer.is_string() << '\n';
std::cout << j_number_unsigned_integer.is_string() << '\n';
std::cout << j_number_float.is_string() << '\n';
std::cout << j_object.is_string() << '\n';
std::cout << j_array.is_string() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/ILh5L9NsOSQ29Cg4"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/1x7B5XrHtV8RTROC"><b>online</b></a>

View file

@ -4,4 +4,5 @@ false
false
false
false
false
true

View file

@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_structured() << '\n';
std::cout << j_boolean.is_structured() << '\n';
std::cout << j_number_integer.is_structured() << '\n';
std::cout << j_number_unsigned_integer.is_structured() << '\n';
std::cout << j_number_float.is_structured() << '\n';
std::cout << j_object.is_structured() << '\n';
std::cout << j_array.is_structured() << '\n';

View file

@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/D9WgQUo2eieU7kqs"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/kXpxIk6MP6OxEvwu"><b>online</b></a>

View file

@ -2,6 +2,7 @@ false
false
false
false
false
true
true
false