📝 add more API documentation

This commit is contained in:
Niels Lohmann 2020-08-13 14:04:08 +02:00
parent d360fec216
commit ce6adc447a
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
6 changed files with 97 additions and 3 deletions

View file

@ -47,6 +47,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('is_string', 'Method', 'api/ba
INSERT INTO searchIndex(name, type, path) VALUES ('is_structured', 'Method', 'api/basic_json/is_structured/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('items', 'Method', 'api/basic_json/items/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('json', 'Class', 'api/json/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer', 'Class', 'api/json_pointer/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('max_size', 'Method', 'api/basic_json/max_size/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('merge_patch', 'Method', 'api/basic_json/merge_patch/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('meta', 'Function', 'api/basic_json/meta/index.html');
@ -60,6 +61,8 @@ INSERT INTO searchIndex(name, type, path) VALUES ('operator+=', 'Operator', 'api
INSERT INTO searchIndex(name, type, path) VALUES ('operator=', 'Operator', 'api/basic_json/operator=/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('operator==', 'Operator', 'api/basic_json/operator==/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('operator[]', 'Operator', 'api/basic_json/operator[]/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json', 'Literal', 'api/basic_json/operator%22%22_json/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json_pointer', 'Literal', 'api/basic_json/operator%22%22_json_pointer/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('operator value_t', 'Operator', 'api/basic_json/operator_value_t/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_json', 'Class', 'api/ordered_json/index.html');
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map', 'Class', 'api/ordered_map/index.html');

View file

@ -49,7 +49,7 @@ Todo
## Member types
- [**value_t**](value_t.md) - the JSON type enumeration
- json_pointer
- [**json_pointer**](../json_pointer.md) - JSON Pointer implementation
- json_serializer
- [**error_handler_t**](error_handler_t.md) - type to choose behavior on decoding errors
- cbor_tag_handler_t
@ -245,8 +245,8 @@ Access to the JSON value
## Literals
- operator""_json
- operator""_json_pointer
- [**operator""_json**](operator%22%22_json.md) - user-defined string literal for JSON values
- [**operator""_json_pointer**](operator%22%22_json_pointer.md) - user-defined string literal for JSON pointers
## Helper classes

View file

@ -0,0 +1,32 @@
# basic_json::operator""_json
```cpp
json operator "" _json(const char* s, std::size_t n)
```
This operator implements a user-defined string literal for JSON objects. It can be used by adding `#!cpp _json` to a
string literal and returns a [`json`](../json.md) object if no parse error occurred.
## Parameters
`s` (in)
: a string representation of a JSON object
`n` (in)
: length of string `s`
## Return value
[`json`](../json.md) value parsed from `s`
## Exceptions
The function can throw anything that [`parse(s, s+n)`](parse.md) would throw.
## Complexity
Linear.
## Version history
- Added in version 1.0.0.

View file

@ -0,0 +1,32 @@
# basic_json::operator""_json_pointer
```cpp
json_pointer operator "" _json_pointer(const char* s, std::size_t n)
```
This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `#!cpp _json_pointer`
to a string literal and returns a [`json_pointer`](../json_pointer.md) object if no parse error occurred.
## Parameters
`s` (in)
: a string representation of a JSON Pointer
`n` (in)
: length of string `s`
## Return value
[`json_pointer`](../json_pointer.md) value parsed from `s`
## Exceptions
The function can throw anything that [`json_pointer::json_pointer`](../json_pointer.md) would throw.
## Complexity
Linear.
## Version history
- Added in version 2.0.0.

View file

@ -0,0 +1,24 @@
# json_pointer
```cpp
template<typename BasicJsonType>
class json_pointer;
```
## Template parameters
`BasicJsonType`
: a specialization of [`basic_json`](basic_json/index.md)
## Member functions
- (constructor)
- **to_string** - return a string representation of the JSON pointer
- **operator std::string**- return a string representation of the JSON pointer
- **operator/=** - append to the end of the JSON pointer
- **operator/** - create JSON Pointer by appending
- **parent_pointer** - returns the parent of this JSON pointer
- **pop_back** - remove last reference token
- **back** - return last reference token
- **push_back** - append an unescaped token at the end of the pointer
- **empty** - return whether pointer points to the root document

View file

@ -129,6 +129,8 @@ nav:
- api/basic_json/operator==.md
- api/basic_json/operator!=.md
- api/basic_json/operator+=.md
- api/basic_json/operator""_json.md
- api/basic_json/operator""_json_pointer.md
- api/basic_json/parse.md
- api/basic_json/parse_event_t.md
- api/basic_json/parser_callback_t.md
@ -146,6 +148,7 @@ nav:
- api/basic_json/value.md
- api/basic_json/value_t.md
- api/json.md
- api/json_pointer.md
- api/ordered_map.md
- api/ordered_json.md