1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-06 06:42:33 +03:00

📝 add more API documentation

This commit is contained in:
Niels Lohmann
2020-08-13 14:04:08 +02:00
parent d360fec216
commit ce6adc447a
6 changed files with 97 additions and 3 deletions

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.