Commit 2468631d authored by Niels's avatar Niels
Browse files

overworked examples

parent 707732a5
......@@ -21,7 +21,7 @@ There are myriads of [JSON](http://json.org) libraries out there, and each may e
Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) with a decent regular expression processor should be even faster (but would consist of more files which makes the integration harder).
......
......@@ -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 = .
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/WSW3gHHE4UcZ9K3G"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/vsDHoEGWuGiwM0oh"><b>online</b></a>
\ No newline at end of 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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/pX9pR42isGha24Up"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/NTSNuQecVsmv3guC"><b>online</b></a>
\ No newline at end of file
......@@ -3,5 +3,6 @@ false
false
false
false
false
true
false
......@@ -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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/yBDoHvFIsRqoo7Ca"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/3ZOet3bImwKg2vMb"><b>online</b></a>
\ No newline at end of file
......@@ -5,3 +5,4 @@ false
false
false
false
false
......@@ -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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/Fz9sE7wOVCDCxuqw"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/a0c6rKo8VbeOBAmD"><b>online</b></a>
\ No newline at end of file
......@@ -5,3 +5,4 @@ false
false
false
false
false
......@@ -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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/CwckRKEAALOpqiq7"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/z9pBPy4eSYMCZgEr"><b>online</b></a>
\ No newline at end of file
......@@ -5,3 +5,4 @@ false
false
false
false
false
......@@ -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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/xVKMzHSvo4XHFyxV"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/1rel3xdea4ADiKds"><b>online</b></a>
\ No newline at end of file
......@@ -2,6 +2,7 @@ false
false
true
true
true
false
false
false
......@@ -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';
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/SbPvCBbOwWkIH5RX"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/vEZZNyL8GPbAfAsJ"><b>online</b></a>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment