Skip to content

Commit

Permalink
Merge branch 'feature/iterator_range_parsing' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Aug 31, 2016
2 parents 442058f + 740b66f commit 776880b
Show file tree
Hide file tree
Showing 18 changed files with 1,074 additions and 497 deletions.
10 changes: 2 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,10 @@ There are currently two files which need to be edited:

2. [`test/src/unit.cpp`](https://github.com/nlohmann/json/blob/master/test/unit.cpp) - This contains the [Catch](https://github.com/philsquared/Catch) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.

If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled with
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with

```sh
make
```

and can be executed with

```sh
./json_unit
make check
```

The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ I deeply appreciate the help of the following people.
- [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
- [Thomas Braun](https://github.com/t-b) fixed a warning in a test case.
- [Théo DELRIEU](https://github.com/theodelrieu) patiently and constructively oversaw the long way toward [iterator-range parsing](https://github.com/nlohmann/json/issues/290).

Thanks a lot for helping out!

Expand All @@ -510,7 +512,7 @@ To compile and run the tests, you need to execute
$ make check

===============================================================================
All tests passed (8905099 assertions in 32 test cases)
All tests passed (8905154 assertions in 35 test cases)
```

For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
28 changes: 28 additions & 0 deletions doc/examples/parse__array__parser_callback_t.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <json.hpp>

using json = nlohmann::json;

int main()
{
// a JSON text
char 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]
}
}
)";

// parse and serialize JSON
json j_complete = json::parse(text);
std::cout << std::setw(4) << j_complete << "\n\n";
}
1 change: 1 addition & 0 deletions doc/examples/parse__array__parser_callback_t.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CwZnqGqte14SYJ5s"><b>online</b></a>
20 changes: 20 additions & 0 deletions doc/examples/parse__array__parser_callback_t.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"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
}
}

13 changes: 13 additions & 0 deletions doc/examples/parse__contiguouscontainer__parser_callback_t.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <json.hpp>

using json = nlohmann::json;

int main()
{
// a JSON text given as std::vector
std::vector<uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'};

// parse and serialize JSON
json j_complete = json::parse(text);
std::cout << std::setw(4) << j_complete << "\n\n";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/F8VaVFyys87qQRt5"><b>online</b></a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
1,
2,
3
]

13 changes: 13 additions & 0 deletions doc/examples/parse__iteratortype__parser_callback_t.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <json.hpp>

using json = nlohmann::json;

int main()
{
// a JSON text given as std::vector
std::vector<uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'};

// parse and serialize JSON
json j_complete = json::parse(text.begin(), text.end());
std::cout << std::setw(4) << j_complete << "\n\n";
}
1 change: 1 addition & 0 deletions doc/examples/parse__iteratortype__parser_callback_t.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/ojh4Eeol4G9RgeRV"><b>online</b></a>
6 changes: 6 additions & 0 deletions doc/examples/parse__iteratortype__parser_callback_t.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
1,
2,
3
]

4 changes: 2 additions & 2 deletions doc/examples/parse__string__parser_callback_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using json = nlohmann::json;
int main()
{
// a JSON text
std::string text = R"(
auto text = R"(
{
"Image": {
"Width": 800,
Expand Down Expand Up @@ -44,4 +44,4 @@ int main()
// parse (with callback) and serialize JSON
json j_filtered = json::parse(text, cb);
std::cout << std::setw(4) << j_filtered << '\n';
}
}
2 changes: 1 addition & 1 deletion doc/examples/parse__string__parser_callback_t.link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/SrKpkE9ivmvd2OUy"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/n888UNQlMFduURhE"><b>online</b></a>
Loading

0 comments on commit 776880b

Please sign in to comment.