🚨 fix linter warnings
This commit is contained in:
parent
df7b521fcd
commit
d54fd35355
@ -35,3 +35,7 @@ Copy of the JSON value, converted to `ValueType`
|
|||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
This documentation page is a stub.
|
This documentation page is a stub.
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 2.1.0.
|
||||||
|
|||||||
@ -29,3 +29,7 @@ struct adl_serializer {
|
|||||||
|
|
||||||
- [**from_json**](from_json.md) - convert a JSON value to any value type
|
- [**from_json**](from_json.md) - convert a JSON value to any value type
|
||||||
- [**to_json**](to_json.md) - convert any value type to a JSON value
|
- [**to_json**](to_json.md) - convert any value type to a JSON value
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 2.1.0.
|
||||||
|
|||||||
@ -20,3 +20,7 @@ This function is usually called by the constructors of the [basic_json](../basic
|
|||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
This documentation page is a stub.
|
This documentation page is a stub.
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 2.1.0.
|
||||||
|
|||||||
@ -35,6 +35,10 @@ const_reference at(const json_pointer& ptr) const;
|
|||||||
2. reference to the element at key `key`
|
2. reference to the element at key `key`
|
||||||
3. reference to the element pointed to by `ptr`
|
3. reference to the element pointed to by `ptr`
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. The function can throw the following exceptions:
|
1. The function can throw the following exceptions:
|
||||||
@ -62,17 +66,13 @@ const_reference at(const json_pointer& ptr) const;
|
|||||||
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
||||||
not be resolved. See example below.
|
not be resolved. See example below.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong exception safety: if an exception occurs, the original value stays intact.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
1. Constant
|
1. Constant
|
||||||
2. Logarithmic in the size of the container.
|
2. Logarithmic in the size of the container.
|
||||||
3. Constant
|
3. Constant
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) access specified array element with bounds checking"
|
??? example "Example: (1) access specified array element with bounds checking"
|
||||||
|
|
||||||
|
|||||||
@ -20,26 +20,26 @@ return *tmp;
|
|||||||
In case of a structured type (array or object), a reference to the last element is returned. In case of number, string,
|
In case of a structured type (array or object), a reference to the last element is returned. In case of number, string,
|
||||||
boolean, or binary values, a reference to the value is returned.
|
boolean, or binary values, a reference to the value is returned.
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
If the JSON value is `#!json null`, exception
|
If the JSON value is `#!json null`, exception
|
||||||
[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown.
|
[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
!!! danger
|
!!! danger
|
||||||
|
|
||||||
Calling `back` on an empty array or object is undefined behavior and is **guarded by an assertion**!
|
Calling `back` on an empty array or object is undefined behavior and is **guarded by an assertion**!
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -183,6 +183,22 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
`other` (in)
|
`other` (in)
|
||||||
: the JSON value to copy/move
|
: the JSON value to copy/move
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
2. No-throw guarantee: this constructor never throws exceptions.
|
||||||
|
3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
||||||
|
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
||||||
|
JSON value.
|
||||||
|
4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
||||||
|
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
||||||
|
JSON value.
|
||||||
|
5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
7. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
8. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
9. No-throw guarantee: this constructor never throws exceptions.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. /
|
1. /
|
||||||
@ -207,22 +223,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
8. /
|
8. /
|
||||||
9. The function does not throw exceptions.
|
9. The function does not throw exceptions.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
2. No-throw guarantee: this constructor never throws exceptions.
|
|
||||||
3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
|
||||||
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
|
||||||
JSON value.
|
|
||||||
4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
|
||||||
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
|
||||||
JSON value.
|
|
||||||
5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
7. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
8. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
9. No-throw guarantee: this constructor never throws exceptions.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
1. Constant.
|
1. Constant.
|
||||||
@ -275,7 +275,7 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
- `#!cpp `*this` has the same value as `other` before the call.
|
- `#!cpp `*this` has the same value as `other` before the call.
|
||||||
- `other` is a JSON `#!json null` value
|
- `other` is a JSON `#!json null` value
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) create an empty value with a given type"
|
??? example "Example: (1) create an empty value with a given type"
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Linear in the size of the JSON value.
|
|||||||
|
|
||||||
All iterators, pointers and references related to this container are invalidated.
|
All iterators, pointers and references related to this container are invalidated.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
If `#!cpp j.contains(x)` returns `#!c true` for a key or JSON pointer `x`, then it is safe to call `j[x]`.
|
If `#!cpp j.contains(x)` returns `#!c true` for a key or JSON pointer `x`, then it is safe to call `j[x]`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example (1) check with key"
|
??? example "Example (1) check with key"
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
This method always returns `0` when executed on a JSON type that is not an object.
|
This method always returns `0` when executed on a JSON type that is not an object.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -33,11 +33,11 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
|
|
||||||
Linear in the lengths of `source` and `target`.
|
Linear in the lengths of `source` and `target`.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
Currently, only `remove`, `add`, and `replace` operations are generated.
|
Currently, only `remove`, `add`, and `replace` operations are generated.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -34,15 +34,15 @@ and `ensure_ascii` parameters.
|
|||||||
|
|
||||||
string containing the serialization of the JSON value
|
string containing the serialization of the JSON value
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
||||||
is not UTF-8 encoded and `error_handler` is set to `strict`
|
is not UTF-8 encoded and `error_handler` is set to `strict`
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
@ -54,7 +54,7 @@ Binary values are serialized as object containing two keys:
|
|||||||
- "bytes": an array of bytes as integers
|
- "bytes": an array of bytes as integers
|
||||||
- "subtype": the subtype as integer or `#!json null` if the binary has no subtype
|
- "subtype": the subtype as integer or `#!json null` if the binary has no subtype
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ bool empty() const noexcept
|
|||||||
This function does not return whether a string stored as JSON value is empty -- it returns whether the JSON container
|
This function does not return whether a string stored as JSON value is empty -- it returns whether the JSON container
|
||||||
itself is empty which is `#!cpp false` in the case of a string.
|
itself is empty which is `#!cpp false` in the case of a string.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,10 @@ void erase(const size_type idx);
|
|||||||
(`key` was not found) or `1` (`key` was found).
|
(`key` was not found) or `1` (`key` was found).
|
||||||
4. /
|
4. /
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. The function can throw the following exceptions:
|
1. The function can throw the following exceptions:
|
||||||
@ -85,10 +89,6 @@ void erase(const size_type idx);
|
|||||||
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) when `idx >= size()`; example:
|
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) when `idx >= size()`; example:
|
||||||
`"array index 17 is out of range"`
|
`"array index 17 is out of range"`
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong exception safety: if an exception occurs, the original value stays intact.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
1. The complexity depends on the type:
|
1. The complexity depends on the type:
|
||||||
@ -112,7 +112,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
3. References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
|
3. References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
|
||||||
4. /
|
4. /
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) remove element given an iterator"
|
??? example "Example: (1) remove element given an iterator"
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Subclasses:
|
|||||||
|
|
||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
This method always returns `end()` when executed on a JSON type that is not an object.
|
This method always returns `end()` when executed on a JSON type that is not an object.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Linear in the size the JSON value.
|
|||||||
Empty objects and arrays are flattened to `#!json null` and will not be reconstructed correctly by the
|
Empty objects and arrays are flattened to `#!json null` and will not be reconstructed correctly by the
|
||||||
[`unflatten()`](unflatten.md) function.
|
[`unflatten()`](unflatten.md) function.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -56,20 +56,20 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
||||||
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Throws [`parse_error.114`](../../home/exceptions.md#jsonexceptionparse_error114) if an unsupported BSON record type is
|
Throws [`parse_error.114`](../../home/exceptions.md#jsonexceptionparse_error114) if an unsupported BSON record type is
|
||||||
encountered.
|
encountered.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of the input.
|
Linear in the size of the input.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
||||||
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
@ -72,15 +76,11 @@ deserialized JSON value; in case of a parse error and `allow_exceptions` set to
|
|||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key,
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key,
|
||||||
but not found
|
but not found
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of the input.
|
Linear in the size of the input.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
||||||
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
@ -65,15 +69,11 @@ deserialized JSON value; in case of a parse error and `allow_exceptions` set to
|
|||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key,
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key,
|
||||||
but not found
|
but not found
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of the input.
|
Linear in the size of the input.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
||||||
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
@ -64,15 +68,11 @@ deserialized JSON value; in case of a parse error and `allow_exceptions` set to
|
|||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
||||||
successfully
|
successfully
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of the input.
|
Linear in the size of the input.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -13,26 +13,26 @@ Returns a reference to the first element in the container. For a JSON container
|
|||||||
In case of a structured type (array or object), a reference to the first element is returned. In case of number, string,
|
In case of a structured type (array or object), a reference to the first element is returned. In case of number, string,
|
||||||
boolean, or binary values, a reference to the value is returned.
|
boolean, or binary values, a reference to the value is returned.
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
If the JSON value is `#!json null`, exception
|
If the JSON value is `#!json null`, exception
|
||||||
[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown.
|
[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
!!! danger
|
!!! danger
|
||||||
|
|
||||||
Calling `front` on an empty array or object is undefined behavior and is **guarded by an assertion**!
|
Calling `front` on an empty array or object is undefined behavior and is **guarded by an assertion**!
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
|||||||
|
|
||||||
Writing data to the pointee (overload 3) of the result yields an undefined state.
|
Writing data to the pointee (overload 3) of the result yields an undefined state.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ constexpr const PointerType get_ptr() const noexcept;
|
|||||||
|
|
||||||
Implicit pointer access to the internally stored JSON value. No copies are made.
|
Implicit pointer access to the internally stored JSON value. No copies are made.
|
||||||
|
|
||||||
## Template arguments
|
## Template parameters
|
||||||
|
|
||||||
`PointerType`
|
`PointerType`
|
||||||
: pointer type; must be a pointer to [`array_t`](array_t.md), [`object_t`](object_t.md), [`string_t`](string_t.md),
|
: pointer type; must be a pointer to [`array_t`](array_t.md), [`object_t`](object_t.md), [`string_t`](string_t.md),
|
||||||
@ -37,7 +37,7 @@ Constant.
|
|||||||
|
|
||||||
Writing data to the pointee of the result yields an undefined state.
|
Writing data to the pointee of the result yields an undefined state.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const ReferenceType get_ref() const;
|
|||||||
|
|
||||||
Implicit reference access to the internally stored JSON value. No copies are made.
|
Implicit reference access to the internally stored JSON value. No copies are made.
|
||||||
|
|
||||||
## Template arguments
|
## Template parameters
|
||||||
|
|
||||||
`ReferenceType`
|
`ReferenceType`
|
||||||
: reference type; must be a reference to [`array_t`](array_t.md), [`object_t`](object_t.md),
|
: reference type; must be a reference to [`array_t`](array_t.md), [`object_t`](object_t.md),
|
||||||
@ -42,7 +42,7 @@ Constant.
|
|||||||
|
|
||||||
Writing data to the referee of the result yields an undefined state.
|
Writing data to the referee of the result yields an undefined state.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ the input parameter, allowing chaining calls
|
|||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -296,3 +296,7 @@ Access to the JSON value
|
|||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259)
|
- [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259)
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@ -52,6 +52,10 @@ void insert(const_iterator first, const_iterator last);
|
|||||||
4. iterator pointing to the first element inserted, or `pos` if `ilist` is empty
|
4. iterator pointing to the first element inserted, or `pos` if `ilist` is empty
|
||||||
5. /
|
5. /
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. The function can throw the following exceptions:
|
1. The function can throw the following exceptions:
|
||||||
@ -86,10 +90,6 @@ void insert(const_iterator first, const_iterator last);
|
|||||||
- Throws [`invalid_iterator.210`](../../home/exceptions.md#jsonexceptioninvalid_iterator210) if `first` and `last`
|
- Throws [`invalid_iterator.210`](../../home/exceptions.md#jsonexceptioninvalid_iterator210) if `first` and `last`
|
||||||
do not belong to the same JSON value; example: `"iterators do not fit"`
|
do not belong to the same JSON value; example: `"iterators do not fit"`
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong exception safety: if an exception occurs, the original value stays intact.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
1. Constant plus linear in the distance between `pos` and end of the container.
|
1. Constant plus linear in the distance between `pos` and end of the container.
|
||||||
@ -98,7 +98,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
4. Linear in `ilist.size()` plus linear in the distance between `pos` and end of the container.
|
4. Linear in `ilist.size()` plus linear in the distance between `pos` and end of the container.
|
||||||
5. Logarithmic: `O(N*log(size() + N))`, where `N` is the number of elements to insert.
|
5. Logarithmic: `O(N*log(size() + N))`, where `N` is the number of elements to insert.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example (1): insert element into array"
|
??? example "Example (1): insert element into array"
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class basic_json::invalid_iterator #FFFF00 {}
|
|||||||
|
|
||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ Constant.
|
|||||||
This function will always be `#!cpp false` for JSON values after parsing. That is, discarded values can only occur
|
This function will always be `#!cpp false` for JSON values after parsing. That is, discarded values can only occur
|
||||||
during parsing, but will be removed when inside a structured value or replaced by null in other cases.
|
during parsing, but will be removed when inside a structured value or replaced by null in other cases.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ constexpr bool is_number() const noexcept
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ The term *primitive* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259):
|
|||||||
This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence,
|
This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence,
|
||||||
`is_primitive()` returns `#!cpp true` for binary values.
|
`is_primitive()` returns `#!cpp true` for binary values.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ The term *structured* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259)
|
|||||||
|
|
||||||
Note that though strings are containers in C++, they are treated as primitive values in JSON.
|
Note that though strings are containers in C++, they are treated as primitive values in JSON.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ When iterating over an array, `key()` will return the index of the element as st
|
|||||||
Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exeeds the iteration. See
|
Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exeeds the iteration. See
|
||||||
<https://github.com/nlohmann/json/issues/2040> for more information.
|
<https://github.com/nlohmann/json/issues/2040> for more information.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ constant complexity.
|
|||||||
This function does not return the maximal length of a string stored as JSON value -- it returns the maximal number of
|
This function does not return the maximal length of a string stored as JSON value -- it returns the maximal number of
|
||||||
string elements the JSON value can store which is `1`.
|
string elements the JSON value can store which is `1`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Thereby, `Target` is the current object; that is, the patch is applied to the cu
|
|||||||
|
|
||||||
Linear in the lengths of `apply_patch`.
|
Linear in the lengths of `apply_patch`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Strong guarantee: if an exception is thrown, there are no changes to any JSON va
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,10 @@ elements must be strings. If the initializer list is empty, the empty object `#!
|
|||||||
|
|
||||||
JSON object value
|
JSON object value
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Throws [`type_error.301`](../../home/exceptions.md#jsonexceptiontype_error301) if `init` is not a list of pairs whose
|
Throws [`type_error.301`](../../home/exceptions.md#jsonexceptiontype_error301) if `init` is not a list of pairs whose
|
||||||
@ -23,10 +27,6 @@ first elements are strings. In this case, no object can be created. When such a
|
|||||||
`basic_json(initializer_list_t, bool, value_t)`, an array would have been created from the passed initializer list
|
`basic_json(initializer_list_t, bool, value_t)`, an array would have been created from the passed initializer list
|
||||||
`init`. See example below.
|
`init`. See example below.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of `init`.
|
Linear in the size of `init`.
|
||||||
|
|||||||
@ -21,7 +21,7 @@ constructor, destructor, and the `swap()` member function.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,10 @@ const_reference operator[](const json_pointer& ptr) const;
|
|||||||
2. reference to the element at key `key`
|
2. reference to the element at key `key`
|
||||||
3. reference to the element pointed to by `ptr`
|
3. reference to the element pointed to by `ptr`
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. The function can throw the following exceptions:
|
1. The function can throw the following exceptions:
|
||||||
@ -62,6 +66,12 @@ const_reference operator[](const json_pointer& ptr) const;
|
|||||||
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
||||||
not be resolved.
|
not be resolved.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
1. Constant if `idx` is in the range of the array. Otherwise, linear in `idx - size()`.
|
||||||
|
2. Logarithmic in the size of the container.
|
||||||
|
3. Constant
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
!!! danger
|
!!! danger
|
||||||
@ -87,17 +97,7 @@ const_reference operator[](const json_pointer& ptr) const;
|
|||||||
filled with `#!json null`.
|
filled with `#!json null`.
|
||||||
- The special value `-` is treated as a synonym for the index past the end.
|
- The special value `-` is treated as a synonym for the index past the end.
|
||||||
|
|
||||||
## Exception safety
|
## Examples
|
||||||
|
|
||||||
Strong exception safety: if an exception occurs, the original value stays intact.
|
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
1. Constant if `idx` is in the range of the array. Otherwise, linear in `idx - size()`.
|
|
||||||
2. Logarithmic in the size of the container.
|
|
||||||
3. Constant
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
??? example "Example (1): access specified array element"
|
??? example "Example (1): access specified array element"
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ explicit operator ValueType() const;
|
|||||||
That is, implicit conversions can be switched off by defining
|
That is, implicit conversions can be switched off by defining
|
||||||
[`JSON_USE_IMPLICIT_CONVERSIONS`](../../features/macros.md#json_use_implicit_conversions) to `0`.
|
[`JSON_USE_IMPLICIT_CONVERSIONS`](../../features/macros.md#json_use_implicit_conversions) to `0`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ Linear.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ No-throw guarantee: this function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ No-throw guarantee: this function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -29,11 +29,11 @@ the stream `i`
|
|||||||
|
|
||||||
Linear in the length of the input. The parser is a predictive LL(1) parser.
|
Linear in the length of the input. The parser is a predictive LL(1) parser.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
A UTF-8 byte order mark is silently ignored.
|
A UTF-8 byte order mark is silently ignored.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ No-throw guarantee: this function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ No-throw guarantee: this function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ is not UTF-8 encoded. Note that unlike the [`dump`](dump.md) member functions, n
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ No-throw guarantee: this function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
The example demonstrates comparing several JSON
|
The example demonstrates comparing several JSON
|
||||||
types.
|
types.
|
||||||
|
|||||||
@ -31,7 +31,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class basic_json::other_error #FFFF00 {}
|
|||||||
|
|
||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class basic_json::out_of_range #FFFF00 {}
|
|||||||
|
|
||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,12 +38,12 @@ class basic_json::parse_error #FFFF00 {
|
|||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
- **byte** - byte index of the parse error
|
- **byte** - byte index of the parse error
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
For an input with _n_ bytes, 1 is the index of the first character and _n_+1 is the index of the terminating null byte
|
For an input with _n_ bytes, 1 is the index of the first character and _n_+1 is the index of the terminating null byte
|
||||||
or the end of file. This also holds true when reading a byte vector for binary formats.
|
or the end of file. This also holds true when reading a byte vector for binary formats.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ The parser callback distinguishes the following events:
|
|||||||
- `array_end`: the parser read `]` and finished processing a JSON array
|
- `array_end`: the parser read `]` and finished processing a JSON array
|
||||||
- `value`: the parser finished reading a JSON value
|
- `value`: the parser finished reading a JSON value
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,10 @@ the patch.
|
|||||||
|
|
||||||
patched document
|
patched document
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [`parse_error.104`](../../home/exceptions.md#jsonexceptionparse_error104) if the JSON patch does not consist of
|
- Throws [`parse_error.104`](../../home/exceptions.md#jsonexceptionparse_error104) if the JSON patch does not consist of
|
||||||
@ -31,21 +35,17 @@ patched document
|
|||||||
- Throws [`out_of_range.501`](../../home/exceptions.md#jsonexceptionother_error501) if "test" operation was
|
- Throws [`out_of_range.501`](../../home/exceptions.md#jsonexceptionother_error501) if "test" operation was
|
||||||
unsuccessful.
|
unsuccessful.
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is
|
Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is
|
||||||
affected by the patch, the complexity can usually be neglected.
|
affected by the patch, the complexity can usually be neglected.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception
|
The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception
|
||||||
is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value.
|
is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ constant complexity.
|
|||||||
This function does not return the length of a string stored as JSON value -- it returns the number of elements in the
|
This function does not return the length of a string stored as JSON value -- it returns the number of elements in the
|
||||||
JSON value which is `1` in the case of a string.
|
JSON value which is `1` in the case of a string.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ void swap(typename binary_t::container_type& other);
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example: Swap JSON value (1, 2)"
|
??? example "Example: Swap JSON value (1, 2)"
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
|
|
||||||
Linear in the size of the JSON value `j`.
|
Linear in the size of the JSON value `j`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
|
|
||||||
Linear in the size of the JSON value `j`.
|
Linear in the size of the JSON value `j`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
|
|
||||||
Linear in the size of the JSON value `j`.
|
Linear in the size of the JSON value `j`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -16,15 +16,15 @@ This function implements a user-defined to_string for JSON objects.
|
|||||||
|
|
||||||
string containing the serialization of the JSON value
|
string containing the serialization of the JSON value
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
||||||
is not UTF-8 encoded
|
is not UTF-8 encoded
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
|
|
||||||
Linear in the size of the JSON value `j`.
|
Linear in the size of the JSON value `j`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class basic_json::type_error #FFFF00 {}
|
|||||||
|
|
||||||
- **id** - the id of the exception
|
- **id** - the id of the exception
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Constant.
|
Constant.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,10 @@ The function restores the arbitrary nesting of a JSON value that has been flatte
|
|||||||
|
|
||||||
the original JSON from a flattened version
|
the original JSON from a flattened version
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
The function can throw the following exceptions:
|
The function can throw the following exceptions:
|
||||||
@ -22,10 +26,6 @@ The function can throw the following exceptions:
|
|||||||
- Throws [`type_error.314`](../../home/exceptions.md#jsonexceptiontype_error314) if value is not an object
|
- Throws [`type_error.314`](../../home/exceptions.md#jsonexceptiontype_error314) if value is not an object
|
||||||
- Throws [`type_error.315`](../../home/exceptions.md#jsonexceptiontype_error315) if object values are not primitive
|
- Throws [`type_error.315`](../../home/exceptions.md#jsonexceptiontype_error315) if object values are not primitive
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong exception safety: if an exception occurs, the original value stays intact.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size the JSON value.
|
Linear in the size the JSON value.
|
||||||
@ -36,7 +36,7 @@ Empty objects and arrays are flattened by [`flatten()`](flatten.md) to `#!json n
|
|||||||
their original type. Apart from this example, for a JSON value `j`, the following is always true:
|
their original type. Apart from this example, for a JSON value `j`, the following is always true:
|
||||||
`#!cpp j == j.flatten().unflatten()`.
|
`#!cpp j == j.flatten().unflatten()`.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ function.
|
|||||||
1. O(N*log(size() + N)), where N is the number of elements to insert.
|
1. O(N*log(size() + N)), where N is the number of elements to insert.
|
||||||
2. O(N*log(size() + N)), where N is the number of elements to insert.
|
2. O(N*log(size() + N)), where N is the number of elements to insert.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ changes to any JSON value.
|
|||||||
1. Logarithmic in the size of the container.
|
1. Logarithmic in the size of the container.
|
||||||
2. Logarithmic in the size of the container.
|
2. Logarithmic in the size of the container.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
??? example "Example (1): access specified object element with default value"
|
??? example "Example (1): access specified object element with default value"
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ functions [`is_null`](is_null.md), [`is_object`](is_object.md), [`is_array`](is_
|
|||||||
[`is_discarded`](is_discarded.md), [`is_binary`](is_binary.md), [`is_primitive`](is_primitive.md), and
|
[`is_discarded`](is_discarded.md), [`is_binary`](is_binary.md), [`is_primitive`](is_primitive.md), and
|
||||||
[`is_structured`](is_structured.md) rely on it.
|
[`is_structured`](is_structured.md) rely on it.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library
|
There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library
|
||||||
distinguishes these three types for numbers: [`number_unsigned_t`](number_unsigned_t.md) is used for unsigned integers,
|
distinguishes these three types for numbers: [`number_unsigned_t`](number_unsigned_t.md) is used for unsigned integers,
|
||||||
|
|||||||
@ -25,3 +25,6 @@ byte_container_with_subtype(container_type&& container, subtype_type subtype);
|
|||||||
`subtype` (in)
|
`subtype` (in)
|
||||||
: subtype
|
: subtype
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
Since version 3.8.0.
|
||||||
|
|||||||
@ -7,14 +7,14 @@ void clear_subtype() noexcept;
|
|||||||
Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for
|
Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for
|
||||||
instance MessagePack will prefer the bin family over the ext family.
|
instance MessagePack will prefer the bin family over the ext family.
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Constant.
|
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
No-throw guarantee: this function never throws exceptions.
|
No-throw guarantee: this function never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
Since version 3.8.0.
|
Since version 3.8.0.
|
||||||
|
|||||||
@ -10,14 +10,14 @@ Returns whether the value has a subtype.
|
|||||||
|
|
||||||
whether the value has a subtype
|
whether the value has a subtype
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Constant.
|
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
No-throw guarantee: this function never throws exceptions.
|
No-throw guarantee: this function never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
Since version 3.8.0.
|
Since version 3.8.0.
|
||||||
|
|||||||
@ -12,14 +12,14 @@ serialization.
|
|||||||
`subtype` (in)
|
`subtype` (in)
|
||||||
: subtype to set
|
: subtype to set
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Constant.
|
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
No-throw guarantee: this function never throws exceptions.
|
No-throw guarantee: this function never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
Since version 3.8.0.
|
Since version 3.8.0.
|
||||||
|
|||||||
@ -11,14 +11,14 @@ Returns the numerical subtype of the value if it has a subtype. If it does not h
|
|||||||
|
|
||||||
the numerical subtype of the binary value, or `subtype_type(-1)` if no subtype is set
|
the numerical subtype of the binary value, or `subtype_type(-1)` if no subtype is set
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Constant.
|
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
No-throw guarantee: this function never throws exceptions.
|
No-throw guarantee: this function never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.8.0
|
- Added in version 3.8.0
|
||||||
|
|||||||
@ -22,3 +22,7 @@ class json_pointer;
|
|||||||
- **back** - return last reference token
|
- **back** - return last reference token
|
||||||
- **push_back** - append an unescaped token at the end of the pointer
|
- **push_back** - append an unescaped token at the end of the pointer
|
||||||
- **empty** - return whether pointer points to the root document
|
- **empty** - return whether pointer points to the root document
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
Added in version 2.0.0.
|
||||||
|
|||||||
@ -15,7 +15,7 @@ A binary value was read.
|
|||||||
|
|
||||||
Whether parsing should proceed.
|
Whether parsing should proceed.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
It is safe to move the passed binary value.
|
It is safe to move the passed binary value.
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ An object key was read.
|
|||||||
|
|
||||||
Whether parsing should proceed.
|
Whether parsing should proceed.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
It is safe to move the passed object key value.
|
It is safe to move the passed object key value.
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ The beginning of an array was read.
|
|||||||
|
|
||||||
Whether parsing should proceed.
|
Whether parsing should proceed.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
Binary formats may report the number of elements.
|
Binary formats may report the number of elements.
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ The beginning of an object was read.
|
|||||||
|
|
||||||
Whether parsing should proceed.
|
Whether parsing should proceed.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
Binary formats may report the number of elements.
|
Binary formats may report the number of elements.
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ A string value was read.
|
|||||||
|
|
||||||
Whether parsing should proceed.
|
Whether parsing should proceed.
|
||||||
|
|
||||||
## Note
|
## Notes
|
||||||
|
|
||||||
It is safe to move the passed string value.
|
It is safe to move the passed string value.
|
||||||
|
|
||||||
|
|||||||
61
doc/mkdocs/scripts/check_strcuture.py
Normal file
61
doc/mkdocs/scripts/check_strcuture.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
|
def check_structure():
|
||||||
|
expected_headers = [
|
||||||
|
'Specializations',
|
||||||
|
'Template parameters',
|
||||||
|
'Iterator invalidation',
|
||||||
|
'Requirements',
|
||||||
|
'Member types',
|
||||||
|
'Member functions',
|
||||||
|
'Member variables',
|
||||||
|
'Static functions',
|
||||||
|
'Non-member functions',
|
||||||
|
'Literals',
|
||||||
|
'Helper classes',
|
||||||
|
'Parameters',
|
||||||
|
'Return value',
|
||||||
|
'Exception safety',
|
||||||
|
'Exceptions',
|
||||||
|
'Complexity',
|
||||||
|
'Possible implementation',
|
||||||
|
'Notes',
|
||||||
|
'Examples',
|
||||||
|
'See also',
|
||||||
|
'Version history'
|
||||||
|
]
|
||||||
|
|
||||||
|
required_headers = [
|
||||||
|
'Version history'
|
||||||
|
]
|
||||||
|
|
||||||
|
for file in glob.glob('api/**/*.md', recursive=True):
|
||||||
|
with open(file) as file_content:
|
||||||
|
header_idx = -1
|
||||||
|
existing_headers = []
|
||||||
|
|
||||||
|
for lineno, line in enumerate(file_content.readlines()):
|
||||||
|
line = line.strip()
|
||||||
|
|
||||||
|
if line.startswith('## '):
|
||||||
|
header = line.strip('## ')
|
||||||
|
existing_headers.append(header)
|
||||||
|
|
||||||
|
if header in expected_headers:
|
||||||
|
idx = expected_headers.index(header)
|
||||||
|
if idx <= header_idx:
|
||||||
|
print(f'{file}:{lineno+1}: Error: header "{header}" is in an unexpected order (should be before "{expected_headers[header_idx]}")!')
|
||||||
|
header_idx = idx
|
||||||
|
else:
|
||||||
|
print(f'{file}:{lineno+1}: Error: header "{header}" is not part of the expected headers!')
|
||||||
|
|
||||||
|
for required_header in required_headers:
|
||||||
|
if required_header not in existing_headers:
|
||||||
|
print(f'{file}:{lineno+1}: Error: required header "{required_header}" was not found!')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
check_structure()
|
||||||
Loading…
Reference in New Issue
Block a user