keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/end.md | .md | 664 | 43 | # <small>nlohmann::basic_json::</small>end
```cpp
iterator end() noexcept;
const_iterator end() const noexcept;
```
Returns an iterator to one past the last element.

## Return value
iterator one past the last element
## Exception safety
No-t... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/back.md | .md | 1,324 | 66 | # <small>nlohmann::basic_json::</small>back
```cpp
reference back();
const_reference back() const;
```
Returns a reference to the last element in the container. For a JSON container `c`, the expression `c.back()` is
equivalent to
```cpp
auto tmp = c.end();
--tmp;
return *tmp;
```
## Return value
In case of a ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/operator_lt.md | .md | 2,599 | 97 | # <small>nlohmann::basic_json::</small>operator<
```cpp
// until C++20
bool operator<(const_reference lhs, const_reference rhs) noexcept; // (1)
template<typename ScalarType>
bool operator<(const_reference lhs, const ScalarType rhs) noexcept; // (2)
template<typename ScalarType>
bool operator<(ScalarType lhs, con... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/is_number.md | .md | 1,303 | 57 | # <small>nlohmann::basic_json::</small>is_number
```cpp
constexpr bool is_number() const noexcept;
```
This function returns `#!cpp true` if and only if the JSON value is a number. This includes both integer (signed and
unsigned) and floating-point values.
## Return value
`#!cpp true` if type is number (regardl... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/is_discarded.md | .md | 2,004 | 73 | # <small>nlohmann::basic_json::</small>is_discarded
```cpp
constexpr bool is_discarded() const noexcept;
```
This function returns `#!cpp true` for a JSON value if either:
- the value was discarded during parsing with a callback function (see [`parser_callback_t`](parser_callback_t.md)), or
- the value is the result... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/binary_t.md | .md | 3,559 | 90 | # <small>nlohmann::basic_json::</small>binary_t
```cpp
using binary_t = byte_container_with_subtype<BinaryType>;
```
This type is a type designed to carry binary data that appears in various serialized formats, such as CBOR's Major Type
2, MessagePack's bin, and BSON's generic binary subtype. This type is NOT a part ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/parser_callback_t.md | .md | 3,648 | 74 | # <small>nlohmann::basic_json::</small>parser_callback_t
```cpp
template<typename BasicJsonType>
using parser_callback_t =
std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
```
With a parser callback function, the result of parsing a JSON text can be influenced. When passed to
[`parse`](... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/get_ptr.md | .md | 1,531 | 61 | # <small>nlohmann::basic_json::</small>get_ptr
```cpp
template<typename PointerType>
PointerType get_ptr() noexcept;
template<typename PointerType>
constexpr const PointerType get_ptr() const noexcept;
```
Implicit pointer access to the internally stored JSON value. No copies are made.
## Template parameters
`Poin... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/from_bson.md | .md | 3,479 | 111 | # <small>nlohmann::basic_json::</small>from_bson
```cpp
// (1)
template<typename InputType>
static basic_json from_bson(InputType&& i,
const bool strict = true,
const bool allow_exceptions = true);
// (2)
template<typename IteratorType>
static basic_json from_bso... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/items.md | .md | 2,696 | 101 | # <small>nlohmann::basic_json::</small>items
```cpp
iteration_proxy<iterator> items() noexcept;
iteration_proxy<const_iterator> items() const noexcept;
```
This function allows accessing `iterator::key()` and `iterator::value()` during range-based for loops. In these loops, a
reference to the JSON values is returned,... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/binary.md | .md | 1,899 | 67 | # <small>nlohmann::basic_json::</small>binary
```cpp
// (1)
static basic_json binary(const typename binary_t::container_type& init);
static basic_json binary(typename binary_t::container_type&& init);
// (2)
static basic_json binary(const typename binary_t::container_type& init,
std::uint8_t ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/operator=.md | .md | 1,056 | 44 | # <small>nlohmann::basic_json::</small>operator=
```cpp
basic_json& operator=(basic_json other) noexcept (
std::is_nothrow_move_constructible<value_t>::value &&
std::is_nothrow_move_assignable<value_t>::value &&
std::is_nothrow_move_constructible<json_value>::value &&
std::is_nothrow_move_assignable<js... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/get_to.md | .md | 1,518 | 59 | # <small>nlohmann::basic_json::</small>get_to
```cpp
template<typename ValueType>
ValueType& get_to(ValueType& v) const noexcept(
noexcept(JSONSerializer<ValueType>::from_json(
std::declval<const basic_json_t&>(), v)));
```
Explicit type conversion between the JSON value and a compatible value. The value ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/unflatten.md | .md | 1,606 | 62 | # <small>nlohmann::basic_json::</small>unflatten
```cpp
basic_json unflatten() const;
```
The function restores the arbitrary nesting of a JSON value that has been flattened before using the
[`flatten()`](flatten.md) function. The JSON value must meet certain constraints:
1. The value must be an object.
2. The keys ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/type_error.md | .md | 1,707 | 69 | # <small>nlohmann::basic_json::</small>type_error
```cpp
class type_error : public exception;
```
This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type
does not match the expected semantics.
Exceptions have ids 3xx (see [list of type errors](../../home/e... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/push_back.md | .md | 3,005 | 107 | # <small>nlohmann::basic_json::</small>push_back
```cpp
// (1)
void push_back(basic_json&& val);
void push_back(const basic_json& val);
// (2)
void push_back(const typename object_t::value_type& val);
// (3)
void push_back(initializer_list_t init);
```
1. Appends the given element `val` to the end of the JSON array... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/get_ref.md | .md | 1,678 | 65 | # <small>nlohmann::basic_json::</small>get_ref
```cpp
template<typename ReferenceType>
ReferenceType get_ref();
template<typename ReferenceType>
const ReferenceType get_ref() const;
```
Implicit reference access to the internally stored JSON value. No copies are made.
## Template parameters
`ReferenceType`
: ref... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/operator_ne.md | .md | 2,545 | 99 | # <small>nlohmann::basic_json::</small>operator!=
```cpp
// until C++20
bool operator!=(const_reference lhs, const_reference rhs) noexcept; // (1)
template<typename ScalarType>
bool operator!=(const_reference lhs, const ScalarType rhs) noexcept; // (2)
template<typename ScalarType>
bool operator!=(ScalarType lhs,... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/cbor_tag_handler_t.md | .md | 842 | 43 | # <small>nlohmann::basic_json::</small>cbor_tag_handler_t
```cpp
enum class cbor_tag_handler_t
{
error,
ignore,
store
};
```
This enumeration is used in the [`from_cbor`](from_cbor.md) function to choose how to treat tags:
error
: throw a `parse_error` exception in case of a tag
ignore
: ignore tags... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/diff.md | .md | 1,265 | 63 | # <small>nlohmann::basic_json::</small>diff
```cpp
static basic_json diff(const basic_json& source,
const basic_json& target);
```
Creates a [JSON Patch](http://jsonpatch.com) so that value `source` can be changed into the value `target` by calling
[`patch`](patch.md) function.
For two JSON va... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/contains.md | .md | 3,270 | 119 | # <small>nlohmann::basic_json::</small>contains
```cpp
// (1)
bool contains(const typename object_t::key_type& key) const;
// (2)
template<typename KeyType>
bool contains(KeyType&& key) const;
// (3)
bool contains(const json_pointer& ptr) const;
```
1. Check whether an element exists in a JSON object with a key equ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/crbegin.md | .md | 695 | 42 | # <small>nlohmann::basic_json::</small>crbegin
```cpp
const_reverse_iterator crbegin() const noexcept;
```
Returns an iterator to the reverse-beginning; that is, the last element.

## Return value
reverse iterator to the first element
## Exc... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/flatten.md | .md | 1,164 | 51 | # <small>nlohmann::basic_json::</small>flatten
```cpp
basic_json flatten() const;
```
The function creates a JSON object whose keys are JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901))
and whose values are all primitive (see [`is_primitive()`](is_primitive.md) for more information). The original JS... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/~basic_json.md | .md | 329 | 22 | # <small>nlohmann::basic_json::</small>~basic_json
```cpp
~basic_json() noexcept;
```
Destroys the JSON value and frees all allocated memory.
## Exception safety
No-throw guarantee: this member function never throws exceptions.
## Complexity
Linear.
<!-- NOLINT Examples -->
## Version history
- Added in versio... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/basic_json.md | .md | 15,491 | 403 | # <small>nlohmann::basic_json::</small>basic_json
```cpp
// (1)
basic_json(const value_t v);
// (2)
basic_json(std::nullptr_t = nullptr) noexcept;
// (3)
template<typename CompatibleType>
basic_json(CompatibleType&& val) noexcept(noexcept(
JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/clear.md | .md | 1,256 | 59 | # <small>nlohmann::basic_json::</small>clear
```cpp
void clear() noexcept;
```
Clears the content of a JSON value and resets it to the default value as if [`basic_json(value_t)`](basic_json.md) would
have been called with the current value type from [`type()`](type.md):
| Value type | initial value |
|-------... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/is_object.md | .md | 664 | 40 | # <small>nlohmann::basic_json::</small>is_object
```cpp
constexpr bool is_object() const noexcept;
```
This function returns `#!cpp true` if and only if the JSON value is an object.
## Return value
`#!cpp true` if type is an object, `#!cpp false` otherwise.
## Exception safety
No-throw guarantee: this member ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/exception.md | .md | 2,098 | 76 | # <small>nlohmann::basic_json::</small>exception
```cpp
class exception : public std::exception;
```
This class is an extension of [`std::exception`](https://en.cppreference.com/w/cpp/error/exception) objects with a
member `id` for exception ids. It is used as the base class for all exceptions thrown by the `basic_js... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/number_float_t.md | .md | 2,931 | 71 | # <small>nlohmann::basic_json::</small>number_float_t
```cpp
using number_float_t = NumberFloatType;
```
The type used to store JSON numbers (floating-point).
[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows:
> The representation of numbers is similar to that used in most programming lang... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/input_format_t.md | .md | 847 | 53 | # <small>nlohmann::basic_json::</small>input_format_t
```cpp
enum class input_format_t {
json,
cbor,
msgpack,
ubjson,
bson,
bjdata
};
```
This enumeration is used in the [`sax_parse`](sax_parse.md) function to choose the input format to parse:
json
: JSON (JavaScript Object Notation)
cbor
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/to_msgpack.md | .md | 1,433 | 60 | # <small>nlohmann::basic_json::</small>to_msgpack
```cpp
// (1)
static std::vector<std::uint8_t> to_msgpack(const basic_json& j);
// (2)
static void to_msgpack(const basic_json& j, detail::output_adapter<std::uint8_t> o);
static void to_msgpack(const basic_json& j, detail::output_adapter<char> o);
```
Serializes a g... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/api/basic_json/is_binary.md | .md | 664 | 40 | # <small>nlohmann::basic_json::</small>is_binary
```cpp
constexpr bool is_binary() const noexcept;
```
This function returns `#!cpp true` if and only if the JSON value is binary array.
## Return value
`#!cpp true` if type is binary, `#!cpp false` otherwise.
## Exception safety
No-throw guarantee: this member ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/macros.md | .md | 8,236 | 154 | # Supported Macros
Some aspects of the library can be configured by defining preprocessor macros before including the `json.hpp` header.
See also the [API documentation for macros](../api/macros/index.md) for examples and more information.
## `JSON_ASSERT(x)`
This macro controls which code is executed for [runtime a... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/object_order.md | .md | 2,678 | 110 | # Object Order
The [JSON standard](https://tools.ietf.org/html/rfc8259.html) defines objects as "an unordered collection of zero or more name/value pairs". As such, an implementation does not need to preserve any specific order of object keys.
## Default behavior: sort keys
The default type `nlohmann::json` uses a `... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/enum_conversion.md | .md | 2,341 | 62 | # Specializing enum conversion
By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an
enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be
undefined or a different enum value than was originally... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/json_patch.md | .md | 1,033 | 48 | # JSON Patch and Diff
## Patches
JSON Patch ([RFC 6902](https://tools.ietf.org/html/rfc6902)) defines a JSON document structure for expressing a sequence
of operations to apply to a JSON document. With the `patch` function, a JSON Patch is applied to the current JSON value
by executing all operations from the patch.
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/json_pointer.md | .md | 4,288 | 127 | # JSON Pointer
## Introduction
The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as alternative means to address
structured values. A JSON Pointer is a string that identifies a specific value within a JSON document.
Consider the following JSON document
```json
{
"array": ["... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/arbitrary_types.md | .md | 11,424 | 275 | # Arbitrary Type Conversions
Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines:
```cpp
namespace ns {
// a simple struct to model a person
struct person {
std::string name;
std::string address;
int age;
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/namespace.md | .md | 4,265 | 94 | # `nlohmann` Namespace
The 3.11.0 release introduced an
[inline namespace](https://en.cppreference.com/w/cpp/language/namespace#Inline_namespaces) to allow different parts of
a codebase to safely use different versions of the JSON library as long as they never exchange instances of library
types.
## Structure
The co... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/iterators.md | .md | 4,109 | 156 | # Iterators
## Overview
A `basic_json` value is a container and allows access via iterators. Depending on the value type, `basic_json` stores zero or more values.
As for other containers, `begin()` returns an iterator to the first value and `end()` returns an iterator to the value following the last value. The latte... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/comments.md | .md | 2,955 | 84 | # Comments
This library does not support comments *by default*. It does so for three reasons:
1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript.
2. This was not an oversight: Douglas Crock... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/merge_patch.md | .md | 760 | 21 | # JSON Merge Patch
The library supports JSON Merge Patch ([RFC 7386](https://tools.ietf.org/html/rfc7386)) as a patch format.
The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge pat... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/assertions.md | .md | 3,766 | 132 | # Runtime Assertions
The code contains numerous debug assertions to ensure class invariants are valid or to detect undefined behavior.
Whereas the former class invariants are nothing to be concerned of, the latter checks for undefined behavior are to
detect bugs in client code.
## Switch off runtime assertions
Runti... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_values.md | .md | 11,778 | 373 | # Binary Values
The library implements several [binary formats](binary_formats/index.md) that encode JSON in an efficient way. Most of
these formats support binary values; that is, values that have semantics define outside the library and only define a
sequence of bytes to be stored.
JSON itself does not have a binar... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/types/number_handling.md | .md | 15,123 | 329 | # Number Handling
This document describes how the library is handling numbers.
## Background
This section briefly summarizes how the JSON specification describes how numbers should be handled.
### JSON number syntax
JSON defines the syntax of numbers as follows:
!!! quote "[RFC 8259](https://tools.ietf.org/html/r... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/types/index.md | .md | 12,701 | 270 | # Types
This page gives an overview how JSON values are stored and how this can be configured.
## Overview
By default, JSON values are stored as follows:
| JSON type | C++ type |
|-----------|-----------------------------------------------|
| object | `std::map<std::string, b... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/element_access/unchecked_access.md | .md | 5,649 | 113 | # Unchecked access: operator[]
## Overview
Elements in a JSON object and a JSON array can be accessed via [`operator[]`](../../api/basic_json/operator%5B%5D.md)
similar to a `#!cpp std::map` and a `#!cpp std::vector`, respectively.
??? example "Read access"
Consider the following JSON value:
```json
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/element_access/index.md | .md | 275 | 10 | # Element Access
There are many ways elements in a JSON value can be accessed:
- unchecked access via [`operator[]`](unchecked_access.md)
- checked access via [`at`](checked_access.md)
- access with default value via [`value`](default_value.md)
- iterators
- JSON pointers
| Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/element_access/checked_access.md | .md | 3,934 | 92 | # Checked access: at
## Overview
The [`at`](../../api/basic_json/at.md) member function performs checked access; that is, it returns a reference to the
desired value if it exists and throws a [`basic_json::out_of_range` exception](../../home/exceptions.md#out-of-range)
otherwise.
??? example "Read access"
Consi... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/element_access/default_value.md | .md | 978 | 33 | # Access with default value: value
## Overview
In many situations such as configuration files, missing values are not exceptional, but may be treated as if a default value was present.
??? example
Consider the following JSON value:
```json
{
"logOutput": "result.log",
"append": true... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/parsing/parser_callbacks.md | .md | 3,778 | 84 | # Parser Callbacks
## Overview
With a parser callback function, the result of parsing a JSON text can be influenced. When passed to `parse`, it is
called on certain events (passed as `parse_event_t` via parameter `event`) with a set recursion depth `depth` and
context JSON value `parsed`. The return value of the call... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/parsing/parse_exceptions.md | .md | 3,470 | 122 | # Parsing and Exceptions
When the input is not valid JSON, an exception of type [`parse_error`](../../home/exceptions.md#parse-errors) is thrown.
This exception contains the position in the input where the error occurred, together with a diagnostic message and the
last read input token. The exceptions page contains a
... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/parsing/index.md | .md | 159 | 14 | # Parsing
!!! note
This page is under construction.
## Input
## SAX vs. DOM parsing
## Exceptions
See [parsing and exceptions](parse_exceptions.md).
| Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/parsing/json_lines.md | .md | 1,537 | 50 | # JSON Lines
The [JSON Lines](https://jsonlines.org) format is a text format of newline-delimited JSON. In particular:
1. The input must be UTF-8 encoded.
2. Every line must be a valid JSON value.
3. The line separator must be `\n`. As `\r` is silently ignored, `\r\n` is also supported.
4. The final character may be ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/parsing/sax_interface.md | .md | 3,290 | 74 | # SAX Interface
The library uses a SAX-like interface with the following functions:
```plantuml
interface json::sax_t {
+ {abstract} bool null()
+ {abstract} bool boolean(bool val)
+ {abstract} bool number_integer(number_integer_t val)
+ {abstract} bool number_unsigned(number_unsigned_t val)
+ ... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/bson.md | .md | 4,127 | 97 | # BSON
BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the
embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow
representation of data types that are not part of the JSON spec. For example, BSON has... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/index.md | .md | 2,733 | 53 | # Binary Formats
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over
a network. Hence, the library supports
- [BJData](bjdata.md) (Binary JData),
- [BSON](bson.md) (Binary JSON),
- [CBOR](cbor.md) (Concise Binary Object Representation),
- [MessagePack... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/bjdata.md | .md | 10,300 | 195 | # BJData
The [BJData format](https://neurojson.org) was derived from and improved upon
[Universal Binary JSON(UBJSON)](https://ubjson.org) specification (Draft 12). Specifically, it introduces an optimized
array container for efficient storage of N-dimensional packed arrays (**ND-arrays**); it also adds 4 new type mar... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/cbor.md | .md | 10,325 | 182 | # CBOR
The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely
small code size, fairly small message size, and extensibility without the need for version negotiation.
!!! abstract "References"
- [CBOR Website](http://cbor.io) - the main source on... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/messagepack.md | .md | 7,194 | 144 | # MessagePack
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON.
But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one
extra byte in addition to the strings themselves.
!!! abstract "Re... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/features/binary_formats/ubjson.md | .md | 5,745 | 127 | # UBJSON
Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to
achieve the generality of JSON, combined with being much easier to process than JSON.
!!! abstract "References"
- [UBJSON Website](http://ubjson.org)
## Serialization
The library uses... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/migration_guide.md | .md | 8,377 | 265 | # Migration Guide
This page collects some guidelines on how to future-proof your code for future versions of this library.
## Replace deprecated functions
The following functions have been deprecated and will be removed in the next major version (i.e., 4.0.0). All
deprecations are annotated with
[`HEDLEY_DEPRECATED_... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/cmake.md | .md | 6,497 | 173 | # CMake
## Integration
You can use the `nlohmann_json::nlohmann_json` interface target in CMake. This target populates the appropriate usage
requirements for [`INTERFACE_INCLUDE_DIRECTORIES`](https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.html)
to point to the appropriate include directori... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/package_managers.md | .md | 9,835 | 199 | # Package Managers
Throughout this page, we will describe how to compile the example file `example.cpp` below.
```cpp
--8<-- "integration/example.cpp"
```
When executed, this program should create output similar to
```json
--8<-- "../../examples/meta.output"
```
## Homebrew
If you are using OS X and [Homebrew](ht... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/index.md | .md | 637 | 19 | # Header only
[`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is the single required
file in `single_include/nlohmann` or [released here](https://github.com/nlohmann/json/releases). You need to add
```cpp
#include <nlohmann/json.hpp>
// for convenience
using json = nlohma... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/example.cpp | .cpp | 174 | 11 | #include <nlohmann/json.hpp>
#include <iostream>
#include <iomanip>
using json = nlohmann::json;
int main()
{
std::cout << std::setw(4) << json::meta() << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/pkg-config.md | .md | 405 | 14 | # Pkg-config
If you are using bare Makefiles, you can use `pkg-config` to generate the include flags that point to where the library is installed:
```sh
pkg-config nlohmann_json --cflags
```
Users of the [Meson build system](package_managers.md#meson) will also be able to use a system-wide library, which will be fou... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/vcpkg/example.cpp | .cpp | 139 | 10 | #include <nlohmann/json.hpp>
#include <iostream>
using json = nlohmann::json;
int main()
{
std::cout << json::meta() << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/docs/integration/conan/example.cpp | .cpp | 139 | 10 | #include <nlohmann/json.hpp>
#include <iostream>
using json = nlohmann::json;
int main()
{
std::cout << json::meta() << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/mkdocs/scripts/check_structure.py | .py | 8,453 | 180 | #!/usr/bin/env python
import glob
import os.path
import re
import sys
warnings = 0
def report(rule, location, description):
global warnings
warnings += 1
print(f'{warnings:3}. {location}: {description} [{rule}]')
def check_structure():
expected_sections = [
'Template parameters',
... | Python |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/invalid_iterator.cpp | .cpp | 469 | 22 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
try
{
// calling iterator::key() on non-object iterator
json j = "string";
json::iterator it = j.begin();
auto k = it.key();
}
catch (json::invalid_iterator& e)
{
// o... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_literal_json_pointer.cpp | .cpp | 297 | 15 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
json j = R"( {"hello": "world", "answer": 42} )"_json;
auto val = j["/hello"_json_pointer];
std::cout << std::setw(2) << val << '\n';
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/flatten.cpp | .cpp | 598 | 33 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON value
json j =
{
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{
"answer", {
{"everyth... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_spaceship__scalartype.c++20.cpp | .cpp | 1,115 | 42 | #include <compare>
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
const char* to_string(const std::partial_ordering& po)
{
if (std::is_lt(po))
{
return "less";
}
else if (std::is_gt(po))
{
return "greater";
}
else if (std::is_eq(po))
{
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_pointer__operator_add.cpp | .cpp | 491 | 24 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON pointer
json::json_pointer ptr("/foo");
std::cout << "\"" << ptr << "\"\n";
// append a JSON Pointer
ptr /= json::json_pointer("/bar/baz");
std::cout << "\"" << ptr << "\"\n";
// a... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/README.cpp | .cpp | 753 | 40 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json j =
{
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{
"answer", {
{"ever... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/basic_json__moveconstructor.cpp | .cpp | 287 | 18 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value
json a = 23;
// move contents of a to b
json b(std::move(a));
// serialize the JSON arrays
std::cout << a << '\n';
std::cout << b << '\n';
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/other_error.cpp | .cpp | 699 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
try
{
// executing a failing JSON Patch operation
json value = R"({
"best_biscuit": {
"name": "Oreo"
}
})"_json;
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__equal.cpp | .cpp | 827 | 25 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array_1 = {1, 2, 3};
json array_2 = {1, 2, 4};
json object_1 = {{"A", "a"}, {"B", "b"}};
json object_2 = {{"B", "b"}, {"A", "a"}};
json number_1 = 17;
json number_2... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_array__size_type.cpp | .cpp | 483 | 26 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON array
json array = {1, 2, 3, 4, 5};
// output element at index 3 (fourth element)
std::cout << array[3] << '\n';
// change last element to 6
array[array.size() - 1] = 6;
// output... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__keytype_const.c++17.cpp | .cpp | 987 | 45 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create JSON object
const json object =
{
{"the good", "il buono"},
{"the bad", "il cattivo"},
{"the ugly", "il brutto"}
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__ValueType.cpp | .cpp | 1,425 | 61 | #include <iostream>
#include <unordered_map>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value with different types
json json_types =
{
{"boolean", true},
{
"number", {
{"integer", 42},
{"floating-point... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/to_cbor.cpp | .cpp | 507 | 23 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create a JSON value
json j = R"({"compact": true, "schema": 0})"_json;
// serialize it to CBOR
std::vector<std::uint8_t> v = json::to_cbor(j);
// p... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/begin.cpp | .cpp | 330 | 17 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to the first element
json::iterator it = array.begin();
// serialize the element that the iterator points to
std::cout << *it <... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_array__object_t_key_type.cpp | .cpp | 656 | 33 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json object =
{
{"one", 1}, {"two", 2}, {"three", 2.9}
};
// output element with key "two"
std::cout << object["two"] << "\n\n";
// change element... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/cbor_tag_handler_t.cpp | .cpp | 837 | 29 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// tagged byte string
std::vector<std::uint8_t> vec = {{0xd8, 0x42, 0x44, 0xcA, 0xfe, 0xba, 0xbe}};
// cbor_tag_handler_t::error throws
try
{
auto b_throw_on_tag = json::from_cbor(vec, true, true, j... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/merge_patch.cpp | .cpp | 1,031 | 42 | #include <iostream>
#include <nlohmann/json.hpp>
#include <iomanip> // for std::setw
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// the original document
json document = R"({
"title": "Goodbye!",
"author": {
"givenName": "Jo... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/basic_json__copyassignment.cpp | .cpp | 283 | 19 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json a = 23;
json b = 42;
// copy-assign a to b
b = a;
// serialize the JSON arrays
std::cout << a << '\n';
std::cout << b << '\n';
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/array.cpp | .cpp | 543 | 20 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON arrays
json j_no_init_list = json::array();
json j_empty_init_list = json::array({});
json j_nonempty_init_list = json::array({1, 2, 3, 4});
json j_list_of_pairs = json::array({ {"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__lessequal.cpp | .cpp | 825 | 25 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array_1 = {1, 2, 3};
json array_2 = {1, 2, 4};
json object_1 = {{"A", "a"}, {"B", "b"}};
json object_2 = {{"B", "b"}, {"A", "a"}};
json number_1 = 17;
json number_2... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_pointer__string_t.cpp | .cpp | 303 | 14 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
json::json_pointer::string_t s = "This is a string.";
std::cout << s << std::endl;
std::cout << std::boolalpha << std::is_same<json::json_pointer::string_t, json::string_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/parse__iterator_pair.cpp | .cpp | 423 | 16 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// a JSON text given an input with other values
std::vector<std::uint8_t> input = {'[', '1', ',', '2', ',', '3', ']', 'o', 't', 'h', 'e', 'r'};
// parse and serialize JSON
json j_complete = j... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_structured.cpp | .cpp | 1,001 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_define_type_intrusive_with_default_macro.cpp | .cpp | 1,126 | 43 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
namespace ns
{
class person
{
private:
std::string name = "John Doe";
std::string address = "123 Fake St";
int age = -1;
public:
person() = default;
person(std::string name_, std:... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__json_pointer.cpp | .cpp | 2,471 | 105 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create a JSON value
json j =
{
{"number", 1}, {"string", "foo"}, {"array", {1, 2}}
};
// read-only access
// output element with JSON pointer "/number"
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/object_t.cpp | .cpp | 231 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<std::map<json::string_t, json>, json::object_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__json_pointer_const.cpp | .cpp | 1,952 | 81 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create a JSON value
const json j =
{
{"number", 1}, {"string", "foo"}, {"array", {1, 2}}
};
// read-only access
// output element with JSON pointer "/numb... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__notequal__nullptr_t.cpp | .cpp | 698 | 23 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array = {1, 2, 3};
json object = {{"A", "a"}, {"B", "b"}};
json number = 17;
json string = "foo";
json null;
// output values and comparisons
std::cout << std:... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/ordered_map.cpp | .cpp | 1,109 | 44 | #include <iostream>
#include <nlohmann/json.hpp>
// simple output function
template<typename Map>
void output(const char* prefix, const Map& m)
{
std::cout << prefix << " = { ";
for (auto& element : m)
{
std::cout << element.first << ":" << element.second << ' ';
}
std::cout << "}" << std::... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_json_namespace_no_version.cpp | .cpp | 284 | 14 | #include <iostream>
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 1
#include <nlohmann/json.hpp>
// macro needed to output the NLOHMANN_JSON_NAMESPACE as string literal
#define Q(x) #x
#define QUOTE(x) Q(x)
int main()
{
std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl;
}
| C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.