mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
reorganized repo
This commit is contained in:
@ -1,41 +0,0 @@
|
||||
```cpp
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
const_iterator cbegin() const;
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
Returns an iterator to the first value in the JSON container. If the JSON container is empty, the returned iterator will be equal to [`end()`](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::end).
|
||||
|
||||

|
||||
|
||||
## Parameters
|
||||
|
||||
None.
|
||||
|
||||
## Return value
|
||||
|
||||
Iterator to the first value. Note the return value its deferencabilty depends on the different value types:
|
||||
|
||||
| value type | deferenceable | description |
|
||||
| ---------- | ------------- | ----------- |
|
||||
| null | no | `null` has no value, always equal to [`end()`](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::end) |
|
||||
| boolean | yes | iterator to the boolean value |
|
||||
| string | yes | iterator to the string value |
|
||||
| number | yes | iterator to the number value |
|
||||
| object | only if object is not empty | iterator to the begin of the object |
|
||||
| array | only if array is not empty | iterator to the begin of the array |
|
||||
|
||||
## Complexity
|
||||
|
||||
Constant, as long as `ArrayType` and `ObjectType` satisfy the [Container concept](http://en.cppreference.com/w/cpp/concept/Container).
|
||||
|
||||
## Exceptions
|
||||
|
||||
None. The function's noexcept-specification is `noexcept`.
|
||||
|
||||
## See also
|
||||
|
||||
- [**end**, **cend**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::end)<br>
|
||||
returns an iterator to the end
|
@ -1,9 +0,0 @@
|
||||
/*!
|
||||
@mainpage
|
||||
|
||||
See @ref nlohmann::basic_json
|
||||
|
||||
@copyright Niels Lohmann\n
|
||||
@include "../../LICENSE.MIT"
|
||||
*/
|
||||
|
@ -1,55 +0,0 @@
|
||||
# nlohmann::basic_json::empty
|
||||
|
||||
```cpp
|
||||
bool empty() const noexcept;
|
||||
```
|
||||
|
||||
Checks if the container has no elements; that is, whether `begin() == end()`.
|
||||
|
||||
## Parameters
|
||||
|
||||
(none)
|
||||
|
||||
## Return value
|
||||
|
||||
`true` if the container is empty, `false` otherwise. Note that the JSON types string, number, and boolean are never empty, null values are always empty.
|
||||
|
||||
## Exceptions
|
||||
|
||||
`noexcept` specification: `noexcept`.
|
||||
|
||||
## Complexity
|
||||
|
||||
Constant (assuming types `ObjectType` and `ArrayType` satisfy the [Container](http://en.cppreference.com/w/cpp/concept/Container) concept).
|
||||
|
||||
## Example
|
||||
|
||||
The following code uses empty to check if a `json` container contains any elements:
|
||||
|
||||
```cpp
|
||||
#include <json.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
nlohman::json numbers;
|
||||
std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n';
|
||||
|
||||
numbers.push_back(42);
|
||||
numbers.push_back(13317);
|
||||
std::cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n';
|
||||
}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
Initially, numbers.empty(): 1
|
||||
After adding elements, numbers.empty(): 0
|
||||
|
||||
## Requirements
|
||||
|
||||
The `empty` member function is part of the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirement.
|
||||
|
||||
## See also
|
||||
|
||||
- `size()`
|
@ -1,25 +0,0 @@
|
||||
SRCDIR = ../../src
|
||||
|
||||
EXAMPLES = $(wildcard *.cpp)
|
||||
|
||||
all:
|
||||
@echo "check"
|
||||
@echo "create"
|
||||
|
||||
clean:
|
||||
rm -f $(EXAMPLES:.cpp=) $(EXAMPLES:.cpp=.output) $(EXAMPLES:.cpp=.test)
|
||||
|
||||
%.output: %.cpp
|
||||
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
|
||||
./$(<:.cpp=) > $@
|
||||
rm $(<:.cpp=)
|
||||
|
||||
%.test: %.cpp
|
||||
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
|
||||
./$(<:.cpp=) > $@
|
||||
diff $@ $(<:.cpp=.output)
|
||||
rm $(<:.cpp=) $@
|
||||
|
||||
create: $(EXAMPLES:.cpp=.output)
|
||||
|
||||
check: $(EXAMPLES:.cpp=.test)
|
@ -1,18 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON arrays
|
||||
json j_no_init_list = json::array();
|
||||
json j_empty_init_list = json::array({});
|
||||
json j_nonempty_init_list = json::array({1, 2, 3, 4});
|
||||
json j_list_of_pairs = json::array({ {"one", 1}, {"two", 2} });
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << j_no_init_list << '\n';
|
||||
std::cout << j_empty_init_list << '\n';
|
||||
std::cout << j_nonempty_init_list << '\n';
|
||||
std::cout << j_list_of_pairs << '\n';
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
[]
|
||||
[]
|
||||
[1,2,3,4]
|
||||
[["one",1],["two",2]]
|
@ -1,28 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_object_empty(json::value_t::object);
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_array_empty(json::value_t::array);
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call back()
|
||||
//std::cout << j_null.back() << '\n'; // would throw
|
||||
std::cout << j_boolean.back() << '\n';
|
||||
std::cout << j_number_integer.back() << '\n';
|
||||
std::cout << j_number_float.back() << '\n';
|
||||
std::cout << j_object.back() << '\n';
|
||||
//std::cout << j_object_empty.back() << '\n'; // would throw
|
||||
std::cout << j_array.back() << '\n';
|
||||
//std::cout << j_array_empty.back() << '\n'; // would throw
|
||||
std::cout << j_string.back() << '\n';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
true
|
||||
17
|
||||
23.42
|
||||
2
|
||||
16
|
||||
"Hello, world"
|
@ -1,12 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON value with default null value
|
||||
json j;
|
||||
|
||||
// serialize the JSON null value
|
||||
std::cout << j << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
null
|
@ -1,58 +0,0 @@
|
||||
#include <json.hpp>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <forward_list>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array from std::vector
|
||||
std::vector<int> c_vector {1, 2, 3, 4};
|
||||
json j_vec(c_vector);
|
||||
|
||||
// create an array from std::deque
|
||||
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
|
||||
json j_deque(c_deque);
|
||||
|
||||
// create an array from std::list
|
||||
std::list<bool> c_list {true, true, false, true};
|
||||
json j_list(c_list);
|
||||
|
||||
// create an array from std::forward_list
|
||||
std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
|
||||
json j_flist(c_flist);
|
||||
|
||||
// create an array from std::array
|
||||
std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
|
||||
json j_array(c_array);
|
||||
|
||||
// create an array from std::set
|
||||
std::set<std::string> c_set {"one", "two", "three", "four", "one"};
|
||||
json j_set(c_set); // only one entry for "one" is used
|
||||
|
||||
// create an array from std::unordered_set
|
||||
std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
|
||||
json j_uset(c_uset); // only one entry for "one" is used
|
||||
|
||||
// create an array from std::multiset
|
||||
std::multiset<std::string> c_mset {"one", "two", "one", "four"};
|
||||
json j_mset(c_mset); // only one entry for "one" is used
|
||||
|
||||
// create an array from std::unordered_multiset
|
||||
std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
|
||||
json j_umset(c_umset); // both entries for "one" are used
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << j_vec << '\n';
|
||||
std::cout << j_deque << '\n';
|
||||
std::cout << j_list << '\n';
|
||||
std::cout << j_flist << '\n';
|
||||
std::cout << j_array << '\n';
|
||||
std::cout << j_set << '\n';
|
||||
std::cout << j_uset << '\n';
|
||||
std::cout << j_mset << '\n';
|
||||
std::cout << j_umset << '\n';
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
[1,2,3,4]
|
||||
[1.2,2.3,3.4,5.6]
|
||||
[true,true,false,true]
|
||||
[12345678909876,23456789098765,34567890987654,45678909876543]
|
||||
[1,2,3,4]
|
||||
["four","one","three","two"]
|
||||
["four","three","two","one"]
|
||||
["four","one","one","two"]
|
||||
["four","two","one","one"]
|
@ -1,41 +0,0 @@
|
||||
#include <json.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an object from std::map
|
||||
std::map<std::string, int> c_map
|
||||
{
|
||||
{"one", 1}, {"two", 2}, {"three", 3}
|
||||
};
|
||||
json j_map(c_map);
|
||||
|
||||
// create an object from std::unordered_map
|
||||
std::unordered_map<const char*, double> c_umap
|
||||
{
|
||||
{"one", 1.2}, {"two", 2.3}, {"three", 3.4}
|
||||
};
|
||||
json j_umap(c_umap);
|
||||
|
||||
// create an object from std::multimap
|
||||
std::multimap<std::string, bool> c_mmap
|
||||
{
|
||||
{"one", true}, {"two", true}, {"three", false}, {"three", true}
|
||||
};
|
||||
json j_mmap(c_mmap); // only one entry for key "three" is used
|
||||
|
||||
// create an object from std::unordered_multimap
|
||||
std::unordered_multimap<std::string, bool> c_ummap
|
||||
{
|
||||
{"one", true}, {"two", true}, {"three", false}, {"three", true}
|
||||
};
|
||||
json j_ummap(c_ummap); // only one entry for key "three" is used
|
||||
|
||||
// serialize the JSON objects
|
||||
std::cout << j_map << '\n';
|
||||
std::cout << j_umap << '\n';
|
||||
std::cout << j_mmap << '\n';
|
||||
std::cout << j_ummap << '\n';
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{"one":1,"three":3,"two":2}
|
||||
{"one":1.2,"three":3.4,"two":2.3}
|
||||
{"one":true,"three":false,"two":true}
|
||||
{"one":true,"three":false,"two":true}
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array_t value
|
||||
json::array_t value = {"one", "two", 3, 4.5, false};
|
||||
|
||||
// create a JSON array from the value
|
||||
json j(value);
|
||||
|
||||
// serialize the JSON array
|
||||
std::cout << j << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
["one","two",3,4.5,false]
|
@ -1,16 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON array
|
||||
json j1 = {"one", "two", 3, 4.5, false};
|
||||
|
||||
// create a copy
|
||||
json j2(j1);
|
||||
|
||||
// serialize the JSON array
|
||||
std::cout << j1 << " = " << j2 << '\n';
|
||||
std::cout << std::boolalpha << (j1 == j2) << '\n';
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
["one","two",3,4.5,false] = ["one","two",3,4.5,false]
|
||||
true
|
@ -1,17 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON values
|
||||
json a = 23;
|
||||
json b = 42;
|
||||
|
||||
// copy-assign a to b
|
||||
b = a;
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << a << '\n';
|
||||
std::cout << b << '\n';
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
23
|
||||
23
|
@ -1,20 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON values
|
||||
json j_empty_init_list = json({});
|
||||
json j_object = { {"one", 1}, {"two", 2} };
|
||||
json j_array = {1, 2, 3, 4};
|
||||
json j_nested_object = { {"one", {1}}, {"two", {1, 2}} };
|
||||
json j_nested_array = { {{1}, "one"}, {{1, 2}, "two"} };
|
||||
|
||||
// serialize the JSON value
|
||||
std::cout << j_empty_init_list << '\n';
|
||||
std::cout << j_object << '\n';
|
||||
std::cout << j_array << '\n';
|
||||
std::cout << j_nested_object << '\n';
|
||||
std::cout << j_nested_array << '\n';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{}
|
||||
{"one":1,"two":2}
|
||||
[1,2,3,4]
|
||||
{"one":[1],"two":[1,2]}
|
||||
[[[1],"one"],[[1,2],"two"]]
|
@ -1,16 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON value
|
||||
json a = 23;
|
||||
|
||||
// move contents of a to b
|
||||
json b(std::move(a));
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << a << '\n';
|
||||
std::cout << b << '\n';
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
null
|
||||
23
|
@ -1,12 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON null value
|
||||
json j(nullptr);
|
||||
|
||||
// serialize the JSON null value
|
||||
std::cout << j << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
null
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an object_t value
|
||||
json::object_t value = { {"one", 1}, {"two", 2} };
|
||||
|
||||
// create a JSON object from the value
|
||||
json j(value);
|
||||
|
||||
// serialize the JSON object
|
||||
std::cout << j << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
{"one":1,"two":2}
|
@ -1,17 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array by creating copies of a JSON value
|
||||
json value = "Hello";
|
||||
json array_0 = json(0, value);
|
||||
json array_1 = json(1, value);
|
||||
json array_5 = json(5, value);
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << array_0 << '\n';
|
||||
std::cout << array_1 << '\n';
|
||||
std::cout << array_5 << '\n';
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
[]
|
||||
["Hello"]
|
||||
["Hello","Hello","Hello","Hello","Hello"]
|
@ -1,24 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create the different JSON values with default values
|
||||
json j_null(json::value_t::null);
|
||||
json j_boolean(json::value_t::boolean);
|
||||
json j_number_integer(json::value_t::number_integer);
|
||||
json j_number_float(json::value_t::number_float);
|
||||
json j_object(json::value_t::object);
|
||||
json j_array(json::value_t::array);
|
||||
json j_string(json::value_t::string);
|
||||
|
||||
// serialize the JSON values
|
||||
std::cout << j_null << '\n';
|
||||
std::cout << j_boolean << '\n';
|
||||
std::cout << j_number_integer << '\n';
|
||||
std::cout << j_number_float << '\n';
|
||||
std::cout << j_object << '\n';
|
||||
std::cout << j_array << '\n';
|
||||
std::cout << j_string << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
null
|
||||
false
|
||||
0
|
||||
0
|
||||
{}
|
||||
[]
|
||||
""
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to the first element
|
||||
json::iterator it = array.begin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
1
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
const json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to the first element
|
||||
json::const_iterator it = array.cbegin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
1
|
@ -1,18 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to one past the last element
|
||||
json::const_iterator it = array.cend();
|
||||
|
||||
// decrement the iterator to point to the last element
|
||||
--it;
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
5
|
@ -1,33 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call clear()
|
||||
j_null.clear();
|
||||
j_boolean.clear();
|
||||
j_number_integer.clear();
|
||||
j_number_float.clear();
|
||||
j_object.clear();
|
||||
j_array.clear();
|
||||
j_string.clear();
|
||||
|
||||
// serialize the cleared values()
|
||||
std::cout << j_null << '\n';
|
||||
std::cout << j_boolean << '\n';
|
||||
std::cout << j_number_integer << '\n';
|
||||
std::cout << j_number_float << '\n';
|
||||
std::cout << j_object << '\n';
|
||||
std::cout << j_array << '\n';
|
||||
std::cout << j_string << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
null
|
||||
false
|
||||
0
|
||||
0
|
||||
{}
|
||||
[]
|
||||
""
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get an iterator to the reverse-beginning
|
||||
json::const_reverse_iterator it = array.crbegin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
5
|
@ -1,18 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get an iterator to the reverse-end
|
||||
json::const_reverse_iterator it = array.crend();
|
||||
|
||||
// increment the iterator to point to the first element
|
||||
--it;
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
1
|
@ -1,20 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON values
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
|
||||
// call dump()
|
||||
std::cout << j_object.dump() << "\n\n";
|
||||
std::cout << j_object.dump(-1) << "\n\n";
|
||||
std::cout << j_object.dump(0) << "\n\n";
|
||||
std::cout << j_object.dump(4) << "\n\n";
|
||||
std::cout << j_array.dump() << "\n\n";
|
||||
std::cout << j_array.dump(-1) << "\n\n";
|
||||
std::cout << j_array.dump(0) << "\n\n";
|
||||
std::cout << j_array.dump(4) << "\n\n";
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{"one":1,"two":2}
|
||||
|
||||
{"one":1,"two":2}
|
||||
|
||||
{
|
||||
"one": 1,
|
||||
"two": 2
|
||||
}
|
||||
|
||||
{
|
||||
"one": 1,
|
||||
"two": 2
|
||||
}
|
||||
|
||||
[1,2,4,8,16]
|
||||
|
||||
[1,2,4,8,16]
|
||||
|
||||
[
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
8,
|
||||
16
|
||||
]
|
||||
|
||||
[
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
8,
|
||||
16
|
||||
]
|
||||
|
@ -1,29 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_object_empty(json::value_t::object);
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_array_empty(json::value_t::array);
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call empty()
|
||||
std::cout << std::boolalpha;
|
||||
std::cout << j_null.empty() << '\n';
|
||||
std::cout << j_boolean.empty() << '\n';
|
||||
std::cout << j_number_integer.empty() << '\n';
|
||||
std::cout << j_number_float.empty() << '\n';
|
||||
std::cout << j_object.empty() << '\n';
|
||||
std::cout << j_object_empty.empty() << '\n';
|
||||
std::cout << j_array.empty() << '\n';
|
||||
std::cout << j_array_empty.empty() << '\n';
|
||||
std::cout << j_string.empty() << '\n';
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
false
|
@ -1,18 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to one past the last element
|
||||
json::iterator it = array.end();
|
||||
|
||||
// decrement the iterator to point to the last element
|
||||
--it;
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
5
|
@ -1,28 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_object_empty(json::value_t::object);
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_array_empty(json::value_t::array);
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call front()
|
||||
//std::cout << j_null.front() << '\n'; // would throw
|
||||
std::cout << j_boolean.front() << '\n';
|
||||
std::cout << j_number_integer.front() << '\n';
|
||||
std::cout << j_number_float.front() << '\n';
|
||||
std::cout << j_object.front() << '\n';
|
||||
//std::cout << j_object_empty.front() << '\n'; // would throw
|
||||
std::cout << j_array.front() << '\n';
|
||||
//std::cout << j_array_empty.front() << '\n'; // would throw
|
||||
std::cout << j_string.front() << '\n';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
true
|
||||
17
|
||||
23.42
|
||||
1
|
||||
1
|
||||
"Hello, world"
|
@ -1,25 +0,0 @@
|
||||
#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_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_array()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_array() << '\n';
|
||||
std::cout << j_object.is_array() << '\n';
|
||||
std::cout << j_array.is_array() << '\n';
|
||||
std::cout << j_string.is_array() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_boolean()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_boolean() << '\n';
|
||||
std::cout << j_object.is_boolean() << '\n';
|
||||
std::cout << j_array.is_boolean() << '\n';
|
||||
std::cout << j_string.is_boolean() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_null()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_null() << '\n';
|
||||
std::cout << j_object.is_null() << '\n';
|
||||
std::cout << j_array.is_null() << '\n';
|
||||
std::cout << j_string.is_null() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_number() << '\n';
|
||||
std::cout << j_object.is_number() << '\n';
|
||||
std::cout << j_array.is_number() << '\n';
|
||||
std::cout << j_string.is_number() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_float()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_number_float() << '\n';
|
||||
std::cout << j_object.is_number_float() << '\n';
|
||||
std::cout << j_array.is_number_float() << '\n';
|
||||
std::cout << j_string.is_number_float() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_integer()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_number_integer() << '\n';
|
||||
std::cout << j_object.is_number_integer() << '\n';
|
||||
std::cout << j_array.is_number_integer() << '\n';
|
||||
std::cout << j_string.is_number_integer() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_object()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_object() << '\n';
|
||||
std::cout << j_object.is_object() << '\n';
|
||||
std::cout << j_array.is_object() << '\n';
|
||||
std::cout << j_string.is_object() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
@ -1,25 +0,0 @@
|
||||
#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_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_string()
|
||||
std::cout << std::boolalpha;
|
||||
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_float.is_string() << '\n';
|
||||
std::cout << j_object.is_string() << '\n';
|
||||
std::cout << j_array.is_string() << '\n';
|
||||
std::cout << j_string.is_string() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
@ -1,24 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call max_size()
|
||||
std::cout << j_null.max_size() << '\n';
|
||||
std::cout << j_boolean.max_size() << '\n';
|
||||
std::cout << j_number_integer.max_size() << '\n';
|
||||
std::cout << j_number_float.max_size() << '\n';
|
||||
std::cout << j_object.max_size() << '\n';
|
||||
std::cout << j_array.max_size() << '\n';
|
||||
std::cout << j_string.max_size() << '\n';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
256204778801521550
|
||||
1152921504606846975
|
||||
1
|
@ -1,17 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON arrays
|
||||
json j_no_init_list = json::object();
|
||||
json j_empty_init_list = json::object({});
|
||||
json j_list_of_pairs = json::object({ {"one", 1}, {"two", 2} });
|
||||
//json j_invalid_list = json::object({ "one", 1 }); // would throw
|
||||
|
||||
// serialize the JSON arrays
|
||||
std::cout << j_no_init_list << '\n';
|
||||
std::cout << j_empty_init_list << '\n';
|
||||
std::cout << j_list_of_pairs << '\n';
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{}
|
||||
{}
|
||||
{"one":1,"two":2}
|
@ -1,15 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get an iterator to the reverse-beginning
|
||||
json::reverse_iterator it = array.rbegin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
5
|
@ -1,18 +0,0 @@
|
||||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get an iterator to the reverse-end
|
||||
json::reverse_iterator it = array.rend();
|
||||
|
||||
// increment the iterator to point to the first element
|
||||
--it;
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
std::cout << *it << '\n';
|
||||
}
|
@ -1 +0,0 @@
|
||||
1
|
@ -1,28 +0,0 @@
|
||||
#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_float = 23.42;
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_object_empty(json::value_t::object);
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_array_empty(json::value_t::array);
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call size()
|
||||
std::cout << j_null.size() << '\n';
|
||||
std::cout << j_boolean.size() << '\n';
|
||||
std::cout << j_number_integer.size() << '\n';
|
||||
std::cout << j_number_float.size() << '\n';
|
||||
std::cout << j_object.size() << '\n';
|
||||
std::cout << j_object_empty.size() << '\n';
|
||||
std::cout << j_array.size() << '\n';
|
||||
std::cout << j_array_empty.size() << '\n';
|
||||
std::cout << j_string.size() << '\n';
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
0
|
||||
5
|
||||
0
|
||||
1
|
@ -1,435 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="545.89282"
|
||||
height="156.9409"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="range-begin-end.svg">
|
||||
<defs
|
||||
id="defs4">
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Mend"
|
||||
orient="auto"
|
||||
refY="0"
|
||||
refX="0"
|
||||
id="Arrow1Mend"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
id="path6525"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
|
||||
transform="matrix(-0.4,0,0,-0.4,-4,0)"
|
||||
inkscape:connector-curvature="0" />
|
||||
</marker>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Lend"
|
||||
orient="auto"
|
||||
refY="0"
|
||||
refX="0"
|
||||
id="Arrow1Lend"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
id="path6519"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
|
||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
||||
inkscape:connector-curvature="0" />
|
||||
</marker>
|
||||
<linearGradient
|
||||
id="linearGradient5488">
|
||||
<stop
|
||||
style="stop-color:#c1b1b1;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5490" />
|
||||
<stop
|
||||
style="stop-color:#e3e3e3;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5492" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4040">
|
||||
<stop
|
||||
style="stop-color:#b6b6b6;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4042" />
|
||||
<stop
|
||||
style="stop-color:#e3e3e3;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop4044" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5488"
|
||||
id="linearGradient6284"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="81"
|
||||
y1="1001.3622"
|
||||
x2="81"
|
||||
y2="971.36218" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5488-2"
|
||||
id="linearGradient6284-3"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="81"
|
||||
y1="1001.3622"
|
||||
x2="81"
|
||||
y2="971.36218" />
|
||||
<linearGradient
|
||||
id="linearGradient5488-2">
|
||||
<stop
|
||||
style="stop-color:#c1b1b1;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5490-5" />
|
||||
<stop
|
||||
style="stop-color:#e3e3e3;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5492-8" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5488-0"
|
||||
id="linearGradient6284-5"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="81"
|
||||
y1="1001.3622"
|
||||
x2="81"
|
||||
y2="971.36218" />
|
||||
<linearGradient
|
||||
id="linearGradient5488-0">
|
||||
<stop
|
||||
style="stop-color:#c1b1b1;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5490-1" />
|
||||
<stop
|
||||
style="stop-color:#e3e3e3;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5492-3" />
|
||||
</linearGradient>
|
||||
<marker
|
||||
inkscape:stockid="Arrow1Mend"
|
||||
orient="auto"
|
||||
refY="0"
|
||||
refX="0"
|
||||
id="Arrow1Mend-8"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path6525-3"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
|
||||
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
|
||||
</marker>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5488"
|
||||
id="linearGradient9026"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="81"
|
||||
y1="1001.3622"
|
||||
x2="81"
|
||||
y2="971.36218" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.4"
|
||||
inkscape:cx="332.80082"
|
||||
inkscape:cy="165.04542"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="993"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="34"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:snap-smooth-nodes="false"
|
||||
inkscape:bbox-nodes="false"
|
||||
inkscape:snap-bbox-edge-midpoints="false"
|
||||
inkscape:object-paths="true"
|
||||
fit-margin-top="10"
|
||||
fit-margin-right="10"
|
||||
fit-margin-bottom="10"
|
||||
fit-margin-left="10" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-26.107143,-893.4807)">
|
||||
<g
|
||||
id="g7184">
|
||||
<path
|
||||
inkscape:tile-y0="219"
|
||||
inkscape:tile-x0="51"
|
||||
inkscape:tile-h="30.00002"
|
||||
inkscape:tile-w="29.999997"
|
||||
inkscape:tile-cy="234.00001"
|
||||
inkscape:tile-cx="65.999998"
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3006"
|
||||
d="m 80.999997,1001.3622 -29.999997,0 0,-30.00002 29.999997,0 z"
|
||||
style="fill:url(#linearGradient9026);fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<use
|
||||
height="300"
|
||||
width="600"
|
||||
style="fill:none"
|
||||
id="use4010"
|
||||
transform="translate(29.999997,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0" />
|
||||
<use
|
||||
id="use4012"
|
||||
transform="translate(59.999994,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4014"
|
||||
transform="translate(89.999991,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4016"
|
||||
transform="translate(119.99999,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4018"
|
||||
transform="translate(149.99998,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4020"
|
||||
transform="translate(179.99998,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4022"
|
||||
transform="translate(209.99998,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4024"
|
||||
transform="translate(239.99998,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4026"
|
||||
transform="translate(269.99997,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4028"
|
||||
transform="translate(299.99997,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4030"
|
||||
transform="translate(329.99997,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4032"
|
||||
transform="translate(359.99996,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4034"
|
||||
transform="translate(389.99996,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4036"
|
||||
transform="translate(419.99996,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<use
|
||||
id="use4038"
|
||||
transform="translate(449.99995,0)"
|
||||
xlink:href="#path3006"
|
||||
inkscape:tiled-clone-of="#path3006"
|
||||
y="0"
|
||||
x="0"
|
||||
width="600"
|
||||
height="300" />
|
||||
<path
|
||||
inkscape:tile-y0="219"
|
||||
inkscape:tile-x0="51"
|
||||
inkscape:tile-h="30.00002"
|
||||
inkscape:tile-w="29.999997"
|
||||
inkscape:tile-cy="234.00001"
|
||||
inkscape:tile-cx="65.999998"
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3006-3"
|
||||
d="m 560.99995,1001.3622 -30,0 0,-30.00002 30,0 z"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:2, 2;stroke-dashoffset:0;marker-start:none" />
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:55.00000119%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
|
||||
x="392.94931"
|
||||
y="1040.2404"
|
||||
id="text6504"
|
||||
sodipodi:linespacing="55.000001%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan6506"
|
||||
x="392.94931"
|
||||
y="1040.2404"
|
||||
rotate="0 0 0 0 0 0 0 0 0.50000191 0 0 0 0 0 0 0 0 0 0 0 0 0"
|
||||
dy="0"
|
||||
dx="0"
|
||||
style="font-size:12.80000019px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans">Past-the-last element</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
|
||||
d="m 531.84531,279.29187 c 14.75083,-11.1311 12.86656,-14.42379 15.15229,-29.29442"
|
||||
id="path6510"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="translate(0,752.36218)"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<g
|
||||
id="g7203"
|
||||
transform="translate(-40,-18.482143)">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 128.39286,947.36218 -51.785717,0 0,-21.51786 51.785717,0 z"
|
||||
id="use6288-9"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:tile-x0="51"
|
||||
inkscape:tile-y0="219" />
|
||||
<text
|
||||
transform="translate(0,752.36218)"
|
||||
sodipodi:linespacing="55.000001%"
|
||||
id="text7176"
|
||||
y="189.10715"
|
||||
x="80.535713"
|
||||
style="font-size:15px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:55.00000119%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="189.10715"
|
||||
x="80.535713"
|
||||
id="tspan7178"
|
||||
sodipodi:role="line">begin</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g7238"
|
||||
transform="translate(20.035895,11.306019)">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 538.39286,914.19254 -37.50001,0 0,-21.51786 37.50001,0 z"
|
||||
id="use6288-9-7"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:tile-x0="51"
|
||||
inkscape:tile-y0="219" />
|
||||
<text
|
||||
sodipodi:linespacing="55.000001%"
|
||||
id="text7176-3"
|
||||
y="908.29968"
|
||||
x="504.82141"
|
||||
style="font-size:15px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:55.00000119%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="908.29968"
|
||||
x="504.82141"
|
||||
id="tspan7178-7"
|
||||
sodipodi:role="line">end</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:none;marker-end:url(#Arrow1Mend)"
|
||||
d="M 60.16588,176.51786 C 64.809921,191.17027 67.41717,201.02245 68.196339,219"
|
||||
id="path7243"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="translate(0,752.36218)"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:none;marker-end:url(#Arrow1Mend)"
|
||||
d="m 540.40821,925.49856 c 2.63474,15.08647 5.72454,31.23577 6.06617,45.86362"
|
||||
id="path7243-8"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 14 KiB |
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 40 KiB |
143
docs/index.md
143
docs/index.md
@ -1,143 +0,0 @@
|
||||
# nlohmann::basic_json
|
||||
|
||||
Defined in header `<json.hpp>`
|
||||
|
||||
```cpp
|
||||
template <
|
||||
template<typename U, typename V, typename... Args> class ObjectType = std::map,
|
||||
template<typename U, typename... Args> class ArrayType = std::vector,
|
||||
class StringType = std::string,
|
||||
class BooleanType = bool,
|
||||
class NumberIntegerType = int64_t,
|
||||
class NumberFloatType = double,
|
||||
template<typename U> class Allocator = std::allocator
|
||||
> class basic_json;
|
||||
```
|
||||
|
||||
## Template Parameters
|
||||
|
||||
- `ObjectType` - The type to store collection of name/value pairs. It can be any associative container that can hold key-value pairs as long as the key type is the same as `StringType`. The value type is again `nlohmann::basic_json`. The parameter `ObjectType` defaults to [`std::map`](http://en.cppreference.com/w/cpp/container/map).
|
||||
- `ArrayType` - The type to store ordered value lists. It can be any sequence container. The parameter `ArrayType` defaults to a [`std::vector`](http://en.cppreference.com/w/cpp/container/vector) whose elements are of type `nlohmann::basic_json`.
|
||||
- `StringType` - The type to store string values. The parameter `StringType` defaults to [`std::string`](http://en.cppreference.com/w/cpp/string/basic_string).
|
||||
- `BooleanType`
|
||||
- `NumberIntegerType`
|
||||
- `NumberFloatType`
|
||||
- `Allocator` - An allocator that is used to acquire memory to store the elements. The type must meet the requirements of [`Allocator`](http://en.cppreference.com/w/cpp/concept/Allocator).
|
||||
|
||||
## Specializations
|
||||
|
||||
A standard JSON type `nlohmann::json` is defined in `<json.hpp>` which uses the default types:
|
||||
|
||||
```cpp
|
||||
using json = basic_json<
|
||||
std::map,
|
||||
std::vector,
|
||||
std::string,
|
||||
bool,
|
||||
int64_t,
|
||||
double,
|
||||
std::allocator
|
||||
>
|
||||
```
|
||||
|
||||
|
||||
## Iterator invalidation
|
||||
|
||||
## Member types
|
||||
|
||||
- `value_type`
|
||||
- `reference`
|
||||
- `const_reference`
|
||||
- `difference_type`
|
||||
- `size_type`
|
||||
- `allocator_type`
|
||||
- `pointer`
|
||||
- `const_pointer`
|
||||
- `iterator`
|
||||
- `const_iterator`
|
||||
- `reverse_iterator`
|
||||
- `const_reverse_iterator`
|
||||
- `object_t`
|
||||
- `array_t`
|
||||
- `string_t`
|
||||
- `boolean_t`
|
||||
- `number_integer_t`
|
||||
- `number_float_t`
|
||||
- `list_init_t`
|
||||
- `json_value`
|
||||
|
||||
## Member functions
|
||||
|
||||
- constructor
|
||||
- destructor
|
||||
- `operator=`
|
||||
- `get_allocator`
|
||||
|
||||
### Object inspection
|
||||
|
||||
- `dump`
|
||||
- `type`
|
||||
- `is_null`
|
||||
- `is_boolean`
|
||||
- `is_number`
|
||||
- `is_object`
|
||||
- `is_array`
|
||||
- `is_string`
|
||||
- `operator value_t`
|
||||
- `std::hash`
|
||||
|
||||
### Value conversion
|
||||
|
||||
- `get`
|
||||
- implicit conversion
|
||||
|
||||
### Element access
|
||||
|
||||
- `at`
|
||||
- `operator[]`
|
||||
- `erase`
|
||||
- `find`
|
||||
- `count`
|
||||
|
||||
### Iterators
|
||||
|
||||
- `begin` / `cbegin`
|
||||
- `end` / `cend`
|
||||
- `rbegin` / `crbegin`
|
||||
- `rend` / `crend`
|
||||
|
||||
### Capacity
|
||||
|
||||
- [`empty`](empty)
|
||||
- `size`
|
||||
- `max_size`
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `clear`
|
||||
- `push_back`
|
||||
- `operator+=`
|
||||
- `erase`
|
||||
- `swap`
|
||||
- `std::swap`
|
||||
|
||||
### Comparisons
|
||||
|
||||
- `operator==`
|
||||
- `operator!=`
|
||||
- `operator<`
|
||||
- `operator<=`
|
||||
- `operator>`
|
||||
- `operator>=`
|
||||
|
||||
### Serialization
|
||||
|
||||
- `dump`
|
||||
- `operator<<`
|
||||
- `operator>>`
|
||||
|
||||
### Deserialization
|
||||
|
||||
- `parse`
|
||||
- `operator<<`
|
||||
- `operator>>`
|
@ -1,7 +0,0 @@
|
||||
.memtemplate {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.memTemplParams {
|
||||
display: none;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
.memtemplate {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.memTemplParams {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navtab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#top, .footer {
|
||||
display: none;
|
||||
}
|
Reference in New Issue
Block a user