diff --git a/nlohmann::basic_json.md b/nlohmann::basic_json.md deleted file mode 100644 index eef6e95..0000000 --- a/nlohmann::basic_json.md +++ /dev/null @@ -1,157 +0,0 @@ -Defined in header [`json.hpp`](https://github.com/nlohmann/json/blob/master/src/json.hpp) - -```cpp -template < - class ObjectType = std::map, - class ArrayType = std::vector, - class StringType = std::string, - class BooleanType = bool, - class NumberIntegerType = int64_t, - class NumberFloatType = double, - class AllocatorType = std::allocator -> class basic_json; -``` - -## Template parameters - -- `ObjectType` - container type used for JSON objects -- `ArrayType` - container type used for JSON arrays -- `StringType` - container type used for JSON strings -- `BooleanType` - type used for JSON boolean -- `NumberIntegerType` - type used for JSON numbers (integers) -- `NumberFloatType` - type used for JSON numbers (floating point) -- `AllocatorType` - [Allocator](http://en.cppreference.com/w/cpp/concept/Allocator) type used to allocate internal storage - -## Typedefs - -| Type | Definition | -| --- | --- | -| `object_t` | `ObjectType` | -| `array_t` | `ArrayType` | -| `string_t` | `StringType` | -| `boolean_t` | `BooleanType` | -| `number_integer_t` | `NumberIntegerType` | -| `number_float_t` | `NumberFloatType` | -| `list_init_t` | `std::initializer_list` | -| `json` | `basic_json<>` | - -Note the type `json` is a typedef for the class `basic_json` with its default types, resulting in the following typedefs: - -| Type | Definition | -| --- | --- | -| `json::object_t` | `std::map` | -| `json::array_t` | `std::vector` | -| `json::string_t` | `std::string` | -| `json::boolean_t` | `bool` | -| `json::number_integer_t` | `int64_t` | -| `json::number_float_t` | `double` | -| `json::list_init_t` | `std::initializer_list` | - -## Member types - -| Member type | Definition | -| --- | --- | -| `value_type` | `basic_json` | -| `reference` | `value_type&` | -| `const_reference` | `const value_type&` | -| `difference_type` | `std::ptrdiff_t` | -| `size_type` | `std::size_t` | -| `allocator_type` | `AllocatorType` | -| `pointer` | `std::allocator_traits::pointer` | -| `const_pointer` | `std::allocator_traits::const_pointer` | -| `iterator` | random access iterator | -| `const_iterator` | constant random access iterator | -| `reverse_iterator` | `std::reverse_iterator` | -| `const_reverse_iterator` | `std::reverse_iterator` | - -## Member functions - -- [**(constructor)**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::basic_json)
- constructs the container -- [**(destructor)**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::~basic_json)
- destructs the container -- [**operator=**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::operator=)
- assigns values to the container -- [**get_allocator**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::get_allocator)
- returns the associated allocator - -### Type support - -- [**(implicit value conversion)**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::operator-T()) -- [**get**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::get)
- explicit value conversion -- `type` -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string - -### Element access - -- [**operator[]**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::operator[])
- access specific element -- [**at**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::at)
- access specific element with bound checking -- [**front**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::front)
- access the first element -- [**back**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::back)
- access the last element - -### Iterators - -- [**begin**, **cbegin**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::begin)
- returns an iterator to the beginning -- [**end**, **cend**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::end)
- returns an iterator to the end -- [**rbegin**, **crbegin**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::rbegin)
- returns a reverse iterator to the beginning -- [**rend**, **crend**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::rend)
- returns a reverse iterator to the end - -### Capacity - -- [**empty**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::empty)
-checks whether the container is empty -- [**size**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::size)
-returns the number of elements -- [**max_size**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::max_size)
-returns the maximum possible number of elements - -### Modifiers - -- [**erase**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::erase)
-erases elements -- [**clear**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::clear)
-clears the contents -- `push_back` -- `operator+=` -- `swap` - -### Lookup - -- `find` -- `count` - -### Serialization and deserialization - -- `dump` -- `parse` - -## Non-member functions - -- `operator==`, `operator!=`, `operator<`, `operator<=`, `operator>`, `operator>=` -- `std::swap` -- `std::hash` - -### Input/output - -- `operator<<`, `operator>>` -- `operator"" _json` \ No newline at end of file diff --git a/nlohmann::basic_json::at.md b/nlohmann::basic_json::at.md deleted file mode 100644 index 3ded448..0000000 --- a/nlohmann::basic_json::at.md +++ /dev/null @@ -1,32 +0,0 @@ -```cpp -reference at(size_type idx); -const_reference at(size_type idx) const; // 1 -``` -```cpp -reference at(const object_t::key_type& key) -const_reference at(const object_t::key_type& key) const // 2 -``` - -## Description - -1. Returns a reference to the element at specified index `idx`, with bounds checking. If `idx` not within the range of the container, an exception of type `std::out_of_range` is thrown (only works for arrays). -2. Returns a reference to the mapped value of the element with key equivalent to `key`. If no such element exists, an exception of type `std::out_of_range` is thrown (only works for objects). - -## Parameters - -- `idx`: index of the element to return -- `key`: key of the element to return - -## Return value - -Reference to the specified value. - -## Complexity - -1. Constant. -2. Logarithmic in the size of the container. - -## Exceptions - -1. `std::runtime_error` when called on a JSON container with other type than `array`; `std::out_of_range` if `!(idx < size())`. -2. `std::runtime_error` when called on a JSON container with other type than `object`; `std::out_of_range` if the container does not have an element with the specified key. diff --git a/nlohmann::basic_json::back.md b/nlohmann::basic_json::back.md deleted file mode 100644 index 32723f7..0000000 --- a/nlohmann::basic_json::back.md +++ /dev/null @@ -1,31 +0,0 @@ -```cpp -reference back(); -const_reference back() const; -``` - -## Description - -Returns a reference to the last element in the container. Calling `back` on an empty container is undefined. - -For a JSON container `c`, the expression `return c.back();` is equivalent to `{ auto tmp = c.end(); --tmp; return *tmp; }`. - -## Parameters - -None. - -## Return value - -Reference to the last element. In cast of number, string, or boolean values, a reference to the value is returned. - -## Complexity - -Constant. - -## Exceptions - -`std::out_of_range` when called on null value. - -## See also - -- [**front**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::front)
- access the first element \ No newline at end of file diff --git a/nlohmann::basic_json::basic_json.md b/nlohmann::basic_json::basic_json.md deleted file mode 100644 index 05be6fc..0000000 --- a/nlohmann::basic_json::basic_json.md +++ /dev/null @@ -1,44 +0,0 @@ -```cpp -basic_json(); -basic_json(std::nullptr_t); // 1 -``` -```cpp -basic_json(const value_t t); // 2 -``` -```cpp -basic_json(const T& value); // 3 -``` -```cpp -basic_json(std::initializer_list init); // 4 -``` - -## Description - -1. Creates a null object. -2. Creates a default-initialized container of a specified type. -3. Creates a value-initialized container of an implicitly specified type. -4. Creates an array or object type from an initializer list. - -In case of item 3 and 4, the following types are valid: - -| Value type | Type `T` | Literal | -| ---------- | --------------------- | ---- | -| null | `std::nullptr_t` | `nullptr` | -| boolean | any value convertible to `BooleanType` (e.g., `bool`) | `true`, `false` | -| string | any value convertible to `StringType` (e.g., `std::string`, `const char *`) | `"hello"` | -| number | any value convertible to `NumberIntegerType` (e.g., `int`, `unsigned int`, `long`, `int64_t`) | `10`, `-23e-23`, `3.1415926` | -| object | any associative container whose `key_type` is convertible to `StringType` and whose `value_type` is convertible to `basic_json` with the rules described above (e.g., `std::map`, `std::unordered_map` | `{{"one", 1}, {"two", 2}}` | -| array | any container whose `value_type` is convertible to `basic_json` with the rules described above (e.g., `std::vector`, `std::list` | {1, false, "hello"} | - -## Parameters - -- `t`: type name; can be `null`, `object`, `array`, `string`, `boolean`, `number_integer`, or `number_float`. -- `value`: can be any value whose type can be translated to a JSON container (see table above). -- `init`: an initializer list of (a) values that can be translated to a JSON container (see table above) to create an array; (b) pairs of a string type and a value that can be translate to a JSON container (see table above) to create an object. - -## Complexity - -1. Constant. -2. Constant. -3. Linear in the passed value. -4. Linear in the size of the initializer list. diff --git a/nlohmann::basic_json::begin.md b/nlohmann::basic_json::begin.md deleted file mode 100644 index 737bd0c..0000000 --- a/nlohmann::basic_json::begin.md +++ /dev/null @@ -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::basic_json::end). - -![illustration of iterators](http://upload.cppreference.com/mwiki/images/1/1b/range-begin-end.svg) - -## 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::basic_json::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::basic_json::end)
- returns an iterator to the end \ No newline at end of file diff --git a/nlohmann::basic_json::clear.md b/nlohmann::basic_json::clear.md deleted file mode 100644 index 6472260..0000000 --- a/nlohmann::basic_json::clear.md +++ /dev/null @@ -1,37 +0,0 @@ -```cpp -void clear(); -``` - -## Description - -Removes all elements from the container. The resulting value depends on the different value types and is defined as follows: - -| Value type | JSON value | -| ---------- | --------------------- | -| null | `null` | -| boolean | `false` | -| string | `""` | -| number | `0` | -| object | `{}` | -| array | `[]` | - -## Parameters - -None. - -## Return value - -None. - -## Complexity - -Linear in the size of the container. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## See also - -- [**erase**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::erase)
-erases elements diff --git a/nlohmann::basic_json::empty.md b/nlohmann::basic_json::empty.md deleted file mode 100644 index a673690..0000000 --- a/nlohmann::basic_json::empty.md +++ /dev/null @@ -1,58 +0,0 @@ -```cpp -bool empty() const; -``` - -## Description - -Checks if a JSON value has no elements, i.e. whether `begin() == end()`. - -## Parameters - -None. - -## Return value - -The return value depends on the different value types and is defined as follows: - -| Value type | return value | -| ---------- | --------------------- | -| null | `true` | -| boolean | `false` | -| string | `false` | -| number | `false` | -| object | `ObjectType::empty()` | -| array | `ArrayType::empty()` | - -## 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`. - -## Example - -The following code uses empty to check if a `nlohmann::json` contains any elements: - -```cpp -#include -#include - -int main() -{ - nlohmann::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 -``` \ No newline at end of file diff --git a/nlohmann::basic_json::end.md b/nlohmann::basic_json::end.md deleted file mode 100644 index 1102381..0000000 --- a/nlohmann::basic_json::end.md +++ /dev/null @@ -1,32 +0,0 @@ -```cpp -iterator end(); -const_iterator end() const; -const_iterator cend() const; -``` - -## Description - -Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior. - -![illustration of iterators](http://upload.cppreference.com/mwiki/images/1/1b/range-begin-end.svg) - -## Parameters - -None. - -## Return value - -Iterator to the element following the last element. - -## 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 - -- [**begin**, **cbegin**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::begin)
- returns an iterator to the beginning diff --git a/nlohmann::basic_json::erase.md b/nlohmann::basic_json::erase.md deleted file mode 100644 index eb710e3..0000000 --- a/nlohmann::basic_json::erase.md +++ /dev/null @@ -1,64 +0,0 @@ -```cpp -iterator erase(iterator pos); -const_iterator erase(const_iterator pos); // 1 -``` -```cpp -iterator erase(iterator first, iterator last); -const_iterator erase(const_iterator first, const_iterator last); // 2 -``` -```cpp -void erase(const size_type idx); // 3 -``` -```cpp -size_type erase(const typename object_t::key_type& key); // 4 -``` - -## Description - -Removes specified elements from the JSON value. - -1. Removes the element at `pos`. -2. Removes the elements in the range [`first`; `last`). -3. Removes the element at index `idx` (only works for arrays). -4. Removes the element with key `key` (only works for objects). - -Invalidates iterators and references at or after the point of the erase, including the `end()` iterator. - -The iterator `pos` must be valid and dereferenceable. Thus the `end()` iterator (which is valid, but is not dereferencable) cannot be used as a value for `pos`. - -The iterator `first` does not need to be dereferenceable if `first==last`: erasing an empty range is a no-op. - -If erase is called with valid and dereferenceable iterators for JSON values of type number, string, or boolean, the value will be changed to `null`. - -## Parameter - -- `pos`: iterator to the element to remove -- `first`, `last`: range of elements to remove -- `idx`: index of the element to remove -- `key`: key of the element to remove - -## Return value - -1. Iterator following the last removed element. If the iterator pos refers to the last element, the `end()` iterator is returned. -2. Iterator following the last removed element. If the iterator pos refers to the last element, the `end()` iterator is returned. -3. None. -4. Number of elements removed. - -## Complexity - -1. Linear in distance between `pos` and the end of the container in case of arrays; amortized constant in case of objects; constant otherwise. -2. Linear in the distance between `first` and `last`, plus linear in the distance between `last` and end of the container in case of arrays; `log(c.size()) + std::distance(first, last)` where `c` is the instance of `ObjectType` in case of objects; constant otherwise. -3. Linear in distance between `idx` and the end of the container. -4. `log(c.size()) + c.count(key)` where `c` is the instance of `ObjectType`. - -## Exceptions - -1. `std::runtime_error` when called on null type. -2. `std::runtime_error` when called on null type. -3. `std::runtime_error` when called on non-array types. `std::out_of_range` when `idx >= size()`. -4. `std::runtime_error` when called on non-object types. Any exceptions thrown by the `ObjectType::Compare` object. - -## See also - -- [**clear**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::clear)
-clears the contents diff --git a/nlohmann::basic_json::front.md b/nlohmann::basic_json::front.md deleted file mode 100644 index 0611a7c..0000000 --- a/nlohmann::basic_json::front.md +++ /dev/null @@ -1,31 +0,0 @@ -```cpp -reference front(); -const_reference front() const; -``` - -## Description - -Returns a reference to the first element in the container. Calling `front` on an empty container is undefined. - -For a JSON container `c`, the expression `c.front()` is equivalent to `*c.begin()`. - -## Parameters - -None. - -## Return value - -Reference to the first element. In cast of number, string, or boolean values, a reference to the value is returned. - -## Complexity - -Constant. - -## Exceptions - -`std::out_of_range` when called on null value. - -## See also - -- [**back**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::back)
- access the last element \ No newline at end of file diff --git a/nlohmann::basic_json::get.md b/nlohmann::basic_json::get.md deleted file mode 100644 index 747ceb1..0000000 --- a/nlohmann::basic_json::get.md +++ /dev/null @@ -1,65 +0,0 @@ -```cpp -template -T get() const; -``` - -## Description - -Returns the value of a JSON container in a variety of types. - -## Parameters - -None. - -## Return value - -The return value is the JSON container's value casted to the return value type `T`. The following type lists compatible types for the different JSON value types. - -| value type | compatible types | -| ---------- | --------------------- | -| null | none | -| boolean | `boolean_t`, `bool` | -| string | any type convertible from `string_t` | -| number | any [arithmetic type](http://en.cppreference.com/w/cpp/types/is_arithmetic) (that is, an integral type or a floating-point type) | -| object | `object_t`, any associative container whose `key_type` convertible from `string_t` and whose `mapped_type ` is convertible from `basic_json` | -| array | `array_t`, any sequence container whose `value_type` is convertible from `basic_json`; furthermore, `std::set` and `std::unordered_set` with the same constraints are allowed | - -Note that in case of objects and arrays, all values must be compatible. - -## Complexity - -Amortized linear in the size of the JSON type. - -## Exceptions - -`std::std::logic_error` if types are not compatible. - -## Example - -```cpp -#include -#include -#include -#include -#include -#include - -int main() -{ - nlohmann::json j1 = {1, 2, 3.2, 4.3, 5.4}; - auto v11 = j1.get>(); - auto v12 = j1.get>(); - auto v13 = j1.get>(); - - nlohmann::json j2 = {{"one", 1}, {"two", 2}, {"three", 3}}; - auto v21 = j2.get>(); - auto v22 = j2.get>(); - - nlohmann::json j3 = "Hello, world"; - auto v31 = j3.get(); -} -``` - -## See also - -- [**(implicit value conversion)**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::operator-T()) \ No newline at end of file diff --git a/nlohmann::basic_json::get_allocator.md b/nlohmann::basic_json::get_allocator.md deleted file mode 100644 index 31e97d1..0000000 --- a/nlohmann::basic_json::get_allocator.md +++ /dev/null @@ -1,19 +0,0 @@ -```cpp -static allocator_type get_allocator(); -``` - -## Description - -Returns the allocator associated with the container. - -## Parameters - -None. - -## Return value - -the associated allocator - -## Complexity - -Constant. diff --git a/nlohmann::basic_json::is_array.md b/nlohmann::basic_json::is_array.md deleted file mode 100644 index fa209c4..0000000 --- a/nlohmann::basic_json::is_array.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_array() const; -``` - -## Description - -Returns whether JSON container has type array. - -## Parameters - -None. - -## Return value - -`true` of value type is array, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_array() << '\n'; - std::cout << std::boolalpha << j_boolean.is_array() << '\n'; - std::cout << std::boolalpha << j_number.is_array() << '\n'; - std::cout << std::boolalpha << j_object.is_array() << '\n'; - std::cout << std::boolalpha << j_array.is_array() << '\n'; - std::cout << std::boolalpha << j_string.is_array() << '\n'; -} -``` - -### Output - -``` -false -false -false -false -true -false -``` - -## See also - -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string diff --git a/nlohmann::basic_json::is_boolean.md b/nlohmann::basic_json::is_boolean.md deleted file mode 100644 index 3991d79..0000000 --- a/nlohmann::basic_json::is_boolean.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_boolean() const; -``` - -## Description - -Returns whether JSON container has type boolean. - -## Parameters - -None. - -## Return value - -`true` of value type is boolean, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_boolean() << '\n'; - std::cout << std::boolalpha << j_boolean.is_boolean() << '\n'; - std::cout << std::boolalpha << j_number.is_boolean() << '\n'; - std::cout << std::boolalpha << j_object.is_boolean() << '\n'; - std::cout << std::boolalpha << j_array.is_boolean() << '\n'; - std::cout << std::boolalpha << j_string.is_boolean() << '\n'; -} -``` - -### Output - -``` -false -true -false -false -false -false -``` - -## See also - -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string diff --git a/nlohmann::basic_json::is_null.md b/nlohmann::basic_json::is_null.md deleted file mode 100644 index 98d4b42..0000000 --- a/nlohmann::basic_json::is_null.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_null() const; -``` - -## Description - -Returns whether JSON container has type null. - -## Parameters - -None. - -## Return value - -`true` of value type is null, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_null() << '\n'; - std::cout << std::boolalpha << j_boolean.is_null() << '\n'; - std::cout << std::boolalpha << j_number.is_null() << '\n'; - std::cout << std::boolalpha << j_object.is_null() << '\n'; - std::cout << std::boolalpha << j_array.is_null() << '\n'; - std::cout << std::boolalpha << j_string.is_null() << '\n'; -} -``` - -### Output - -``` -true -false -false -false -false -false -``` - -## See also - -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string diff --git a/nlohmann::basic_json::is_number.md b/nlohmann::basic_json::is_number.md deleted file mode 100644 index a7976cb..0000000 --- a/nlohmann::basic_json::is_number.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_number() const; -``` - -## Description - -Returns whether JSON container has type number. - -## Parameters - -None. - -## Return value - -`true` of value type is number, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_number() << '\n'; - std::cout << std::boolalpha << j_boolean.is_number() << '\n'; - std::cout << std::boolalpha << j_number.is_number() << '\n'; - std::cout << std::boolalpha << j_object.is_number() << '\n'; - std::cout << std::boolalpha << j_array.is_number() << '\n'; - std::cout << std::boolalpha << j_string.is_number() << '\n'; -} -``` - -### Output - -``` -false -false -true -false -false -false -``` - -## See also - -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string diff --git a/nlohmann::basic_json::is_object.md b/nlohmann::basic_json::is_object.md deleted file mode 100644 index c873a3f..0000000 --- a/nlohmann::basic_json::is_object.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_object() const; -``` - -## Description - -Returns whether JSON container has type object. - -## Parameters - -None. - -## Return value - -`true` of value type is object, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_object() << '\n'; - std::cout << std::boolalpha << j_boolean.is_object() << '\n'; - std::cout << std::boolalpha << j_number.is_object() << '\n'; - std::cout << std::boolalpha << j_object.is_object() << '\n'; - std::cout << std::boolalpha << j_array.is_object() << '\n'; - std::cout << std::boolalpha << j_string.is_object() << '\n'; -} -``` - -### Output - -``` -false -false -false -true -false -false -``` - -## See also - -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array -- [**is_string**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_string)
- whether value is string diff --git a/nlohmann::basic_json::is_string.md b/nlohmann::basic_json::is_string.md deleted file mode 100644 index 5e55d0c..0000000 --- a/nlohmann::basic_json::is_string.md +++ /dev/null @@ -1,71 +0,0 @@ -```cpp -bool is_string() const; -``` - -## Description - -Returns whether JSON container has type string. - -## Parameters - -None. - -## Return value - -`true` of value type is string, `false` otherwise. - -## Complexity - -Constant. - -## Exceptions - -None. The function's noexcept-specification is `noexcept`. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json j_null; - nlohmann::json j_boolean = true; - nlohmann::json j_number = 17; - nlohmann::json j_object = {{"one", 1}, {"two", 2}}; - nlohmann::json j_array = {1, 2, 4, 8, 16}; - nlohmann::json j_string = "Hello, world"; - - std::cout << std::boolalpha << j_null.is_string() << '\n'; - std::cout << std::boolalpha << j_boolean.is_string() << '\n'; - std::cout << std::boolalpha << j_number.is_string() << '\n'; - std::cout << std::boolalpha << j_object.is_string() << '\n'; - std::cout << std::boolalpha << j_array.is_string() << '\n'; - std::cout << std::boolalpha << j_string.is_string() << '\n'; -} -``` - -### Output - -``` -false -false -false -false -false -true -``` - -## See also - -- [**is_null**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_null)
- whether value is null -- [**is_boolean**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_boolean)
- whether value is boolean -- [**is_number**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_number)
- whether value is number -- [**is_object**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_object)
- whether value is object -- [**is_array**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::is_array)
- whether value is array diff --git a/nlohmann::basic_json::max_size.md b/nlohmann::basic_json::max_size.md deleted file mode 100644 index 0e27204..0000000 --- a/nlohmann::basic_json::max_size.md +++ /dev/null @@ -1,61 +0,0 @@ -```cpp -size_type max_size() const; -``` - -## Description - -Returns the type-dependent maximum number of elements the JSON container is able to hold due to system or library implementation limitations, i.e. `std::distance(begin(), end())` for the largest container. - -## Return value - -The return value depends on the different value types and is defined as follows: - -| Value type | return value | -| ---------- | ------------------------ | -| null | `0` | -| boolean | `1` | -| string | `1` | -| number | `1` | -| object | `ObjectType::max_size()` | -| array | `ArrayType::max_size()` | - -## Parameter - -None. - -## 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`. - -## Notes - -This value is typically equal to `std::numeric_limits::max()`, and reflects the theoretical limit on the size of the container. At runtime, the size of the container may be limited to a value smaller than `max_size()` by the amount of RAM available. - -## Example - -```cpp -#include -#include - -int main() -{ - nlohmann::json array {"string", true, 17, 23.42}; - - std::cout << "Maximum size of a JSON array is " << array.max_size() << "\n"; -} -``` - -Output: - -``` -Maximum size of a JSON array is 1152921504606846975 -``` - -## See also - -- [**size**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::size)
-returns the number of elements \ No newline at end of file diff --git a/nlohmann::basic_json::operator-T().md b/nlohmann::basic_json::operator-T().md deleted file mode 100644 index 8792cbb..0000000 --- a/nlohmann::basic_json::operator-T().md +++ /dev/null @@ -1,55 +0,0 @@ -```cpp -template -operator T() const; -``` - -## Description - -Implicitly converts a value of a JSON container. - -## Parameters - -None. - -## Return value - -The return value is [`get()`](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::get). - -## Complexity - -Amortized linear in the size of the JSON type. - -## Exceptions - -`std::std::logic_error` if types are not compatible. - -## Example - -```cpp -#include -#include -#include -#include -#include -#include - -int main() -{ - nlohmann::json j1 = {1, 2, 3.2, 4.3, 5.4}; - std::vector v11 = j1; - std::list v12 = j1; - std::unordered_set v13 = j1; - - nlohmann::json j2 = {{"one", 1}, {"two", 2}, {"three", 3}}; - std::map v21 = j2; - std::multimap v22 = j2; - - nlohmann::json j3 = "Hello, world"; - std::string v31 = j3; -} -``` - -## See also - -- [**get**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::get)
- explicit value conversion diff --git a/nlohmann::basic_json::operator=.md b/nlohmann::basic_json::operator=.md deleted file mode 100644 index 1728db4..0000000 --- a/nlohmann::basic_json::operator=.md +++ /dev/null @@ -1,30 +0,0 @@ -```cpp -reference& operator=(basic_json other) -``` - -## Description - -Replaces the contents with a copy of `other`. In case `other` is an rvalue, its value is moved. - -## Parameters - -- `other`: container to copy - -## Return value - -`*this` - -## Complexity - -Linear in the size of `other`. If `other` is an rvalue, the operation has constant complexity. - -## Exceptions - -The function's noexcept-specification is: - -```cpp -std::is_nothrow_move_constructible::value and -std::is_nothrow_move_assignable::value and -std::is_nothrow_move_constructible::value and -std::is_nothrow_move_assignable::value -``` \ No newline at end of file diff --git a/nlohmann::basic_json::operator[].md b/nlohmann::basic_json::operator[].md deleted file mode 100644 index 3ce8c20..0000000 --- a/nlohmann::basic_json::operator[].md +++ /dev/null @@ -1,36 +0,0 @@ -```cpp -reference operator[](size_type idx); // 1 -const_reference operator[](size_type idx) const; // 2 -``` -```cpp -reference operator[](const object_t::key_type& key) // 3 -const_reference operator[](const object_t::key_type& key) const // 4 -``` - -## Description - -1. Returns a reference to the element at specified index `idx`. In case `idx > size()`, null values are inserted between `size()` and `idx` before (only works for arrays). -2. Returns a reference to the element at specified index `idx`. No bounds checking is performed and no values will be inserted (only works for arrays). -3. Returns a reference to the value that is mapped to a key equivalent to `key`, performing an insertion of a null value if such key does not already exist and returns a reference to this value (only works for objects). -4. Returns a reference to the mapped value of the element with key equivalent to `key`. No bounds checking is performed and no values will be inserted (only works for objects). - -## Parameters - -- `idx`: index of the element to return -- `key`: key of the element to return - -## Return value - -Reference to the specified value. In case of 1 and 3, the reference may be to a newly inserted null value. - -## Complexity - -1. Linear in the distance between `size()` and `idx` if `idx > size()`, constant otherwise. -2. Constant. -3. Logarithmic in the size of the container. -4. Logarithmic in the size of the container. - -## Exceptions - -1. `std::runtime_error` when called on a JSON container with other type than `array`. -2. `std::runtime_error` when called on a JSON container with other type than `object`. \ No newline at end of file diff --git a/nlohmann::basic_json::rbegin.md b/nlohmann::basic_json::rbegin.md deleted file mode 100644 index 5d967d3..0000000 --- a/nlohmann::basic_json::rbegin.md +++ /dev/null @@ -1,32 +0,0 @@ -```cpp -iterator rbegin(); -const_iterator rbegin() const; -const_iterator crbegin() const; -``` - -## Description - -Returns a reverse iterator to the first element of the reversed JSON container. It corresponds to the last element of the non-reversed container. - -![illustration of reverse iterators](http://upload.cppreference.com/mwiki/images/3/39/range-rbegin-rend.svg) - -## Parameters - -None. - -## Return value - -Reverse iterator to the first element. - -## 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 - -- [**rend**, **crend**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::rend)
- returns a reverse iterator to the end diff --git a/nlohmann::basic_json::rend.md b/nlohmann::basic_json::rend.md deleted file mode 100644 index 2776a0d..0000000 --- a/nlohmann::basic_json::rend.md +++ /dev/null @@ -1,32 +0,0 @@ -```cpp -iterator rend(); -const_iterator rend() const; -const_iterator crend() const; -``` - -## Description - -Returns a reverse iterator to the element following the last element of the reversed JSON container. It corresponds to the element preceding the first element of the non-reversed container. This element acts as a placeholder, attempting to access it results in undefined behavior. - -![illustration of reverse iterators](http://upload.cppreference.com/mwiki/images/3/39/range-rbegin-rend.svg) - -## Parameters - -None. - -## Return value - -Reverse iterator to the element following the last element. - -## 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 - -- [**rbegin**, **crbegin**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::rbegin)
- returns a reverse iterator to the beginning diff --git a/nlohmann::basic_json::size.md b/nlohmann::basic_json::size.md deleted file mode 100644 index 84e669e..0000000 --- a/nlohmann::basic_json::size.md +++ /dev/null @@ -1,61 +0,0 @@ -```cpp -size_type size() const; -``` - -## Description - -Returns the number of elements of a JSON value, i.e. `std::distance(begin(), end())`. - -## Return value - -The return value depends on the different value types and is defined as follows: - -| Value type | return value | -| ---------- | -------------------- | -| null | `0` | -| boolean | `1` | -| string | `1` | -| number | `1` | -| object | `ObjectType::size()` | -| array | `ArrayType::size()` | - -## Parameter - -None. - -## 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`. - -## Example - -The following code uses empty to check if a `nlohmann::json` contains any elements: - -```cpp -#include -#include - -int main() -{ - nlohmann::json values {"string", true, 17, 23.42}; - - std::cout << "values contains " << values.size() << " elements.\n"; -} -``` - -Output: - -``` -values contains 4 elements. -``` - -## See also - -- [**empty**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::empty)
-checks whether the container is empty -- [**max_size**](https://github.com/nlohmann/json/wiki/nlohmann::basic_json::max_size)
-returns the maximum possible number of elements \ No newline at end of file diff --git a/nlohmann::basic_json::~basic_json.md b/nlohmann::basic_json::~basic_json.md deleted file mode 100644 index 32dbc24..0000000 --- a/nlohmann::basic_json::~basic_json.md +++ /dev/null @@ -1,11 +0,0 @@ -```cpp -~basic_json(); -``` - -## Description - -Destructs the container. The destructors of the elements are called and the used storage is deallocated. - -## Complexity - -Linear in the size of the container.