Skip to content

Commit 1249d33

Browse files
committed
updating for c++17, going to be simplifying the API a bit soon
1 parent 83f7c30 commit 1249d33

File tree

6 files changed

+103
-95
lines changed

6 files changed

+103
-95
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
cmake_minimum_required (VERSION 3.0)
1+
cmake_minimum_required (VERSION 3.15)
22
project(cpp-json CXX)
33

4+
enable_testing()
5+
46
add_subdirectory(lib)
57
add_subdirectory(test)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cpp-json
2-
Copyright (C) 2014-2015 Evan Teran
2+
Copyright (C) 2014-2023 Evan Teran
33
evan.teran@gmail.com
44

55
This program is free software; you can redistribute it and/or modify

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
**cpp-json is licensed under the GNU General Public License, version 2 or later.**
22

3+
**NOTE:** version [4.1](https://github.com/eteran/cpp-json/releases/tag/4.1) will be the last to not require C++17.
4+
35
**NOTE:** version [2.2](https://github.com/eteran/cpp-json/releases/tag/2.2) will be the last to not require C++11.
46

57
There are a few different JSON parsing libraries out there. But cpp-json aims to be the simplest to use while still being efficient by using modern c++ techniques. Additionally, this library is header only making it trivial to include in existing projects.
@@ -37,12 +39,12 @@ int main() {
3739
// ... though in real code you may want to check the type first ;-)
3840
auto servlets = json["web-app"]["servlet"];
3941

40-
// when dealing with arrays, you can just use iterators,
42+
// when dealing with arrays, you can just use iterators,
4143
// or feel free to use C++11 ranged-for
4244
const json::array &a = as_array(servlets);
4345
for(auto it = a.begin(); it != a.end(); ++it) {
4446
const json::value &v = *it;
45-
// all basic types (numbers, strings, booleans) can be converted
47+
// all basic types (numbers, strings, booleans) can be converted
4648
// to a string
4749
std::cout << to_string(v["servlet-name"]) << std::endl;
4850
}
@@ -64,7 +66,7 @@ int main(int argc, char *argv[]) {
6466
{ "world", 5678 }
6567
}
6668
};
67-
69+
6870
std::cout << stringify(arr) << std::endl;
6971
}
7072
```
@@ -77,7 +79,7 @@ Which of course results in a object representing the following JSON:
7779
2,
7880
3,
7981
4,
80-
"Testing 1 2 3",
82+
"Testing 1 2 3",
8183
{
8284
"hello" : 1234,
8385
"world" : 5678

lib/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 3.15)
22

33
add_library(cpp-json INTERFACE
44
)
@@ -10,4 +10,3 @@ target_include_directories(cpp-json
1010
target_sources(cpp-json INTERFACE
1111
${CMAKE_CURRENT_SOURCE_DIR}/include/cpp-json/json.h
1212
)
13-

0 commit comments

Comments
 (0)