Apply suggestions from code review

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
Niels Lohmann 2022-08-05 09:15:22 +02:00 committed by GitHub
parent 823877e426
commit efffa2876b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@ When the macro is not defined, the library will define it to its default value.
!!! hint "CMake option" !!! hint "CMake option"
The placement of user-defined string literals can also be controlled with the CMake option The placement of user-defined string literals can also be controlled with the CMake option
[`JSON_GlobalUDLs`](../../integration/cmake.md#json_globaludls) (`OFF` by default) which defines [`JSON_GlobalUDLs`](../../integration/cmake.md#json_globaludls) (`ON` by default) which defines
`JSON_USE_GLOBAL_UDLS` accordingly. `JSON_USE_GLOBAL_UDLS` accordingly.
## Examples ## Examples

View File

@ -101,7 +101,7 @@ The library uses the following mapping from JSON values types to BJData types ac
optimized array in UBJSON `[ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ]`, can be further compressed in BJData to optimized array in UBJSON `[ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ]`, can be further compressed in BJData to
`[$U#[$i#i2 2 3 1 2 3 4 5 6` or `[$U#[i2 i3] 1 2 3 4 5 6`. `[$U#[$i#i2 2 3 1 2 3 4 5 6` or `[$U#[i2 i3] 1 2 3 4 5 6`.
To maintina type and size information, ND-arrays are converted to JSON objects following the **annotated array To maintain type and size information, ND-arrays are converted to JSON objects following the **annotated array
format** (defined in the [JData specification (Draft 3)][JDataAAFmt]), when parsed using format** (defined in the [JData specification (Draft 3)][JDataAAFmt]), when parsed using
[`from_bjdata`](../../api/basic_json/from_bjdata.md). For example, the above 2-D `uint8` array can be parsed and [`from_bjdata`](../../api/basic_json/from_bjdata.md). For example, the above 2-D `uint8` array can be parsed and
accessed as accessed as

View File

@ -56,12 +56,12 @@ The library uses the following mapping from JSON values types to UBJSON types ac
!!! info "NaN/infinity handling" !!! info "NaN/infinity handling"
If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the
`dump()` function which serializes NaN or Infinity to `null`. `dump()` function which serializes NaN or Infinity to `null`.
!!! info "Optimized formats" !!! info "Optimized formats"
The optimized formats for containers are supported: Parameter `use_size` adds size information to the beginning of a The optimized formats for containers are supported: Parameter `use_size` adds size information to the beginning of a
container and removes the closing marker. Parameter `use_type` further checks whether all elements of a container container and removes the closing marker. Parameter `use_type` further checks whether all elements of a container
have the same type and adds the type marker to the beginning of the container. The `use_type` parameter must only be have the same type and adds the type marker to the beginning of the container. The `use_type` parameter must only be
used together with `use_size = true`. used together with `use_size = true`.
@ -71,7 +71,7 @@ The library uses the following mapping from JSON values types to UBJSON types ac
!!! info "Binary values" !!! info "Binary values"
If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON
documentation. In particular, this means that serialization and the deserialization of a JSON containing binary documentation. In particular, this means that serialization and the deserialization of a JSON containing binary
values into UBJSON and back will result in a different JSON object. values into UBJSON and back will result in a different JSON object.

View File

@ -23,8 +23,8 @@ In case exceptions are undesired or not supported by the environment, there are
## Switch off exceptions ## Switch off exceptions
The `parse()` function accepts as last parameter a `#!cpp bool` variable `allow_exceptions` which controls whether an The `parse()` function accepts a `#!cpp bool` parameter `allow_exceptions` which controls whether an exception is
exception is thrown when a parse error occurs (`#!cpp true`, default) or whether a discarded value should be returned thrown when a parse error occurs (`#!cpp true`, default) or whether a discarded value should be returned
(`#!cpp false`). (`#!cpp false`).
```cpp ```cpp

View File

@ -60,8 +60,8 @@ table describes the values of the parameters `depth`, `event`, and `parsed`.
## Return value ## Return value
Discarding a value (i.e., returning `#!c false`) has different effects depending on the context in which function was Discarding a value (i.e., returning `#!c false`) has different effects depending on the context in which the function
called: was called:
- Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never - Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never
read. read.