Skip to content

Commit 776880b

Browse files
committed
Merge branch 'feature/iterator_range_parsing' into develop
2 parents 442058f + 740b66f commit 776880b

18 files changed

+1074
-497
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,10 @@ There are currently two files which need to be edited:
4141

4242
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.
4343

44-
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled with
44+
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
4545

4646
```sh
47-
make
48-
```
49-
50-
and can be executed with
51-
52-
```sh
53-
./json_unit
47+
make check
5448
```
5549

5650
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ I deeply appreciate the help of the following people.
492492
- [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
493493
- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
494494
- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
495+
- [Thomas Braun](https://github.com/t-b) fixed a warning in a test case.
496+
- [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).
495497
496498
Thanks a lot for helping out!
497499
@@ -510,7 +512,7 @@ To compile and run the tests, you need to execute
510512
$ make check
511513
512514
===============================================================================
513-
All tests passed (8905099 assertions in 32 test cases)
515+
All tests passed (8905154 assertions in 35 test cases)
514516
```
515517

516518
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <json.hpp>
2+
3+
using json = nlohmann::json;
4+
5+
int main()
6+
{
7+
// a JSON text
8+
char text[] = R"(
9+
{
10+
"Image": {
11+
"Width": 800,
12+
"Height": 600,
13+
"Title": "View from 15th Floor",
14+
"Thumbnail": {
15+
"Url": "http://www.example.com/image/481989943",
16+
"Height": 125,
17+
"Width": 100
18+
},
19+
"Animated" : false,
20+
"IDs": [116, 943, 234, 38793]
21+
}
22+
}
23+
)";
24+
25+
// parse and serialize JSON
26+
json j_complete = json::parse(text);
27+
std::cout << std::setw(4) << j_complete << "\n\n";
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a target="_blank" href="http://melpon.org/wandbox/permlink/CwZnqGqte14SYJ5s"><b>online</b></a>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"Image": {
3+
"Animated": false,
4+
"Height": 600,
5+
"IDs": [
6+
116,
7+
943,
8+
234,
9+
38793
10+
],
11+
"Thumbnail": {
12+
"Height": 125,
13+
"Url": "http://www.example.com/image/481989943",
14+
"Width": 100
15+
},
16+
"Title": "View from 15th Floor",
17+
"Width": 800
18+
}
19+
}
20+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <json.hpp>
2+
3+
using json = nlohmann::json;
4+
5+
int main()
6+
{
7+
// a JSON text given as std::vector
8+
std::vector<uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'};
9+
10+
// parse and serialize JSON
11+
json j_complete = json::parse(text);
12+
std::cout << std::setw(4) << j_complete << "\n\n";
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a target="_blank" href="http://melpon.org/wandbox/permlink/F8VaVFyys87qQRt5"><b>online</b></a>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
1,
3+
2,
4+
3
5+
]
6+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <json.hpp>
2+
3+
using json = nlohmann::json;
4+
5+
int main()
6+
{
7+
// a JSON text given as std::vector
8+
std::vector<uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'};
9+
10+
// parse and serialize JSON
11+
json j_complete = json::parse(text.begin(), text.end());
12+
std::cout << std::setw(4) << j_complete << "\n\n";
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a target="_blank" href="http://melpon.org/wandbox/permlink/ojh4Eeol4G9RgeRV"><b>online</b></a>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
1,
3+
2,
4+
3
5+
]
6+

doc/examples/parse__string__parser_callback_t.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using json = nlohmann::json;
55
int main()
66
{
77
// a JSON text
8-
std::string text = R"(
8+
auto text = R"(
99
{
1010
"Image": {
1111
"Width": 800,
@@ -44,4 +44,4 @@ int main()
4444
// parse (with callback) and serialize JSON
4545
json j_filtered = json::parse(text, cb);
4646
std::cout << std::setw(4) << j_filtered << '\n';
47-
}
47+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a target="_blank" href="http://melpon.org/wandbox/permlink/SrKpkE9ivmvd2OUy"><b>online</b></a>
1+
<a target="_blank" href="http://melpon.org/wandbox/permlink/n888UNQlMFduURhE"><b>online</b></a>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy