mirror of
https://github.com/nlohmann/json.git
synced 2026-10-15 02:37:13 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d13c9e7212 | ||
|
|
522e7465b0 | ||
|
|
fe4e78e867 | ||
|
|
9196e92520 | ||
|
|
7d22d865dd | ||
|
|
4c73319d3b | ||
|
|
da5097abcd | ||
|
|
2319f6e6f9 | ||
|
|
9a0d1c0c47 | ||
|
|
1bbb5d400a | ||
|
|
08d18d5a82 | ||
|
|
a27065bd12 | ||
|
|
3940f4b730 | ||
|
|
0663907b68 | ||
|
|
f23b3c63a2 |
No files matched your search
@@ -1,3 +0,0 @@
|
|||||||
# generated files are collapsed in diffs and excluded from language statistics
|
|
||||||
single_include/** linguist-generated
|
|
||||||
nlohmann_json.natvis linguist-generated
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# JSON for Modern C++ was originally written by Niels Lohmann.
|
# JSON for Modern C++ was originally written by Niels Lohmann.
|
||||||
# Since 2013, over 400 contributors have helped to improve the library.
|
# Since 2013, over 250 contributors have helped to improve the library.
|
||||||
# This CODEOWNERS file is only to make sure that @nlohmann is requested
|
# This CODEOWNERS file is only to make sure that @nlohmann is requested
|
||||||
# for a code review in case of a pull request.
|
# for a code review in case of a pull request.
|
||||||
|
|
||||||
|
|||||||
+14
-16
@@ -98,7 +98,7 @@ $ ctest --test-dir build -j 10
|
|||||||
The test suite should report:
|
The test suite should report:
|
||||||
|
|
||||||
```
|
```
|
||||||
100% tests passed, 0 tests failed out of <number of tests>
|
100% tests passed, 0 tests failed out of 98
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Add tests
|
#### Add tests
|
||||||
@@ -149,17 +149,14 @@ make build -C docs/mkdocs # strict build: fails on broken links, anchor
|
|||||||
make check_mermaid -C docs/mkdocs # checks the Mermaid diagrams (requires Node.js)
|
make check_mermaid -C docs/mkdocs # checks the Mermaid diagrams (requires Node.js)
|
||||||
```
|
```
|
||||||
|
|
||||||
The search index of the docset is generated from [`mkdocs.yml`](https://github.com/nlohmann/json/blob/develop/docs/mkdocs/mkdocs.yml)
|
A new API page also needs an entry in [`docs/docset/docSet.sql`](https://github.com/nlohmann/json/blob/develop/docs/docset/docSet.sql),
|
||||||
and each page's title (H1) and declaration by
|
the search index of the docset; `make build` reports missing entries.
|
||||||
[`docs/docset/generate_docset.py`](https://github.com/nlohmann/json/blob/develop/docs/docset/generate_docset.py);
|
|
||||||
`make build` reports API pages that cannot be classified.
|
|
||||||
|
|
||||||
### Amalgamate the source code
|
### Amalgamate the source code
|
||||||
|
|
||||||
The single-header files
|
The single-header files
|
||||||
[`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp),
|
[`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) and
|
||||||
[`single_include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_fwd.hpp), and
|
[`single_include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_fwd.hpp)
|
||||||
[`single_include/nlohmann/json_literals.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_literals.hpp)
|
|
||||||
are **generated** from the source files in the
|
are **generated** from the source files in the
|
||||||
[`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). **Do not** edit the
|
[`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). **Do not** edit the
|
||||||
files directly; instead, modify the include/nlohmann sources and regenerate the files by executing:
|
files directly; instead, modify the include/nlohmann sources and regenerate the files by executing:
|
||||||
@@ -182,7 +179,7 @@ The amalgamation check in CI fails if any of these generated files is out of dat
|
|||||||
|
|
||||||
## Recommended documentation
|
## Recommended documentation
|
||||||
|
|
||||||
- The library’s [README file](https://github.com/nlohmann/json/blob/develop/README.md) is an excellent starting point to
|
- The library’s [README file](https://github.com/nlohmann/json/blob/master/README.md) is an excellent starting point to
|
||||||
understand its functionality.
|
understand its functionality.
|
||||||
- The [documentation page](https://json.nlohmann.me) is the reference documentation of the library.
|
- The [documentation page](https://json.nlohmann.me) is the reference documentation of the library.
|
||||||
- [RFC 8259](https://datatracker.ietf.org/doc/html/rfc8259) is the reference for the JavaScript Object Notation (JSON)
|
- [RFC 8259](https://datatracker.ietf.org/doc/html/rfc8259) is the reference for the JavaScript Object Notation (JSON)
|
||||||
@@ -221,9 +218,9 @@ feature macros then allows users to test their code against the library in the n
|
|||||||
### Break C++11 language conformance
|
### Break C++11 language conformance
|
||||||
|
|
||||||
This library is designed to work with C++11 and later. This means that any
|
This library is designed to work with C++11 and later. This means that any
|
||||||
[supported C++11 compiler](https://github.com/nlohmann/json/blob/develop/README.md#supported-compilers) should compile
|
[supported C++11 compiler](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers) should compile
|
||||||
the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual
|
the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual
|
||||||
C++ 2013 and earlier are known not to work due to missing or incomplete C++11 support.
|
Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support.
|
||||||
|
|
||||||
Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and
|
Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and
|
||||||
later against the respective [`JSON_HAS_CPP_14`](https://json.nlohmann.me/api/macros/json_has_cpp_11/) macros.
|
later against the respective [`JSON_HAS_CPP_14`](https://json.nlohmann.me/api/macros/json_has_cpp_11/) macros.
|
||||||
@@ -239,11 +236,12 @@ extension.
|
|||||||
The following areas really need contribution and are always welcomed:
|
The following areas really need contribution and are always welcomed:
|
||||||
|
|
||||||
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the
|
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the
|
||||||
bleeding-edge versions of Clang.
|
bleeding-edge versions Clang.
|
||||||
- Improving the efficiency of the **JSON parser**. The current parser is a hand-written iterative parser that keeps an
|
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser
|
||||||
explicit stack instead of recursing, with hand-coded string handling. Speeding up the lexer or the value construction
|
with hand-coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That
|
||||||
would be appreciated. Parser generators like Bison or ANTLR do not play nice with single-header files -- I really
|
said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep
|
||||||
would like to keep the parser inside the `json.hpp` header.
|
the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for
|
||||||
|
parsing.
|
||||||
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency
|
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency
|
||||||
is not everything, speed and memory consumption are very important characteristics for C++ developers, so having
|
is not everything, speed and memory consumption are very important characteristics for C++ developers, so having
|
||||||
proper comparisons would be interesting.
|
proper comparisons would be interesting.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ body:
|
|||||||
If possible, provide a small and self-contained example that triggers
|
If possible, provide a small and self-contained example that triggers
|
||||||
the bug. Please understand that we cannot analyze and debug large code
|
the bug. Please understand that we cannot analyze and debug large code
|
||||||
bases. Please do not paste screenshots here.
|
bases. Please do not paste screenshots here.
|
||||||
render: cpp
|
render: Shell
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: output
|
id: output
|
||||||
attributes:
|
attributes:
|
||||||
@@ -79,7 +79,7 @@ body:
|
|||||||
description: >
|
description: >
|
||||||
Which version of the library did you use? If it is a released version,
|
Which version of the library did you use? If it is a released version,
|
||||||
please enter the version number (e.g., 3.12.0). Otherwise, please enter
|
please enter the version number (e.g., 3.12.0). Otherwise, please enter
|
||||||
the commit hash. If you got the library from another source than the
|
the commit hash. If you got the library from another source as the
|
||||||
GitHub repository (e.g., via a package manager), please also state
|
GitHub repository (e.g., via a package manager), please also state
|
||||||
this.
|
this.
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
@@ -21,17 +21,6 @@ labels:
|
|||||||
files:
|
files:
|
||||||
- "cmake/.*"
|
- "cmake/.*"
|
||||||
|
|
||||||
# other build systems
|
|
||||||
- label: "CMake"
|
|
||||||
files:
|
|
||||||
- "(meson\\.build|meson_options\\.txt|BUILD\\.bazel|MODULE\\.bazel|Package\\.swift)"
|
|
||||||
|
|
||||||
- label: "documentation"
|
|
||||||
files:
|
|
||||||
- ".github/ISSUE_TEMPLATE/.*"
|
|
||||||
- ".github/config\\.yml"
|
|
||||||
- ".github/(CONTRIBUTING|SECURITY|CODE_OF_CONDUCT|PULL_REQUEST_TEMPLATE)\\.md"
|
|
||||||
|
|
||||||
- label: "CI"
|
- label: "CI"
|
||||||
files:
|
files:
|
||||||
- ".github/workflows/.*"
|
- ".github/workflows/.*"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -83,7 +83,8 @@ jobs:
|
|||||||
# byte for byte), so there is nothing to gain from checking out a
|
# byte for byte), so there is nothing to gain from checking out a
|
||||||
# separate copy, and doing so would make this step fail on a PR
|
# separate copy, and doing so would make this step fail on a PR
|
||||||
# that adds support for a new dispatch table until that PR itself
|
# that adds support for a new dispatch table until that PR itself
|
||||||
# merges to develop.
|
# merges to develop, the same way generate_natvis.py's --version
|
||||||
|
# requirement briefly did.
|
||||||
TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX)
|
TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX)
|
||||||
c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder"
|
c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder"
|
||||||
"$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp"
|
"$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp"
|
||||||
@@ -116,6 +117,7 @@ jobs:
|
|||||||
|
|
||||||
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json.json -s .
|
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json.json -s .
|
||||||
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json_fwd.json -s .
|
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json_fwd.json -s .
|
||||||
|
cp include/nlohmann/json_literals.hpp $INCLUDE_DIR/json_literals.hpp
|
||||||
|
|
||||||
# the header list of the Bazel "json" target must match the files in include/
|
# the header list of the Bazel "json" target must match the files in include/
|
||||||
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
||||||
@@ -136,13 +138,17 @@ jobs:
|
|||||||
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet \
|
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet \
|
||||||
$(find $SOURCE_DIRS -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
$(find $SOURCE_DIRS -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||||
|
|
||||||
# json_literals.hpp is copied verbatim from the (now formatted) include/
|
|
||||||
# directory, like `make amalgamate` does
|
|
||||||
cp include/nlohmann/json_literals.hpp $INCLUDE_DIR/json_literals.hpp
|
|
||||||
|
|
||||||
- name: Regenerate nlohmann_json.natvis
|
- name: Regenerate nlohmann_json.natvis
|
||||||
run: |
|
run: |
|
||||||
cd $MAIN_DIR
|
cd $MAIN_DIR
|
||||||
|
# Pass --version explicitly so this step also works with the tool
|
||||||
|
# copy from develop before this repository's own generate_natvis.py
|
||||||
|
# learns to derive the version itself: the older script requires
|
||||||
|
# --version, and the newer one accepts it as an explicit override.
|
||||||
|
ABI_MACROS=include/nlohmann/detail/abi_macros.hpp
|
||||||
|
VERSION_MAJOR=$(grep -m1 'define NLOHMANN_JSON_VERSION_MAJOR' $ABI_MACROS | grep -o '[0-9]\+')
|
||||||
|
VERSION_MINOR=$(grep -m1 'define NLOHMANN_JSON_VERSION_MINOR' $ABI_MACROS | grep -o '[0-9]\+')
|
||||||
|
VERSION_PATCH=$(grep -m1 'define NLOHMANN_JSON_VERSION_PATCH' $ABI_MACROS | grep -o '[0-9]\+')
|
||||||
# The template is what this check verifies the committed natvis
|
# The template is what this check verifies the committed natvis
|
||||||
# file against, so take it from this PR rather than from the
|
# file against, so take it from this PR rather than from the
|
||||||
# develop checkout: generate_natvis.py loads the template from its
|
# develop checkout: generate_natvis.py loads the template from its
|
||||||
@@ -150,7 +156,7 @@ jobs:
|
|||||||
# template could never pass. Like the macro_builder step above,
|
# template could never pass. Like the macro_builder step above,
|
||||||
# this only renders PR content in a job without credentials.
|
# this only renders PR content in a job without credentials.
|
||||||
cp tools/generate_natvis/nlohmann_json.natvis.j2 $NATVIS_TOOL_DIR/
|
cp tools/generate_natvis/nlohmann_json.natvis.j2 $NATVIS_TOOL_DIR/
|
||||||
python3 $NATVIS_TOOL_DIR/generate_natvis.py $MAIN_DIR
|
python3 $NATVIS_TOOL_DIR/generate_natvis.py --version "$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" $MAIN_DIR
|
||||||
|
|
||||||
- name: Build patch and check for differences
|
- name: Build patch and check for differences
|
||||||
id: diff
|
id: diff
|
||||||
@@ -159,7 +165,7 @@ jobs:
|
|||||||
mkdir -p ${{ github.workspace }}/patch
|
mkdir -p ${{ github.workspace }}/patch
|
||||||
git diff --patch --no-color > ${{ github.workspace }}/patch/amalgamation.patch
|
git diff --patch --no-color > ${{ github.workspace }}/patch/amalgamation.patch
|
||||||
if [ -s ${{ github.workspace }}/patch/amalgamation.patch ]; then
|
if [ -s ${{ github.workspace }}/patch/amalgamation.patch ]; then
|
||||||
echo "The source code has not been amalgamated/formatted correctly, or BUILD.bazel, nlohmann_json.natvis, or the macro_builder tables in macro_scope.hpp are out of date ('make amalgamate BUILD.bazel natvis' fixes all but the tables, see tools/macro_builder/README.md). Diff:"
|
echo "The source code has not been amalgamated/formatted correctly or BUILD.bazel is out of date. Diff:"
|
||||||
cat ${{ github.workspace }}/patch/amalgamation.patch
|
cat ${{ github.workspace }}/patch/amalgamation.patch
|
||||||
echo "has_diff=true" >> "$GITHUB_OUTPUT"
|
echo "has_diff=true" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
name: "Check API documentation"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check_api_docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: Checkout pull request
|
||||||
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
|
|
||||||
|
- name: Install clang
|
||||||
|
# Used only as a subprocess for `clang++ -E -v` system-include-path discovery in
|
||||||
|
# extract_api.py; it does not need to version-match the pinned libclang pip wheel
|
||||||
|
# below, which does the actual AST parsing. Do not "fix" this to be version-matched.
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y clang
|
||||||
|
|
||||||
|
- name: Install Python dependencies
|
||||||
|
run: pip install -r tools/api_checker/requirements.txt
|
||||||
|
|
||||||
|
- name: Extract API and regenerate the committed surface file
|
||||||
|
run: |
|
||||||
|
python3 tools/api_checker/extract_api.py \
|
||||||
|
--header include/nlohmann/json.hpp \
|
||||||
|
--include include \
|
||||||
|
--output /tmp/api_snapshot.json \
|
||||||
|
--surface-output tools/api_checker/api_surface.json
|
||||||
|
|
||||||
|
- name: "Check API documentation (Phase 1: advisory)"
|
||||||
|
# Surfaces missing/broken @sa links without failing the job while the backlog from the
|
||||||
|
# initial AST-based rollout is burned down. See tools/api_checker/POLICY.md and the PR
|
||||||
|
# that introduced this workflow for the two-phase rollout plan.
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
python3 tools/api_checker/check_docs.py \
|
||||||
|
--snapshot /tmp/api_snapshot.json
|
||||||
|
|
||||||
|
- name: Check macro documentation (advisory only)
|
||||||
|
# Cross-checks docs/mkdocs/docs/api/macros/ pages against #define sites. Only checks the
|
||||||
|
# documented-macro-still-exists direction; never blocks CI. See POLICY.md.
|
||||||
|
run: python3 tools/api_checker/check_macros.py
|
||||||
|
|
||||||
|
- name: Check for uncommitted API surface changes
|
||||||
|
id: diff
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ github.workspace }}/patch
|
||||||
|
git diff --patch --no-color -- tools/api_checker/api_surface.json > ${{ github.workspace }}/patch/api_surface.patch
|
||||||
|
if [ -s ${{ github.workspace }}/patch/api_surface.patch ]; then
|
||||||
|
echo "tools/api_checker/api_surface.json is out of date. Diff:"
|
||||||
|
cat ${{ github.workspace }}/patch/api_surface.patch
|
||||||
|
echo "has_diff=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "has_diff=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Uploaded so contributors can fix their PR with `git apply api_surface.patch`
|
||||||
|
# instead of installing libclang locally.
|
||||||
|
- name: Upload patch
|
||||||
|
if: steps.diff.outputs.has_diff == 'true'
|
||||||
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
|
with:
|
||||||
|
name: api-surface-patch
|
||||||
|
path: patch/api_surface.patch
|
||||||
|
|
||||||
|
- name: Fail if API surface file is not up to date
|
||||||
|
# Unlike the doc-backlog check above, this is purely mechanical regeneration with no
|
||||||
|
# backlog to phase in -- blocking from the start, matching check_amalgamation.yml's
|
||||||
|
# precedent. Contributors who add/remove/rename public API must regenerate and commit
|
||||||
|
# tools/api_checker/api_surface.json as part of their PR.
|
||||||
|
if: steps.diff.outputs.has_diff == 'true'
|
||||||
|
run: exit 1
|
||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
issue_number: issue_number,
|
issue_number: issue_number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: '## 🔴 Amalgamation check failed! 🔴\nThe source code has not been amalgamated and/or formatted correctly, or `BUILD.bazel`, `nlohmann_json.natvis`, or the macro_builder tables in `macro_scope.hpp` are out of date. `make amalgamate BUILD.bazel natvis` fixes all but the tables (see `tools/macro_builder/README.md`).'
|
body: '## 🔴 Amalgamation check failed! 🔴\nThe source code has not been amalgamated and/or formatted correctly, or `BUILD.bazel` is out of date.'
|
||||||
+ (hasPatch ? '\n\n📎 A ready-to-apply patch is attached to the [failed workflow run](' + runUrl + ') as the `amalgamation-patch` artifact.'
|
+ (hasPatch ? '\n\n📎 A ready-to-apply patch is attached to the [failed workflow run](' + runUrl + ') as the `amalgamation-patch` artifact.'
|
||||||
+ ' Download it, then apply it locally from the repository root with:'
|
+ ' Download it, then apply it locally from the repository root with:'
|
||||||
+ '\n\n```shell\ngit apply amalgamation.patch\n```\n\n'
|
+ '\n\n```shell\ngit apply amalgamation.patch\n```\n\n'
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
security-events: write
|
security-events: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ on:
|
|||||||
- .github/SECURITY.md
|
- .github/SECURITY.md
|
||||||
- cmake/clang_flags.cmake
|
- cmake/clang_flags.cmake
|
||||||
- cmake/gcc_flags.cmake
|
- cmake/gcc_flags.cmake
|
||||||
- include/nlohmann/detail/abi_macros.hpp
|
|
||||||
- tests/fmt_formatter/project/main.cpp
|
- tests/fmt_formatter/project/main.cpp
|
||||||
- tools/astyle/.astylerc
|
- tools/astyle/.astylerc
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -37,7 +36,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -109,15 +109,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_test_single_header, ci_cppcheck, ci_cpplint, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_reuse_compliance, ci_test_valgrind]
|
target: [ci_test_amalgamation, ci_test_single_header, ci_cppcheck, ci_cpplint, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_reuse_compliance, ci_test_valgrind]
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Install Valgrind
|
- name: Install Valgrind
|
||||||
if: matrix.target == 'ci_test_valgrind'
|
|
||||||
run: sudo apt-get update ; sudo apt-get install -y valgrind
|
run: sudo apt-get update ; sudo apt-get install -y valgrind
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
@@ -178,7 +177,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -280,7 +279,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Get latest CMake and ninja
|
- name: Get latest CMake and ninja
|
||||||
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
||||||
- name: Disable filesystem support (std::filesystem is unusable) for clang 7 / 8 / 9 / 10
|
- name: Set env FORCE_STDCPPFS_FLAG for clang 7 / 8 / 9 / 10
|
||||||
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV"
|
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV"
|
||||||
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
|
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
@@ -433,7 +432,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -456,7 +455,7 @@ jobs:
|
|||||||
target: [ci_test_examples, ci_test_build_documentation, ci_test_documentation_mermaid]
|
target: [ci_test_examples, ci_test_build_documentation, ci_test_documentation_mermaid]
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0
|
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
||||||
|
|
||||||
clang-cl:
|
clang-cl-12:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -217,10 +217,8 @@ jobs:
|
|||||||
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
||||||
with:
|
with:
|
||||||
cmakeVersion: 4.3.4
|
cmakeVersion: 4.3.4
|
||||||
# CMAKE_CXX_FLAGS replaces CMake's MSVC defaults (which include /EHsc), and
|
|
||||||
# ci_module_cpp20 forwards it to the module build, so list /EHsc explicitly
|
|
||||||
- name: Run CMake (Debug)
|
- name: Run CMake (Debug)
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /EHsc /W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build --config Debug --target ci_module_cpp20
|
run: cmake --build build --config Debug --target ci_module_cpp20
|
||||||
|
|
||||||
+6
-14
@@ -3,6 +3,7 @@
|
|||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
/.idea
|
/.idea
|
||||||
/cmake-build-*
|
/cmake-build-*
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
/docs/docset/JSON_for_Modern_C++.tgz
|
/docs/docset/JSON_for_Modern_C++.tgz
|
||||||
/docs/docset/docSet.dsidx
|
/docs/docset/docSet.dsidx
|
||||||
/docs/mkdocs/.cache/
|
/docs/mkdocs/.cache/
|
||||||
|
/docs/mkdocs/docs/__pycache__/
|
||||||
/docs/mkdocs/hooks/__pycache__/
|
/docs/mkdocs/hooks/__pycache__/
|
||||||
/docs/mkdocs/scripts/mermaid/node_modules/
|
/docs/mkdocs/scripts/mermaid/node_modules/
|
||||||
/docs/mkdocs/site/
|
/docs/mkdocs/site/
|
||||||
@@ -44,19 +46,9 @@ venv
|
|||||||
|
|
||||||
nlohmann_json.spdx
|
nlohmann_json.spdx
|
||||||
|
|
||||||
|
# api_checker: ephemeral, location/doc-status-sensitive working file (not the committed
|
||||||
|
# release-tracking artifact -- see tools/api_checker/api_surface.json for that)
|
||||||
|
/tools/api_checker/api_snapshot.json
|
||||||
|
|
||||||
# Bazel-related
|
# Bazel-related
|
||||||
MODULE.bazel.lock
|
MODULE.bazel.lock
|
||||||
|
|
||||||
# backups left by `make check-amalgamation` or the ci_test_amalgamation target if they are interrupted
|
|
||||||
/BUILD.bazel~
|
|
||||||
/nlohmann_json.natvis~
|
|
||||||
/single_include/nlohmann/*.hpp~
|
|
||||||
/venv_astyle/
|
|
||||||
|
|
||||||
# release outputs of `make release`
|
|
||||||
/include.zip
|
|
||||||
/include.zip.asc
|
|
||||||
/json.tar.xz
|
|
||||||
/json.tar.xz.asc
|
|
||||||
/release_files/
|
|
||||||
/single_include/nlohmann/*.asc
|
|
||||||
@@ -25,7 +25,6 @@ cc_library(
|
|||||||
"include/nlohmann/detail/conversions/from_json.hpp",
|
"include/nlohmann/detail/conversions/from_json.hpp",
|
||||||
"include/nlohmann/detail/conversions/to_chars.hpp",
|
"include/nlohmann/detail/conversions/to_chars.hpp",
|
||||||
"include/nlohmann/detail/conversions/to_json.hpp",
|
"include/nlohmann/detail/conversions/to_json.hpp",
|
||||||
"include/nlohmann/detail/conversions/zmij.hpp",
|
|
||||||
"include/nlohmann/detail/exceptions.hpp",
|
"include/nlohmann/detail/exceptions.hpp",
|
||||||
"include/nlohmann/detail/hash.hpp",
|
"include/nlohmann/detail/hash.hpp",
|
||||||
"include/nlohmann/detail/input/binary_reader.hpp",
|
"include/nlohmann/detail/input/binary_reader.hpp",
|
||||||
@@ -82,7 +81,6 @@ cc_library(
|
|||||||
hdrs = [
|
hdrs = [
|
||||||
"single_include/nlohmann/json.hpp",
|
"single_include/nlohmann/json.hpp",
|
||||||
"single_include/nlohmann/json_fwd.hpp",
|
"single_include/nlohmann/json_fwd.hpp",
|
||||||
"single_include/nlohmann/json_literals.hpp",
|
|
||||||
],
|
],
|
||||||
includes = ["single_include"],
|
includes = ["single_include"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ authors:
|
|||||||
website: https://nlohmann.me
|
website: https://nlohmann.me
|
||||||
title: "JSON for Modern C++"
|
title: "JSON for Modern C++"
|
||||||
version: 3.12.0
|
version: 3.12.0
|
||||||
date-released: 2025-04-11
|
date-released: 2025-04-07
|
||||||
license: MIT
|
license: MIT
|
||||||
repository-code: "https://github.com/nlohmann/json"
|
repository-code: "https://github.com/nlohmann/json"
|
||||||
url: https://json.nlohmann.me
|
url: https://json.nlohmann.me
|
||||||
+1
-1
@@ -30,7 +30,7 @@ endif ()
|
|||||||
option(NLOHMANN_JSON_BUILD_MODULES "Build C++ modules support" OFF)
|
option(NLOHMANN_JSON_BUILD_MODULES "Build C++ modules support" OFF)
|
||||||
|
|
||||||
if(NLOHMANN_JSON_BUILD_MODULES)
|
if(NLOHMANN_JSON_BUILD_MODULES)
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 3.28)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
|
||||||
message(STATUS "Building nlohmann.json C++ module")
|
message(STATUS "Building nlohmann.json C++ module")
|
||||||
add_subdirectory(src/modules)
|
add_subdirectory(src/modules)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ This file describes the source for supporting files; that is, files that are not
|
|||||||
The [GitHub Actions](https://docs.github.com/en/actions) workflows that build, test, and analyze the library. Each file in this folder defines one workflow:
|
The [GitHub Actions](https://docs.github.com/en/actions) workflows that build, test, and analyze the library. Each file in this folder defines one workflow:
|
||||||
|
|
||||||
- `ubuntu.yml`, `macos.yml`, `windows.yml` — build and run the test suite on Linux, macOS, and Windows.
|
- `ubuntu.yml`, `macos.yml`, `windows.yml` — build and run the test suite on Linux, macOS, and Windows.
|
||||||
- `check_amalgamation.yml` — verify on pull requests and pushes to `develop` that the generated files (the single-header amalgamation in `single_include`, `BUILD.bazel`, and `nlohmann_json.natvis`) are up to date.
|
- `check_amalgamation.yml` — verify that the single-header amalgamation in `single_include` is up to date on pull requests.
|
||||||
- `comment_check_amalgamation.yml` — comment on a pull request when the amalgamation check failed.
|
- `comment_check_amalgamation.yml` — comment on a pull request when the amalgamation check failed.
|
||||||
- `cifuzz.yml` — run short fuzzing sessions via [OSS-Fuzz CIFuzz](https://google.github.io/oss-fuzz/getting-started/continuous-integration/) on pull requests.
|
- `cifuzz.yml` — run short fuzzing sessions via [OSS-Fuzz CIFuzz](https://google.github.io/oss-fuzz/getting-started/continuous-integration/) on pull requests.
|
||||||
- `codeql-analysis.yml` — run [CodeQL](https://codeql.github.com) code scanning.
|
- `codeql-analysis.yml` — run [CodeQL](https://codeql.github.com) code scanning.
|
||||||
@@ -24,9 +24,7 @@ The [GitHub Actions](https://docs.github.com/en/actions) workflows that build, t
|
|||||||
- `dependency-review.yml` — scan dependency changes in pull requests for known vulnerabilities.
|
- `dependency-review.yml` — scan dependency changes in pull requests for known vulnerabilities.
|
||||||
- `labeler.yml` — the "Pull Request Labeler" workflow (see `.github/labeler.yml`).
|
- `labeler.yml` — the "Pull Request Labeler" workflow (see `.github/labeler.yml`).
|
||||||
- `stale.yml` — comment on and close stale issues and pull requests.
|
- `stale.yml` — comment on and close stale issues and pull requests.
|
||||||
- `publish_documentation.yml` — build and publish the documentation on pushes to the `develop` branch that touch the documentation sources (or the files it embeds).
|
- `publish_documentation.yml` — build and publish the documentation on every merge to the `develop` branch.
|
||||||
- `check_docs_links.yml` — check the links of the documentation weekly, as external links can break without any change in this repository.
|
|
||||||
- `cancel_closed_pr_runs.yml` — cancel unfinished workflow runs of a pull request once it is closed or merged.
|
|
||||||
|
|
||||||
Further documentation:
|
Further documentation:
|
||||||
|
|
||||||
@@ -268,9 +266,8 @@ meson setup builddir
|
|||||||
ninja -C builddir
|
ninja -C builddir
|
||||||
```
|
```
|
||||||
|
|
||||||
`meson_options.txt` defines the options, which mirror the names of the CMake options that change the library's target (for example,
|
`meson_options.txt` defines the options, which mirror the CMake options that change the library's target (for example,
|
||||||
`-DDiagnostics=true`); their defaults may differ (for example, `MultipleHeaders` defaults to `false` in Meson, while
|
`-DDiagnostics=true`). Meson requires this file next to `meson.build`, so it is also part of `include.zip`. `make check_build_options`
|
||||||
`JSON_MultipleHeaders` is `ON` in CMake). Meson requires this file next to `meson.build`, so it is also part of `include.zip`. `make check_build_options`
|
|
||||||
([`tools/check_build_options`](tools/check_build_options/README.md)) checks in CI that both files and the pkg-config files
|
([`tools/check_build_options`](tools/check_build_options/README.md)) checks in CI that both files and the pkg-config files
|
||||||
stay in sync with the CMake options.
|
stay in sync with the CMake options.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
module(
|
module(
|
||||||
name = "nlohmann_json",
|
name = "nlohmann_json",
|
||||||
version = "3.12.0",
|
|
||||||
compatibility_level = 1,
|
compatibility_level = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: all amalgamate check-amalgamation check_build_options pretty install_astyle clean ChangeLog.md release update_hedley update_hedley_undef BUILD.bazel natvis macro_builder_check run_benchmarks pvs_studio serve_header reuse spdx
|
.PHONY: pretty clean ChangeLog.md release update_hedley update_hedley_undef BUILD.bazel natvis macro_builder_check check_build_options
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# configuration
|
# configuration
|
||||||
@@ -41,18 +41,12 @@ all:
|
|||||||
@echo "BUILD.bazel - regenerate the Bazel BUILD file from the include/nlohmann sources"
|
@echo "BUILD.bazel - regenerate the Bazel BUILD file from the include/nlohmann sources"
|
||||||
@echo "ChangeLog.md - generate ChangeLog file"
|
@echo "ChangeLog.md - generate ChangeLog file"
|
||||||
@echo "check-amalgamation - check whether sources have been amalgamated and BUILD.bazel is up to date"
|
@echo "check-amalgamation - check whether sources have been amalgamated and BUILD.bazel is up to date"
|
||||||
@echo "check_build_options - check that the Meson build and the pkg-config files offer the options of the CMake target"
|
|
||||||
@echo "clean - remove built files"
|
@echo "clean - remove built files"
|
||||||
@echo "(fuzzers) - see tests/fuzzing.md, or run 'make -C tests fuzzers' to build the AFL fuzzers"
|
@echo "fuzzing - see tests/fuzzing.md for how to build and run the fuzzers"
|
||||||
@echo "macro_builder_check - check that macro_scope.hpp matches tools/macro_builder's output"
|
@echo "macro_builder_check - check that macro_scope.hpp matches tools/macro_builder's output"
|
||||||
@echo "natvis - regenerate nlohmann_json.natvis from the current ABI tags and version"
|
@echo "natvis - regenerate nlohmann_json.natvis from the current ABI tags and version"
|
||||||
@echo "pretty - beautify code with Artistic Style"
|
@echo "pretty - beautify code with Artistic Style"
|
||||||
@echo "pvs_studio - run the PVS-Studio static analyzer and open the report"
|
|
||||||
@echo "release - create the release files (include.zip, json.tar.xz, single headers, signatures, hashes)"
|
|
||||||
@echo "reuse - annotate the source files with REUSE license headers and lint them"
|
|
||||||
@echo "run_benchmarks - build and run benchmarks"
|
@echo "run_benchmarks - build and run benchmarks"
|
||||||
@echo "serve_header - serve the single header, re-amalgamated on demand (see tools/serve_header)"
|
|
||||||
@echo "spdx - generate the SPDX software bill of materials nlohmann_json.spdx"
|
|
||||||
@echo "update_hedley - download Hedley and regenerate hedley.hpp / hedley_undef.hpp"
|
@echo "update_hedley - download Hedley and regenerate hedley.hpp / hedley_undef.hpp"
|
||||||
@echo "update_hedley_undef - rebuild hedley_undef.hpp from the JSON_HEDLEY_* #define names in hedley.hpp"
|
@echo "update_hedley_undef - rebuild hedley_undef.hpp from the JSON_HEDLEY_* #define names in hedley.hpp"
|
||||||
|
|
||||||
@@ -114,18 +108,13 @@ $(AMALGAMATED_FWD_FILE): $(SRCS)
|
|||||||
$(AMALGAMATED_LITERALS_FILE): include/nlohmann/json_literals.hpp
|
$(AMALGAMATED_LITERALS_FILE): include/nlohmann/json_literals.hpp
|
||||||
cp include/nlohmann/json_literals.hpp $(AMALGAMATED_LITERALS_FILE)
|
cp include/nlohmann/json_literals.hpp $(AMALGAMATED_LITERALS_FILE)
|
||||||
|
|
||||||
NATVIS_VENV=tools/generate_natvis/venv
|
|
||||||
|
|
||||||
# regenerate nlohmann_json.natvis from the ABI tags and version in include/nlohmann/detail/abi_macros.hpp
|
# regenerate nlohmann_json.natvis from the ABI tags and version in include/nlohmann/detail/abi_macros.hpp
|
||||||
# (the dependencies are installed into a virtual environment first)
|
|
||||||
natvis:
|
natvis:
|
||||||
@test -d $(NATVIS_VENV) || python3 -mvenv $(NATVIS_VENV)
|
python3 tools/generate_natvis/generate_natvis.py .
|
||||||
@$(NATVIS_VENV)/bin/python3 -c 'import jinja2' 2>/dev/null || $(NATVIS_VENV)/bin/pip3 install --quiet -r tools/generate_natvis/requirements.txt
|
|
||||||
$(NATVIS_VENV)/bin/python3 tools/generate_natvis/generate_natvis.py .
|
|
||||||
|
|
||||||
# regenerate the two tools/macro_builder blocks of $(MACRO_SCOPE_HPP) (see its README.md) and diff against the
|
# regenerate the two tools/macro_builder blocks of $(MACRO_SCOPE_HPP) (see its README.md) and diff against the
|
||||||
# checked-in header; phony, because it never writes $(MACRO_SCOPE_HPP) itself
|
# checked-in header; phony, because it never writes $(MACRO_SCOPE_HPP) itself
|
||||||
macro_builder_check: install_astyle
|
macro_builder_check:
|
||||||
@set -e; \
|
@set -e; \
|
||||||
TMPDIR=$$(mktemp -d ./macro_builder_check.XXXXXX); \
|
TMPDIR=$$(mktemp -d ./macro_builder_check.XXXXXX); \
|
||||||
trap 'rm -rf "$$TMPDIR"' EXIT; \
|
trap 'rm -rf "$$TMPDIR"' EXIT; \
|
||||||
@@ -142,27 +131,27 @@ macro_builder_check: install_astyle
|
|||||||
check_build_options:
|
check_build_options:
|
||||||
python3 tools/check_build_options/check_build_options.py .
|
python3 tools/check_build_options/check_build_options.py .
|
||||||
|
|
||||||
# check if the single headers have been amalgamated from the nlohmann sources and if BUILD.bazel and
|
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
||||||
# nlohmann_json.natvis are up to date; all checks are run, and the checked-in files are always restored
|
|
||||||
check-amalgamation:
|
check-amalgamation:
|
||||||
@status=0; \
|
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
||||||
banner() { printf '===================================================================\n %s\n===================================================================\n' "$$1"; }; \
|
@mv $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~
|
||||||
for FILE in $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE) BUILD.bazel nlohmann_json.natvis; do \
|
@mv $(AMALGAMATED_LITERALS_FILE) $(AMALGAMATED_LITERALS_FILE)~
|
||||||
mv "$$FILE" "$$FILE~" || exit 1; \
|
@$(MAKE) amalgamate
|
||||||
done; \
|
@diff $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE) ; false)
|
||||||
$(MAKE) amalgamate || status=1; \
|
@diff $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE) ; false)
|
||||||
$(MAKE) BUILD.bazel || status=1; \
|
@diff $(AMALGAMATED_LITERALS_FILE) $(AMALGAMATED_LITERALS_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_LITERALS_FILE)~ $(AMALGAMATED_LITERALS_FILE) ; false)
|
||||||
$(MAKE) natvis || status=1; \
|
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
||||||
for FILE in $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE); do \
|
@mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE)
|
||||||
diff "$$FILE" "$$FILE~" || { banner "$$FILE is out of date! Amalgamation required! Please read the contribution guidelines in file .github/CONTRIBUTING.md."; status=1; }; \
|
@mv $(AMALGAMATED_LITERALS_FILE)~ $(AMALGAMATED_LITERALS_FILE)
|
||||||
done; \
|
@mv BUILD.bazel BUILD.bazel~
|
||||||
diff BUILD.bazel BUILD.bazel~ || { banner "BUILD.bazel is out of date! Please run 'make BUILD.bazel'."; status=1; }; \
|
@$(MAKE) BUILD.bazel
|
||||||
diff nlohmann_json.natvis nlohmann_json.natvis~ || { banner "nlohmann_json.natvis is out of date! Please run 'make natvis'."; status=1; }; \
|
@diff BUILD.bazel BUILD.bazel~ || (echo "===================================================================\n BUILD.bazel is out of date! Please run 'make BUILD.bazel'.\n===================================================================" ; mv BUILD.bazel~ BUILD.bazel ; false)
|
||||||
for FILE in $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE) BUILD.bazel nlohmann_json.natvis; do \
|
@mv BUILD.bazel~ BUILD.bazel
|
||||||
mv "$$FILE~" "$$FILE"; \
|
@mv nlohmann_json.natvis nlohmann_json.natvis~
|
||||||
done; \
|
@$(MAKE) natvis
|
||||||
$(MAKE) macro_builder_check || status=1; \
|
@diff nlohmann_json.natvis nlohmann_json.natvis~ || (echo "===================================================================\n nlohmann_json.natvis is out of date! Please run 'make natvis'.\n===================================================================" ; mv nlohmann_json.natvis~ nlohmann_json.natvis ; false)
|
||||||
exit $$status
|
@mv nlohmann_json.natvis~ nlohmann_json.natvis
|
||||||
|
@$(MAKE) macro_builder_check
|
||||||
|
|
||||||
# generate the Bazel BUILD file; phony, because a removed header would not trigger a rebuild
|
# generate the Bazel BUILD file; phony, because a removed header would not trigger a rebuild
|
||||||
BUILD.bazel:
|
BUILD.bazel:
|
||||||
@@ -223,8 +212,8 @@ release: include.zip json.tar.xz
|
|||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
clean:
|
clean:
|
||||||
rm -fr *.dSYM tests/*.dSYM tests/parse_*_fuzzer
|
rm -fr fuzz fuzz-testing *.dSYM tests/*.dSYM
|
||||||
rm -fr cmake-build-benchmarks cmake-build-pvs-studio release_files
|
rm -fr cmake-build-benchmarks fuzz-testing cmake-build-pvs-studio release_files
|
||||||
$(MAKE) clean -Cdocs
|
$(MAKE) clean -Cdocs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-8
@@ -10,10 +10,10 @@ SPDX-FileCopyrightText = "2013-2026 Niels Lohmann <https://nlohmann.me>"
|
|||||||
SPDX-License-Identifier = "MIT"
|
SPDX-License-Identifier = "MIT"
|
||||||
|
|
||||||
[[annotations]]
|
[[annotations]]
|
||||||
path = "include/nlohmann/thirdparty/hedley/hedley.hpp"
|
path = "include/nlohmann/thirdparty/hedley.hpp"
|
||||||
precedence = "aggregate"
|
precedence = "aggregate"
|
||||||
SPDX-FileCopyrightText = "2016-2021 Evan Nemerson <evan@nemerson.com>"
|
SPDX-FileCopyrightText = "2016-2021 Evan Nemerson <evan@nemerson.com>"
|
||||||
SPDX-License-Identifier = "CC0-1.0"
|
SPDX-License-Identifier = "CC0"
|
||||||
|
|
||||||
[[annotations]]
|
[[annotations]]
|
||||||
path = "include/nlohmann/detail/meta/cpp_future.hpp"
|
path = "include/nlohmann/detail/meta/cpp_future.hpp"
|
||||||
@@ -50,9 +50,3 @@ path = "tools/gdb_pretty_printer/**"
|
|||||||
precedence = "aggregate"
|
precedence = "aggregate"
|
||||||
SPDX-FileCopyrightText = "2020 Hannes Domani <https://github.com/ssbssa>"
|
SPDX-FileCopyrightText = "2020 Hannes Domani <https://github.com/ssbssa>"
|
||||||
SPDX-License-Identifier = "MIT"
|
SPDX-License-Identifier = "MIT"
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = "docs/docset/icon*.png"
|
|
||||||
precedence = "override"
|
|
||||||
SPDX-FileCopyrightText = "JSON logo (public domain), https://commons.wikimedia.org/wiki/File:JSON_vector_logo.svg"
|
|
||||||
SPDX-License-Identifier = "CC0-1.0"
|
|
||||||
+24
-33
@@ -5,14 +5,15 @@ set(N 10)
|
|||||||
# Needed tools.
|
# Needed tools.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
include(FindPython3)
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
find_program(CLANG_TOOL NAMES clang++ clang++-HEAD clang++-22 clang++-21 clang++-20 clang++-19 clang++-18 clang++-17 clang++-16 clang++-15 clang++-14 clang++-13 clang++-12 clang++-11)
|
find_program(CLANG_TOOL NAMES clang++-HEAD clang++ clang++-22 clang++-21 clang++-20 clang++-19 clang++-18 clang++-17 clang++-16 clang++-15 clang++-14 clang++-13 clang++-12 clang++-11 clang++)
|
||||||
execute_process(COMMAND ${CLANG_TOOL} --version OUTPUT_VARIABLE CLANG_TOOL_VERSION ERROR_VARIABLE CLANG_TOOL_VERSION)
|
execute_process(COMMAND ${CLANG_TOOL} --version OUTPUT_VARIABLE CLANG_TOOL_VERSION ERROR_VARIABLE CLANG_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TOOL_VERSION "${CLANG_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TOOL_VERSION "${CLANG_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 Clang ${CLANG_TOOL_VERSION} (${CLANG_TOOL})")
|
message(STATUS "🔖 Clang ${CLANG_TOOL_VERSION} (${CLANG_TOOL})")
|
||||||
|
|
||||||
find_program(CLANG_TIDY_TOOL NAMES clang-tidy clang-tidy-22 clang-tidy-21 clang-tidy-20 clang-tidy-19 clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15 clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
|
find_program(CLANG_TIDY_TOOL NAMES clang-tidy-22 clang-tidy-21 clang-tidy-20 clang-tidy-19 clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15 clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11 clang-tidy)
|
||||||
execute_process(COMMAND ${CLANG_TIDY_TOOL} --version OUTPUT_VARIABLE CLANG_TIDY_TOOL_VERSION ERROR_VARIABLE CLANG_TIDY_TOOL_VERSION)
|
execute_process(COMMAND ${CLANG_TIDY_TOOL} --version OUTPUT_VARIABLE CLANG_TIDY_TOOL_VERSION ERROR_VARIABLE CLANG_TIDY_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TIDY_TOOL_VERSION "${CLANG_TIDY_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TIDY_TOOL_VERSION "${CLANG_TIDY_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 Clang-Tidy ${CLANG_TIDY_TOOL_VERSION} (${CLANG_TIDY_TOOL})")
|
message(STATUS "🔖 Clang-Tidy ${CLANG_TIDY_TOOL_VERSION} (${CLANG_TIDY_TOOL})")
|
||||||
@@ -68,7 +69,9 @@ string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" VALGRIND_TOOL_VERSION "${VALGRIND_TOOL_V
|
|||||||
message(STATUS "🔖 Valgrind ${VALGRIND_TOOL_VERSION} (${VALGRIND_TOOL})")
|
message(STATUS "🔖 Valgrind ${VALGRIND_TOOL_VERSION} (${VALGRIND_TOOL})")
|
||||||
|
|
||||||
find_program(GENHTML_TOOL NAMES genhtml)
|
find_program(GENHTML_TOOL NAMES genhtml)
|
||||||
find_program(SCAN_BUILD_TOOL NAMES scan-build scan-build-22 scan-build-21 scan-build-20 scan-build-19 scan-build-18 scan-build-17 scan-build-16 scan-build-15 scan-build-14 scan-build-13 scan-build-12 scan-build-11)
|
find_program(PLOG_CONVERTER_TOOL NAMES plog-converter)
|
||||||
|
find_program(PVS_STUDIO_ANALYZER_TOOL NAMES pvs-studio-analyzer)
|
||||||
|
find_program(SCAN_BUILD_TOOL NAMES scan-build-15 scan-build-14 scan-build-13 scan-build-12 scan-build-11 scan-build)
|
||||||
|
|
||||||
# the individual source files
|
# the individual source files
|
||||||
file(GLOB_RECURSE SRC_FILES ${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp)
|
file(GLOB_RECURSE SRC_FILES ${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp)
|
||||||
@@ -364,7 +367,7 @@ add_custom_target(ci_test_coverage
|
|||||||
COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch --ignore-errors unused
|
COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch --ignore-errors unused
|
||||||
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc branch_coverage=1 --ignore-errors unused
|
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc branch_coverage=1 --ignore-errors unused
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
|
||||||
COMMAND ${GENHTML_TOOL} --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
|
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
|
||||||
|
|
||||||
COMMENT "Compile and test with coverage"
|
COMMENT "Compile and test with coverage"
|
||||||
)
|
)
|
||||||
@@ -389,8 +392,8 @@ add_custom_target(ci_test_clang_sanitizer
|
|||||||
# Check if header is amalgamated and sources are properly indented.
|
# Check if header is amalgamated and sources are properly indented.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Same file set as .github/workflows/check_amalgamation.yml, so this CMake target (which can be run locally) is held
|
# Same file set as .github/workflows/check_amalgamation.yml, so a direct push to develop/master/release/*
|
||||||
# to the same standard as the workflow (which runs for pull requests and for pushes to develop/master/release/*).
|
# (which only this CMake target checks, not the pull_request-only workflow) is held to the same standard.
|
||||||
file(GLOB_RECURSE INDENT_FILES
|
file(GLOB_RECURSE INDENT_FILES
|
||||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.hpp
|
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cpp
|
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cpp
|
||||||
@@ -420,7 +423,7 @@ add_custom_target(ci_test_amalgamation
|
|||||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json.json -s .
|
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json.json -s .
|
||||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_fwd.json -s .
|
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_fwd.json -s .
|
||||||
COMMAND cp ${PROJECT_SOURCE_DIR}/include/nlohmann/json_literals.hpp ${include_dir}/json_literals.hpp
|
COMMAND cp ${PROJECT_SOURCE_DIR}/include/nlohmann/json_literals.hpp ${include_dir}/json_literals.hpp
|
||||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp ${include_dir}/json_literals.hpp
|
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/scripts/gen_bazel_build_file.cmake
|
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/scripts/gen_bazel_build_file.cmake
|
||||||
|
|
||||||
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||||
@@ -431,8 +434,6 @@ add_custom_target(ci_test_amalgamation
|
|||||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=orig ${INDENT_FILES}
|
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=orig ${INDENT_FILES}
|
||||||
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
||||||
|
|
||||||
COMMAND rm -f ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~ ${include_dir}/json_literals.hpp~ ${PROJECT_SOURCE_DIR}/BUILD.bazel~
|
|
||||||
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
COMMENT "Check amalgamation, formatting, and BUILD.bazel"
|
COMMENT "Check amalgamation, formatting, and BUILD.bazel"
|
||||||
)
|
)
|
||||||
@@ -610,8 +611,9 @@ foreach(SRC_FILE ${SRC_FILES})
|
|||||||
add_executable(single_${RELATIVE_SRC_FILE} EXCLUDE_FROM_ALL ${PROJECT_BINARY_DIR}/src_single/${RELATIVE_SRC_FILE}.cpp)
|
add_executable(single_${RELATIVE_SRC_FILE} EXCLUDE_FROM_ALL ${PROJECT_BINARY_DIR}/src_single/${RELATIVE_SRC_FILE}.cpp)
|
||||||
target_include_directories(single_${RELATIVE_SRC_FILE} PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
target_include_directories(single_${RELATIVE_SRC_FILE} PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||||
target_compile_features(single_${RELATIVE_SRC_FILE} PRIVATE cxx_std_11)
|
target_compile_features(single_${RELATIVE_SRC_FILE} PRIVATE cxx_std_11)
|
||||||
if(RELATIVE_SRC_FILE STREQUAL "json")
|
if(RELATIVE_SRC_FILE STREQUAL "json" OR RELATIVE_SRC_FILE STREQUAL "json_literals")
|
||||||
# see below: report the diagnostics of json.hpp without --error, so they do not fail the build
|
# see below: report the diagnostics of json.hpp and json_literals.hpp without --error, so they
|
||||||
|
# do not fail the build
|
||||||
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${IWYU_TOOL} -Xiwyu --max_line_length=300)
|
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${IWYU_TOOL} -Xiwyu --max_line_length=300)
|
||||||
else()
|
else()
|
||||||
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}")
|
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}")
|
||||||
@@ -625,31 +627,18 @@ foreach(SRC_FILE ${SRC_FILES})
|
|||||||
# reporting its diagnostics (informational, via CXX_INCLUDE_WHAT_YOU_USE above) but exclude it
|
# reporting its diagnostics (informational, via CXX_INCLUDE_WHAT_YOU_USE above) but exclude it
|
||||||
# from the hard gate below so a fresh IWYU/compiler combination does not fail this target on a
|
# from the hard gate below so a fresh IWYU/compiler combination does not fail this target on a
|
||||||
# nondeterministic suggestion for a header that already re-exports everything on purpose.
|
# nondeterministic suggestion for a header that already re-exports everything on purpose.
|
||||||
if(NOT RELATIVE_SRC_FILE STREQUAL "json")
|
# json_literals.hpp and json.hpp include each other on purpose (json.hpp includes it at its end
|
||||||
|
# unless JSON_NO_AUTOMATIC_UDLS is defined), and IWYU, not following the cycle, suggests replacing
|
||||||
|
# json.hpp with json_fwd.hpp although the literals need the complete basic_json; exclude it, too.
|
||||||
|
if(NOT RELATIVE_SRC_FILE STREQUAL "json" AND NOT RELATIVE_SRC_FILE STREQUAL "json_literals")
|
||||||
list(APPEND single_binaries_tus src_single/${RELATIVE_SRC_FILE}.cpp)
|
list(APPEND single_binaries_tus src_single/${RELATIVE_SRC_FILE}.cpp)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# The checks above look at each header on its own. Client code that includes only <nlohmann/json.hpp>
|
|
||||||
# must not be told by include analyzers to include another nlohmann header for what it uses
|
|
||||||
# (issue #5812): json.hpp marks those includes "IWYU pragma: export", and both IWYU and clang-tidy's
|
|
||||||
# misc-include-cleaner (disabled in .clang-tidy for the library itself) check these clients.
|
|
||||||
file(GLOB CONSUMER_FILES ${PROJECT_SOURCE_DIR}/tests/iwyu_consumer/*.cpp)
|
|
||||||
foreach(CONSUMER_FILE ${CONSUMER_FILES})
|
|
||||||
get_filename_component(CONSUMER_NAME "${CONSUMER_FILE}" NAME_WE)
|
|
||||||
add_executable(iwyu_consumer_${CONSUMER_NAME} EXCLUDE_FROM_ALL ${CONSUMER_FILE})
|
|
||||||
target_include_directories(iwyu_consumer_${CONSUMER_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
|
||||||
target_compile_features(iwyu_consumer_${CONSUMER_NAME} PRIVATE cxx_std_11)
|
|
||||||
list(APPEND single_binaries iwyu_consumer_${CONSUMER_NAME})
|
|
||||||
list(APPEND single_binaries_tus ${CONSUMER_FILE})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if(IWYU_TOOL_PY)
|
if(IWYU_TOOL_PY)
|
||||||
add_custom_target(ci_single_binaries
|
add_custom_target(ci_single_binaries
|
||||||
DEPENDS ${single_binaries}
|
DEPENDS ${single_binaries}
|
||||||
COMMAND ${IWYU_TOOL_PY} -p ${PROJECT_BINARY_DIR} ${single_binaries_tus} -- ${iwyu_options}
|
COMMAND ${IWYU_TOOL_PY} -p ${PROJECT_BINARY_DIR} ${single_binaries_tus} -- ${iwyu_options}
|
||||||
COMMAND ${CLANG_TIDY_TOOL} -p ${PROJECT_BINARY_DIR} --checks=-*,misc-include-cleaner --warnings-as-errors=* ${CONSUMER_FILES}
|
|
||||||
VERBATIM
|
|
||||||
COMMENT "Check if headers are self-contained"
|
COMMENT "Check if headers are self-contained"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
@@ -730,7 +719,7 @@ ci_get_cmake(4.0.0 CMAKE_4_0_0_BINARY)
|
|||||||
|
|
||||||
# the tests require CMake 3.13 or later, so they are excluded for CMake 3.5.0
|
# the tests require CMake 3.13 or later, so they are excluded for CMake 3.5.0
|
||||||
set(JSON_CMAKE_FLAGS_3_5_0 JSON_Diagnostics JSON_Diagnostic_Positions JSON_GlobalUDLs JSON_ImplicitConversions JSON_DisableEnumSerialization
|
set(JSON_CMAKE_FLAGS_3_5_0 JSON_Diagnostics JSON_Diagnostic_Positions JSON_GlobalUDLs JSON_ImplicitConversions JSON_DisableEnumSerialization
|
||||||
JSON_DisableTupleReferenceConversion JSON_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind
|
JSON_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind
|
||||||
JSON_StrictNulHandling JSON_StrictBinaryUTF8 JSON_DeleteDeprecatedFunctions)
|
JSON_StrictNulHandling JSON_StrictBinaryUTF8 JSON_DeleteDeprecatedFunctions)
|
||||||
set(JSON_CMAKE_FLAGS_3_31_6 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_5_0})
|
set(JSON_CMAKE_FLAGS_3_31_6 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_5_0})
|
||||||
set(JSON_CMAKE_FLAGS_4_0_0 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_5_0})
|
set(JSON_CMAKE_FLAGS_4_0_0 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_5_0})
|
||||||
@@ -787,14 +776,17 @@ add_custom_target(ci_cmake_flags
|
|||||||
# Use more installed compilers.
|
# Use more installed compilers.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6)
|
foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14 clang++-15 clang++-16 clang++-17 clang++-18 clang++-19 clang++-20)
|
||||||
find_program(COMPILER_TOOL NAMES ${COMPILER})
|
find_program(COMPILER_TOOL NAMES ${COMPILER})
|
||||||
if (COMPILER_TOOL)
|
if (COMPILER_TOOL)
|
||||||
|
unset(ADDITIONAL_FLAGS)
|
||||||
|
|
||||||
add_custom_target(ci_test_compiler_${COMPILER}
|
add_custom_target(ci_test_compiler_${COMPILER}
|
||||||
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}
|
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_${COMPILER}
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_${COMPILER}
|
||||||
|
${ADDITIONAL_FLAGS}
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_${COMPILER}
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_${COMPILER}
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_${COMPILER} && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_${COMPILER} && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||||
COMMENT "Compile and test with ${COMPILER}"
|
COMMENT "Compile and test with ${COMPILER}"
|
||||||
@@ -808,6 +800,7 @@ add_custom_target(ci_test_compiler_default
|
|||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_default
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_default
|
||||||
|
${ADDITIONAL_FLAGS}
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_default --parallel ${N}
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_default --parallel ${N}
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_default && ${CMAKE_CTEST_COMMAND} --parallel ${N} -LE git_required --output-on-failure
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_default && ${CMAKE_CTEST_COMMAND} --parallel ${N} -LE git_required --output-on-failure
|
||||||
COMMENT "Compile and test with default C++ compiler"
|
COMMENT "Compile and test with default C++ compiler"
|
||||||
@@ -830,12 +823,10 @@ add_custom_target(ci_cuda_example
|
|||||||
|
|
||||||
add_custom_target(ci_module_cpp20
|
add_custom_target(ci_module_cpp20
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_CI=ON -DNLOHMANN_JSON_BUILD_MODULES=ON -DJSON_Install=ON
|
-DJSON_CI=ON -DNLOHMANN_JSON_BUILD_MODULES=ON -DJSON_Install=ON
|
||||||
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
|
|
||||||
-S${PROJECT_SOURCE_DIR}/tests/module_cpp20 -B${PROJECT_BINARY_DIR}/ci_module_cpp20
|
-S${PROJECT_SOURCE_DIR}/tests/module_cpp20 -B${PROJECT_BINARY_DIR}/ci_module_cpp20
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/ci_module_cpp20
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/ci_module_cpp20
|
||||||
VERBATIM
|
|
||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ cc_library(
|
|||||||
hdrs = [
|
hdrs = [
|
||||||
"single_include/nlohmann/json.hpp",
|
"single_include/nlohmann/json.hpp",
|
||||||
"single_include/nlohmann/json_fwd.hpp",
|
"single_include/nlohmann/json_fwd.hpp",
|
||||||
"single_include/nlohmann/json_literals.hpp",
|
|
||||||
],
|
],
|
||||||
includes = ["single_include"],
|
includes = ["single_include"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
|||||||
+2
-2
@@ -7,12 +7,12 @@ This URL provides the most recent documentation and also applies to previous ver
|
|||||||
functions is not removed; instead, it is marked as deprecated.
|
functions is not removed; instead, it is marked as deprecated.
|
||||||
|
|
||||||
If you want to view the documentation for a specific tag or commit hash, you can generate it locally as follows (example
|
If you want to view the documentation for a specific tag or commit hash, you can generate it locally as follows (example
|
||||||
using tag `v3.12.0`):
|
using tag `v3.10.2`):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/nlohmann/json.git
|
git clone https://github.com/nlohmann/json.git
|
||||||
cd json
|
cd json
|
||||||
git checkout v3.12.0
|
git checkout v3.10.2
|
||||||
make install_venv serve -C docs/mkdocs
|
make install_venv serve -C docs/mkdocs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+55
-11
@@ -1,24 +1,48 @@
|
|||||||
SHELL=/usr/bin/env bash
|
SHELL=/usr/bin/env bash
|
||||||
PYTHON=../mkdocs/venv/bin/python3
|
SED ?= $(shell which gsed 2>/dev/null || which sed)
|
||||||
|
|
||||||
|
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: JSON_for_Modern_C++.tgz
|
all: JSON_for_Modern_C++.tgz
|
||||||
|
|
||||||
# generate the search index (the docset target does this itself, this is
|
docSet.dsidx: docSet.sql
|
||||||
# only handy for inspecting the index)
|
# generate index
|
||||||
docSet.dsidx: generate_docset.py
|
sqlite3 docSet.dsidx <docSet.sql
|
||||||
$(PYTHON) generate_docset.py index docSet.dsidx
|
|
||||||
|
|
||||||
# build the documentation and turn it into a self-contained docset
|
JSON_for_Modern_C++.docset: Info.plist docSet.dsidx
|
||||||
.PHONY: JSON_for_Modern_C++.docset
|
rm -fr JSON_for_Modern_C++.docset JSON_for_Modern_C++.tgz
|
||||||
JSON_for_Modern_C++.docset:
|
mkdir -p JSON_for_Modern_C++.docset/Contents/Resources/Documents/
|
||||||
|
cp icon*.png JSON_for_Modern_C++.docset
|
||||||
|
cp Info.plist JSON_for_Modern_C++.docset/Contents
|
||||||
|
# build and copy documentation
|
||||||
$(MAKE) install_venv -C ../mkdocs
|
$(MAKE) install_venv -C ../mkdocs
|
||||||
$(MAKE) build -C ../mkdocs
|
$(MAKE) build -C ../mkdocs
|
||||||
$(PYTHON) generate_docset.py docset ../mkdocs/site .
|
cp -r ../mkdocs/site/* JSON_for_Modern_C++.docset/Contents/Resources/Documents
|
||||||
|
# patch CSS to hide navigation items
|
||||||
|
echo -e "\n\nheader, footer, nav.md-tabs, nav.md-tabs--active, div.md-sidebar--primary, a.md-content__button { display: none; }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)"
|
||||||
|
# fix spacing
|
||||||
|
echo -e "\n\ndiv.md-sidebar div.md-sidebar--secondary, div.md-main__inner { top: 0; margin-top: 0 }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)"
|
||||||
|
# remove "JSON for Modern C++" from page titles (fallback)
|
||||||
|
find JSON_for_Modern_C++.docset/Contents/Resources/Documents -type f -exec $(SED) -i 's| - JSON for Modern C++</title>|</title>|' {} +
|
||||||
|
# replace page titles with name from index, if available
|
||||||
|
for page in $(MKDOCS_PAGES); do \
|
||||||
|
case "$$page" in \
|
||||||
|
*/index.md) path=$${page/\/index.md/} ;; \
|
||||||
|
*) path=$${page/.md/} ;; \
|
||||||
|
esac; \
|
||||||
|
title=$$(sqlite3 docSet.dsidx "SELECT name FROM searchIndex WHERE path='$$path/index.html'" | tr '\n' ',' | $(SED) -e 's/,/, /g' -e 's/, $$/\n/'); \
|
||||||
|
if [ "x$$title" != "x" ]; then \
|
||||||
|
$(SED) -i "s%<title>.*</title>%<title>$$title</title>%" "JSON_for_Modern_C++.docset/Contents/Resources/Documents/$$path/index.html"; \
|
||||||
|
fi \
|
||||||
|
done
|
||||||
|
# clean up
|
||||||
|
rm JSON_for_Modern_C++.docset/Contents/Resources/Documents/sitemap.*
|
||||||
|
# copy index
|
||||||
|
cp docSet.dsidx JSON_for_Modern_C++.docset/Contents/Resources/
|
||||||
|
|
||||||
.PHONY: JSON_for_Modern_C++.tgz
|
|
||||||
JSON_for_Modern_C++.tgz: JSON_for_Modern_C++.docset
|
JSON_for_Modern_C++.tgz: JSON_for_Modern_C++.docset
|
||||||
$(PYTHON) generate_docset.py tgz .
|
tar --exclude='.DS_Store' -cvzf JSON_for_Modern_C++.tgz JSON_for_Modern_C++.docset
|
||||||
|
|
||||||
# install docset for Zeal documentation browser (https://zealdocs.org/)
|
# install docset for Zeal documentation browser (https://zealdocs.org/)
|
||||||
.PHONY: install_docset_zeal
|
.PHONY: install_docset_zeal
|
||||||
@@ -28,6 +52,26 @@ install_docset_zeal: JSON_for_Modern_C++.docset
|
|||||||
mkdir -p $$docset_root; \
|
mkdir -p $$docset_root; \
|
||||||
cp -r JSON_for_Modern_C++.docset $$docset_root/
|
cp -r JSON_for_Modern_C++.docset $$docset_root/
|
||||||
|
|
||||||
|
# both targets below compare the docset search index with the mkdocs page
|
||||||
|
# set. They share the same normalization (docs/foo/index.md and
|
||||||
|
# docs/foo.md both become foo/index.html, the URL mkdocs itself would
|
||||||
|
# give the page; the top-level index.md is excluded, as it is not part
|
||||||
|
# of the hand-curated docSet.sql) and use comm(1) on two sorted lists
|
||||||
|
# instead of running a sqlite3 query, or an O(n*m) nested shell loop,
|
||||||
|
# once per page.
|
||||||
|
DOCSET_INDEX_PATHS=$(shell sqlite3 docSet.dsidx "SELECT DISTINCT path FROM searchIndex" | sort)
|
||||||
|
DOCSET_PAGE_PATHS=$(shell echo '$(MKDOCS_PAGES)' | tr ' ' '\n' | grep -v '^index\.md$$' | $(SED) -E 's@/index\.md$$@/index.html@; s@\.md$$@/index.html@' | sort)
|
||||||
|
|
||||||
|
# list mkdocs pages missing from the docset index
|
||||||
|
.PHONY: list_missing_pages
|
||||||
|
list_missing_pages: docSet.dsidx
|
||||||
|
@comm -23 <(echo '$(DOCSET_PAGE_PATHS)' | tr ' ' '\n') <(echo '$(DOCSET_INDEX_PATHS)' | tr ' ' '\n')
|
||||||
|
|
||||||
|
# list paths in the docset index without a corresponding mkdocs page
|
||||||
|
.PHONY: list_removed_paths
|
||||||
|
list_removed_paths: docSet.dsidx
|
||||||
|
@comm -13 <(echo '$(DOCSET_PAGE_PATHS)' | tr ' ' '\n') <(echo '$(DOCSET_INDEX_PATHS)' | tr ' ' '\n')
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f docSet.dsidx
|
rm -f docSet.dsidx
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ The folder contains the required files to create a [docset](https://kapeli.com/d
|
|||||||
documentation browsers like [Dash](https://kapeli.com/dash), [Velocity](https://velocity.silverlakesoftware.com), or
|
documentation browsers like [Dash](https://kapeli.com/dash), [Velocity](https://velocity.silverlakesoftware.com), or
|
||||||
[Zeal](https://zealdocs.org).
|
[Zeal](https://zealdocs.org).
|
||||||
|
|
||||||
The docset (pages and search index) is generated by `generate_docset.py` from the mkdocs site and `mkdocs.yml`. It
|
The docset can be created with
|
||||||
can be created with
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make JSON_for_Modern_C++.docset
|
make JSON_for_Modern_C++.docset
|
||||||
@@ -13,7 +12,6 @@ make JSON_for_Modern_C++.docset
|
|||||||
|
|
||||||
The generated folder `JSON_for_Modern_C++.docset` can then be opened in the documentation browser. `make all` builds a
|
The generated folder `JSON_for_Modern_C++.docset` can then be opened in the documentation browser. `make all` builds a
|
||||||
`JSON_for_Modern_C++.tgz` archive instead, and `make install_docset_zeal` installs the docset for Zeal directly.
|
`JSON_for_Modern_C++.tgz` archive instead, and `make install_docset_zeal` installs the docset for Zeal directly.
|
||||||
`make docSet.dsidx` builds only the search index.
|
|
||||||
|
|
||||||
A recent version is also part of the [Dash user contributions](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B).
|
A recent version is also part of the [Dash user contributions](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B).
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,314 @@
|
|||||||
|
DROP TABLE IF EXISTS searchIndex;
|
||||||
|
CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);
|
||||||
|
CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);
|
||||||
|
|
||||||
|
-- API
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('adl_serializer', 'Class', 'api/adl_serializer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('adl_serializer::from_json', 'Function', 'api/adl_serializer/from_json/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('adl_serializer::to_json', 'Function', 'api/adl_serializer/to_json/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype', 'Class', 'api/byte_container_with_subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::byte_container_with_subtype', 'Constructor', 'api/byte_container_with_subtype/byte_container_with_subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::clear_subtype', 'Method', 'api/byte_container_with_subtype/clear_subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::container_type', 'Type', 'api/byte_container_with_subtype/container_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::has_subtype', 'Method', 'api/byte_container_with_subtype/has_subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::operator!=', 'Operator', 'api/byte_container_with_subtype/operator_ne/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::operator==', 'Operator', 'api/byte_container_with_subtype/operator_eq/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::set_subtype', 'Method', 'api/byte_container_with_subtype/set_subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::subtype', 'Method', 'api/byte_container_with_subtype/subtype/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype::subtype_type', 'Type', 'api/byte_container_with_subtype/subtype_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json', 'Class', 'api/basic_json/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('format_as', 'Function', 'api/basic_json/format_as/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::accept', 'Function', 'api/basic_json/accept/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::array', 'Function', 'api/basic_json/array/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::array_t', 'Type', 'api/basic_json/array_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::as_base_class', 'Method', 'api/basic_json/as_base_class/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::at', 'Method', 'api/basic_json/at/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::back', 'Method', 'api/basic_json/back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::basic_json', 'Constructor', 'api/basic_json/basic_json/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::begin', 'Method', 'api/basic_json/begin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::binary', 'Function', 'api/basic_json/binary/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::binary_t', 'Type', 'api/basic_json/binary_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::bjdata_version_t', 'Enum', 'api/basic_json/bjdata_version_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::boolean_t', 'Type', 'api/basic_json/boolean_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::cbegin', 'Method', 'api/basic_json/cbegin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::cbor_tag_handler_t', 'Enum', 'api/basic_json/cbor_tag_handler_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::cend', 'Method', 'api/basic_json/cend/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::clear', 'Method', 'api/basic_json/clear/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::contains', 'Method', 'api/basic_json/contains/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::count', 'Method', 'api/basic_json/count/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::crbegin', 'Method', 'api/basic_json/crbegin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::crend', 'Method', 'api/basic_json/crend/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::default_object_comparator_t', 'Type', 'api/basic_json/default_object_comparator_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::diff', 'Function', 'api/basic_json/diff/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::dump', 'Method', 'api/basic_json/dump/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::emplace', 'Method', 'api/basic_json/emplace/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::emplace_back', 'Method', 'api/basic_json/emplace_back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::empty', 'Method', 'api/basic_json/empty/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::end', 'Method', 'api/basic_json/end/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::end_pos', 'Method', 'api/basic_json/end_pos/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::erase', 'Method', 'api/basic_json/erase/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::error_handler_t', 'Enum', 'api/basic_json/error_handler_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::exception', 'Class', 'api/basic_json/exception/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::find', 'Method', 'api/basic_json/find/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::flatten', 'Method', 'api/basic_json/flatten/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_bjdata', 'Function', 'api/basic_json/from_bjdata/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_bson', 'Function', 'api/basic_json/from_bson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_cbor', 'Function', 'api/basic_json/from_cbor/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_msgpack', 'Function', 'api/basic_json/from_msgpack/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_bon8', 'Function', 'api/basic_json/from_bon8/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_ubjson', 'Function', 'api/basic_json/from_ubjson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::front', 'Method', 'api/basic_json/front/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get', 'Method', 'api/basic_json/get/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get_allocator', 'Function', 'api/basic_json/get_allocator/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get_binary', 'Method', 'api/basic_json/get_binary/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get_ptr', 'Method', 'api/basic_json/get_ptr/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get_ref', 'Method', 'api/basic_json/get_ref/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::get_to', 'Method', 'api/basic_json/get_to/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::initializer_list_t', 'Type', 'api/basic_json/initializer_list_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::input_format_t', 'Enum', 'api/basic_json/input_format_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::insert', 'Method', 'api/basic_json/insert/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::invalid_iterator', 'Class', 'api/basic_json/invalid_iterator/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_array', 'Method', 'api/basic_json/is_array/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_binary', 'Method', 'api/basic_json/is_binary/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_boolean', 'Method', 'api/basic_json/is_boolean/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_discarded', 'Method', 'api/basic_json/is_discarded/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_null', 'Method', 'api/basic_json/is_null/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_number', 'Method', 'api/basic_json/is_number/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_number_float', 'Method', 'api/basic_json/is_number_float/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_number_integer', 'Method', 'api/basic_json/is_number_integer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_number_unsigned', 'Method', 'api/basic_json/is_number_unsigned/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_object', 'Method', 'api/basic_json/is_object/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_primitive', 'Method', 'api/basic_json/is_primitive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_string', 'Method', 'api/basic_json/is_string/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_structured', 'Method', 'api/basic_json/is_structured/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::items', 'Method', 'api/basic_json/items/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_base_class_t', 'Type', 'api/basic_json/json_base_class_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_sax_t', 'Type', 'api/basic_json/json_sax_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_serializer', 'Class', 'api/basic_json/json_serializer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::max_size', 'Method', 'api/basic_json/max_size/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::merge_patch', 'Method', 'api/basic_json/merge_patch/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::meta', 'Function', 'api/basic_json/meta/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::number_float_t', 'Type', 'api/basic_json/number_float_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::number_integer_t', 'Type', 'api/basic_json/number_integer_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::number_unsigned_t', 'Type', 'api/basic_json/number_unsigned_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::object', 'Function', 'api/basic_json/object/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::object_comparator_t', 'Type', 'api/basic_json/object_comparator_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::object_t', 'Type', 'api/basic_json/object_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator ValueType', 'Operator', 'api/basic_json/operator_ValueType/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator value_t', 'Operator', 'api/basic_json/operator_value_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator[]', 'Operator', 'api/basic_json/operator[]/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator=', 'Operator', 'api/basic_json/operator=/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator+=', 'Operator', 'api/basic_json/operator+=/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator==', 'Operator', 'api/basic_json/operator_eq/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator!=', 'Operator', 'api/basic_json/operator_ne/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator<', 'Operator', 'api/basic_json/operator_lt/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator<=', 'Operator', 'api/basic_json/operator_le/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator>', 'Operator', 'api/basic_json/operator_gt/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator>=', 'Operator', 'api/basic_json/operator_ge/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::operator<=>', 'Operator', 'api/basic_json/operator_spaceship/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::out_of_range', 'Class', 'api/basic_json/out_of_range/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::other_error', 'Class', 'api/basic_json/other_error/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::parse', 'Function', 'api/basic_json/parse/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::parse_error', 'Class', 'api/basic_json/parse_error/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::parse_event_t', 'Enum', 'api/basic_json/parse_event_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::parser_callback_t', 'Type', 'api/basic_json/parser_callback_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::patch', 'Method', 'api/basic_json/patch/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::patch_inplace', 'Method', 'api/basic_json/patch_inplace/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::push_back', 'Method', 'api/basic_json/push_back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::rbegin', 'Method', 'api/basic_json/rbegin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::rend', 'Method', 'api/basic_json/rend/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::sax_parse', 'Function', 'api/basic_json/sax_parse/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::size', 'Method', 'api/basic_json/size/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::start_pos', 'Method', 'api/basic_json/start_pos/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::string_t', 'Type', 'api/basic_json/string_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::swap', 'Method', 'api/basic_json/swap/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::type', 'Method', 'api/basic_json/type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::type_error', 'Class', 'api/basic_json/type_error/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::type_name', 'Method', 'api/basic_json/type_name/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::unflatten', 'Method', 'api/basic_json/unflatten/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::update', 'Method', 'api/basic_json/update/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_bjdata', 'Function', 'api/basic_json/to_bjdata/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_bson', 'Function', 'api/basic_json/to_bson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_cbor', 'Function', 'api/basic_json/to_cbor/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_msgpack', 'Function', 'api/basic_json/to_msgpack/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_bon8', 'Function', 'api/basic_json/to_bon8/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_string', 'Method', 'api/basic_json/to_string/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_ubjson', 'Function', 'api/basic_json/to_ubjson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::value', 'Method', 'api/basic_json/value/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::value_t', 'Enum', 'api/basic_json/value_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::with_t', 'Type', 'api/basic_json/with_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::~basic_json', 'Method', 'api/basic_json/~basic_json/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 ('json_pointer::back', 'Method', 'api/json_pointer/back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::empty', 'Method', 'api/json_pointer/empty/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::front', 'Method', 'api/json_pointer/front/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::json_pointer', 'Constructor', 'api/json_pointer/json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator==', 'Operator', 'api/json_pointer/operator_eq/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator!=', 'Operator', 'api/json_pointer/operator_ne/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/', 'Operator', 'api/json_pointer/operator_slash/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/=', 'Operator', 'api/json_pointer/operator_slasheq/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator string_t', 'Operator', 'api/json_pointer/operator_string_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator<=>', 'Operator', 'api/json_pointer/operator_spaceship/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::parent_pointer', 'Method', 'api/json_pointer/parent_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::pop_back', 'Method', 'api/json_pointer/pop_back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::pop_front', 'Method', 'api/json_pointer/pop_front/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::push_back', 'Method', 'api/json_pointer/push_back/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::push_front', 'Method', 'api/json_pointer/push_front/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::string_t', 'Type', 'api/json_pointer/string_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::to_string', 'Method', 'api/json_pointer/to_string/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax', 'Class', 'api/json_sax/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::binary', 'Method', 'api/json_sax/binary/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::binary_t', 'Type', 'api/json_sax/binary_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::boolean', 'Method', 'api/json_sax/boolean/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::end_array', 'Method', 'api/json_sax/end_array/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::end_object', 'Method', 'api/json_sax/end_object/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::json_sax', 'Constructor', 'api/json_sax/json_sax/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::key', 'Method', 'api/json_sax/key/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::null', 'Method', 'api/json_sax/null/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_float', 'Method', 'api/json_sax/number_float/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_float_t', 'Type', 'api/json_sax/number_float_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_integer', 'Method', 'api/json_sax/number_integer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_integer_t', 'Type', 'api/json_sax/number_integer_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_unsigned', 'Method', 'api/json_sax/number_unsigned/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::number_unsigned_t', 'Type', 'api/json_sax/number_unsigned_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::operator=', 'Operator', 'api/json_sax/operator=/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::parse_error', 'Method', 'api/json_sax/parse_error/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::start_array', 'Method', 'api/json_sax/start_array/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::start_object', 'Method', 'api/json_sax/start_object/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::string', 'Method', 'api/json_sax/string/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::string_t', 'Type', 'api/json_sax/string_t/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_sax::~json_sax', 'Method', 'api/json_sax/~json_sax/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json', 'Literal', 'api/operator_literal_json/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json_pointer', 'Literal', 'api/operator_literal_json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('operator<<', 'Operator', 'api/operator_ltlt/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('operator>>', 'Operator', 'api/operator_gtgt/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');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::Container', 'Type', 'api/ordered_map/Container/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::at', 'Method', 'api/ordered_map/at/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::count', 'Method', 'api/ordered_map/count/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::emplace', 'Method', 'api/ordered_map/emplace/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::erase', 'Method', 'api/ordered_map/erase/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::find', 'Method', 'api/ordered_map/find/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::insert', 'Method', 'api/ordered_map/insert/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::key_compare', 'Type', 'api/ordered_map/key_compare/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::operator=', 'Operator', 'api/ordered_map/operator=/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::operator[]', 'Operator', 'api/ordered_map/operator[]/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::ordered_map', 'Constructor', 'api/ordered_map/ordered_map/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map::~ordered_map', 'Method', 'api/ordered_map/~ordered_map/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('std::formatter<basic_json>', 'Class', 'api/basic_json/std_formatter/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('std::hash<basic_json>', 'Class', 'api/basic_json/std_hash/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('std::swap<basic_json>', 'Function', 'api/basic_json/std_swap/index.html');
|
||||||
|
|
||||||
|
-- Features
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Arbitrary Type Conversions', 'Guide', 'features/arbitrary_types/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats', 'Guide', 'features/binary_formats/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: BJData', 'Guide', 'features/binary_formats/bjdata/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: BSON', 'Guide', 'features/binary_formats/bson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: CBOR', 'Guide', 'features/binary_formats/cbor/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: MessagePack', 'Guide', 'features/binary_formats/messagepack/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: BON8', 'Guide', 'features/binary_formats/bon8/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: UBJSON', 'Guide', 'features/binary_formats/ubjson/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Binary Values', 'Guide', 'features/binary_values/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Comments', 'Guide', 'features/comments/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access', 'Guide', 'features/element_access/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Access with default value: value', 'Guide', 'features/element_access/default_value/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Checked access: at', 'Guide', 'features/element_access/checked_access/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Unchecked access: operator[]', 'Guide', 'features/element_access/unchecked_access/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Exceptions', 'Guide', 'home/exceptions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Migration Guide', 'Guide', 'integration/migration_guide/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: CMake', 'Guide', 'integration/cmake/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Header only', 'Guide', 'integration/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Package Managers', 'Guide', 'integration/package_managers/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Pkg-config', 'Guide', 'integration/pkg-config/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Iterators', 'Guide', 'features/iterators/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('nlohmann Namespace', 'Guide', 'features/namespace/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Types: Number Handling', 'Guide', 'features/types/number_handling/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Object Order', 'Guide', 'features/object_order/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Performance', 'Guide', 'features/performance/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing', 'Guide', 'features/parsing/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing: JSON Lines', 'Guide', 'features/parsing/json_lines/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing: Parser Callbacks', 'Guide', 'features/parsing/parser_callbacks/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing: Parsing and Exceptions', 'Guide', 'features/parsing/parse_exceptions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing: SAX Interface', 'Guide', 'features/parsing/sax_interface/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Parsing: Untrusted Input', 'Guide', 'features/parsing/untrusted_input/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Runtime Assertions', 'Guide', 'features/assertions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Specializing enum conversion', 'Guide', 'features/enum_conversion/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Supported Macros', 'Guide', 'features/macros/index.html');
|
||||||
|
|
||||||
|
-- Macros
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_ASSERT', 'Macro', 'api/macros/json_assert/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_BRACE_INIT_COPY_SEMANTICS', 'Macro', 'api/macros/json_brace_init_copy_semantics/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_CATCH_USER', 'Macro', 'api/macros/json_throw_user/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DELETE_DEPRECATED_FUNCTIONS', 'Macro', 'api/macros/json_delete_deprecated_functions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DIAGNOSTICS', 'Macro', 'api/macros/json_diagnostics/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DIAGNOSTIC_POSITIONS', 'Macro', 'api/macros/json_diagnostic_positions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DISABLE_ENUM_SERIALIZATION', 'Macro', 'api/macros/json_disable_enum_serialization/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DISABLE_TUPLE_REFERENCE_CONVERSION', 'Macro', 'api/macros/json_disable_tuple_reference_conversion/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_11', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_14', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_17', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_20', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_23', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_26', 'Macro', 'api/macros/json_has_cpp_11/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_EXPERIMENTAL_FILESYSTEM', 'Macro', 'api/macros/json_has_filesystem/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_FILESYSTEM', 'Macro', 'api/macros/json_has_filesystem/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_RANGES', 'Macro', 'api/macros/json_has_ranges/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_STATIC_RTTI', 'Macro', 'api/macros/json_has_static_rtti/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_STD_FORMAT', 'Macro', 'api/macros/json_has_std_format/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_THREE_WAY_COMPARISON', 'Macro', 'api/macros/json_has_three_way_comparison/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NOEXCEPTION', 'Macro', 'api/macros/json_noexception/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NO_AUTOMATIC_UDLS', 'Macro', 'api/macros/json_no_automatic_udls/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NO_IO', 'Macro', 'api/macros/json_no_io/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NO_THREAD_LOCAL', 'Macro', 'api/macros/json_no_thread_local/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_PRECISE_STREAM_POSITION', 'Macro', 'api/macros/json_precise_stream_position/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_SKIP_LIBRARY_VERSION_CHECK', 'Macro', 'api/macros/json_skip_library_version_check/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_SKIP_UNSUPPORTED_COMPILER_CHECK', 'Macro', 'api/macros/json_skip_unsupported_compiler_check/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_STRICT_BINARY_UTF8', 'Macro', 'api/macros/json_strict_binary_utf8/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_STRICT_NUL_HANDLING', 'Macro', 'api/macros/json_strict_nul_handling/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_THROW_USER', 'Macro', 'api/macros/json_throw_user/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_TRY_USER', 'Macro', 'api/macros/json_throw_user/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_GLOBAL_UDLS', 'Macro', 'api/macros/json_use_global_udls/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_IMPLICIT_CONVERSIONS', 'Macro', 'api/macros/json_use_implicit_conversions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON', 'Macro', 'api/macros/json_use_legacy_discarded_value_comparison/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_OBJECTS_FOR_ENUM_KEYED_MAPS', 'Macro', 'api/macros/json_use_objects_for_enum_keyed_maps/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_SIMDUTF', 'Macro', 'api/macros/json_use_simdutf/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Macros', 'Macro', 'api/macros/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT', 'Macro', 'api/macros/nlohmann_define_derived_type/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE', 'Macro', 'api/macros/nlohmann_define_type_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE', 'Macro', 'api/macros/nlohmann_define_type_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT', 'Macro', 'api/macros/nlohmann_define_type_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE', 'Macro', 'api/macros/nlohmann_define_type_non_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE', 'Macro', 'api/macros/nlohmann_define_type_non_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT', 'Macro', 'api/macros/nlohmann_define_type_non_intrusive/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_NAMES', 'Macro', 'api/macros/nlohmann_define_type_with_names/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE', 'Macro', 'api/macros/nlohmann_json_namespace/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_BEGIN', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_END', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_NO_VERSION', 'Macro', 'api/macros/nlohmann_json_namespace_no_version/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_SERIALIZE_ENUM', 'Macro', 'api/macros/nlohmann_json_serialize_enum/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_SERIALIZE_ENUM_STRICT', 'Macro', 'api/macros/nlohmann_json_serialize_enum_strict/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MAJOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MINOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_PATCH', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
@@ -1,532 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
"""Generate the Dash docset search index from the mkdocs sources."""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import glob
|
|
||||||
import hashlib
|
|
||||||
import html
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import sqlite3
|
|
||||||
import sys
|
|
||||||
import tarfile
|
|
||||||
import urllib.parse
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
MKDOCS_YML = os.path.join(HERE, '..', 'mkdocs', 'mkdocs.yml')
|
|
||||||
PAGES = os.path.join(HERE, '..', 'mkdocs', 'docs')
|
|
||||||
|
|
||||||
# api pages whose (name, type) cannot be derived by the heuristics
|
|
||||||
OVERRIDES = {
|
|
||||||
}
|
|
||||||
|
|
||||||
DOCSET = 'JSON_for_Modern_C++.docset'
|
|
||||||
TITLE_SUFFIX = ' - JSON for Modern C++</title>'
|
|
||||||
|
|
||||||
# CSS rules appended to the stylesheet: hide navigation items and fix spacing
|
|
||||||
# hide the navigation (the documentation browser has its own); Material's class selectors would win over element
|
|
||||||
# selectors, hence the classes and !important
|
|
||||||
CSS_PATCH = (
|
|
||||||
'\n\n.md-header, .md-footer, .md-tabs, .md-sidebar--primary, .md-content__button { display: none !important; }'
|
|
||||||
'\n\n.md-sidebar--secondary, .md-main__inner { top: 0 !important; margin-top: 0 !important; }'
|
|
||||||
)
|
|
||||||
|
|
||||||
USER_AGENT = ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 '
|
|
||||||
'(KHTML, like Gecko) Chrome/124.0 Safari/537.36')
|
|
||||||
CONTENT_TYPE_EXT = {'image/svg+xml': '.svg', 'image/png': '.png', 'image/jpeg': '.jpg',
|
|
||||||
'image/gif': '.gif', 'image/webp': '.webp'}
|
|
||||||
|
|
||||||
# remote loads that are allowed to remain (URL -> reason)
|
|
||||||
ALLOWED_REMOTE = {
|
|
||||||
# Material only loads this polyfill if the browser has no ResizeObserver
|
|
||||||
'https://unpkg.com/resize-observer-polyfill': 'fallback for browsers without ResizeObserver',
|
|
||||||
}
|
|
||||||
|
|
||||||
problems = []
|
|
||||||
|
|
||||||
|
|
||||||
def problem(page, reason) -> None:
|
|
||||||
"""Record a problem; all problems are reported at the end."""
|
|
||||||
problems.append(f'generate_docset.py: {page}: {reason}')
|
|
||||||
|
|
||||||
|
|
||||||
class Loader(yaml.SafeLoader):
|
|
||||||
"""YAML loader that tolerates the custom tags used in mkdocs.yml."""
|
|
||||||
|
|
||||||
|
|
||||||
Loader.add_multi_constructor('', lambda loader, suffix, node: None)
|
|
||||||
|
|
||||||
|
|
||||||
def walk_nav(items, groups=()):
|
|
||||||
"""Yield (group titles, nav title or None, md path) for all nav leaves."""
|
|
||||||
for item in items:
|
|
||||||
if isinstance(item, str):
|
|
||||||
yield list(groups), None, item
|
|
||||||
elif isinstance(item, dict):
|
|
||||||
for title, value in item.items():
|
|
||||||
if isinstance(value, list):
|
|
||||||
yield from walk_nav(value, groups + (str(title),))
|
|
||||||
else:
|
|
||||||
yield list(groups), str(title), value
|
|
||||||
|
|
||||||
|
|
||||||
def page_path(md_path) -> str:
|
|
||||||
"""Map a markdown path to the HTML path of the rendered page."""
|
|
||||||
if md_path.endswith('/index.md'):
|
|
||||||
return md_path[:-len('index.md')] + 'index.html'
|
|
||||||
return md_path[:-len('.md')] + '/index.html'
|
|
||||||
|
|
||||||
|
|
||||||
def read_page(md_path) -> str:
|
|
||||||
"""Read a page (resolving a snippet include), return '' if it does not exist."""
|
|
||||||
try:
|
|
||||||
with open(os.path.join(PAGES, md_path), encoding='utf-8') as f:
|
|
||||||
text = f.read()
|
|
||||||
m = re.match(r'--8<-- "(.+)"\s*$', text)
|
|
||||||
if m:
|
|
||||||
with open(os.path.join(PAGES, m.group(1)), encoding='utf-8') as f:
|
|
||||||
text = f.read()
|
|
||||||
return text
|
|
||||||
except OSError:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
|
|
||||||
def clean(text) -> str:
|
|
||||||
"""Strip tags and entities from a heading and normalize whitespace."""
|
|
||||||
text = text.replace('\\>', '\x00') # escaped '>' is not the end of a tag
|
|
||||||
text = html.unescape(re.sub(r'</?[a-zA-Z][^>]*>', '', text)).replace('\x00', '>')
|
|
||||||
return re.sub(r'\s+', ' ', text).strip()
|
|
||||||
|
|
||||||
|
|
||||||
def strip_fences(text) -> str:
|
|
||||||
"""Remove fenced code blocks (their lines may start with '# ')."""
|
|
||||||
return re.sub(r'^(```|~~~).*?^\1[^\n]*$', '', text, flags=re.M | re.S)
|
|
||||||
|
|
||||||
|
|
||||||
def get_h1(text):
|
|
||||||
"""Return the cleaned first H1 of a page or None."""
|
|
||||||
body = strip_fences(text)
|
|
||||||
m = re.search(r'^# (.+)$', body, flags=re.M)
|
|
||||||
if m:
|
|
||||||
return clean(m.group(1))
|
|
||||||
m = re.search(r'<h1>(.*?)</h1>', body, flags=re.S)
|
|
||||||
return clean(m.group(1)) if m else None
|
|
||||||
|
|
||||||
|
|
||||||
def split_top_level(text, seps=','):
|
|
||||||
"""Split at separators that are not nested in <>, () or []."""
|
|
||||||
parts, depth, current = [], 0, ''
|
|
||||||
for c in text:
|
|
||||||
if c in '<([':
|
|
||||||
depth += 1
|
|
||||||
elif c in '>)]':
|
|
||||||
depth -= 1
|
|
||||||
if c in seps and depth <= 0:
|
|
||||||
parts.append(current)
|
|
||||||
current = ''
|
|
||||||
else:
|
|
||||||
current += c
|
|
||||||
parts.append(current)
|
|
||||||
return [p.strip() for p in parts if p.strip()]
|
|
||||||
|
|
||||||
|
|
||||||
OPERATOR_SYMBOLS = ('<=>', '<<', '>>', '<=', '>=', '<', '>')
|
|
||||||
|
|
||||||
|
|
||||||
def api_names(h1) -> list:
|
|
||||||
"""Derive the entry names from the H1 of an api page."""
|
|
||||||
# hide the angle brackets of operators from the nesting detection
|
|
||||||
for i, sym in enumerate(OPERATOR_SYMBOLS):
|
|
||||||
h1 = h1.replace('operator' + sym, f'operator\x01{i}\x01')
|
|
||||||
names = []
|
|
||||||
for part in split_top_level(h1):
|
|
||||||
name = part.replace('\\', '').replace('nlohmann::', '')
|
|
||||||
name = re.sub(r'\x01(\d)\x01', lambda m: OPERATOR_SYMBOLS[int(m.group(1))], name)
|
|
||||||
# drop qualifiers like "operator<<(basic_json)", but keep "operator()"
|
|
||||||
if not name.endswith('operator()'):
|
|
||||||
name = re.sub(r'(?<=\w|[<>=!+\-*/\[\]])\([^()]*\)$', '', name)
|
|
||||||
if name not in names:
|
|
||||||
names.append(name)
|
|
||||||
return names
|
|
||||||
|
|
||||||
|
|
||||||
def first_cpp_block(text):
|
|
||||||
"""Return the first ```cpp block following the H1."""
|
|
||||||
m = re.search(r'^# .*?^```cpp\n(.*?)^```', text, flags=re.M | re.S)
|
|
||||||
return m.group(1) if m else None
|
|
||||||
|
|
||||||
|
|
||||||
def api_type(name, decl):
|
|
||||||
"""Determine the Dash entry type from name and declaration."""
|
|
||||||
parts = name.split('::')
|
|
||||||
last = parts[-1]
|
|
||||||
if name.startswith('operator""'):
|
|
||||||
return 'Literal'
|
|
||||||
if last.startswith('operator'):
|
|
||||||
return 'Operator'
|
|
||||||
if decl is None:
|
|
||||||
return None
|
|
||||||
if re.search(r'\benum\b', decl):
|
|
||||||
return 'Enum'
|
|
||||||
if re.search(r'^\s*(template\s*<.*>\s*)?(class|struct)\s+\w+\s*(final\b|[:{;<]|$)', decl, flags=re.M):
|
|
||||||
return 'Class'
|
|
||||||
if re.search(r'\busing\s+\w+\s*=', decl) or 'typedef' in decl:
|
|
||||||
return 'Type'
|
|
||||||
if len(parts) > 1 and last == parts[-2]:
|
|
||||||
return 'Constructor'
|
|
||||||
if last.startswith('~'):
|
|
||||||
return 'Method'
|
|
||||||
if re.search(r'\bstatic\b', decl) or len(parts) == 1 or parts[0] == 'std':
|
|
||||||
return 'Function'
|
|
||||||
return 'Method'
|
|
||||||
|
|
||||||
|
|
||||||
def macro_names(h1) -> list:
|
|
||||||
"""Split the H1 of a macro page into macro names."""
|
|
||||||
return [n.strip() for n in re.split(r'[,/]', h1) if n.strip()]
|
|
||||||
|
|
||||||
|
|
||||||
def api_entries(md_path):
|
|
||||||
"""Return the (name, type) pairs of an api page."""
|
|
||||||
if md_path in OVERRIDES:
|
|
||||||
return OVERRIDES[md_path]
|
|
||||||
if md_path == 'api/macros/index.md':
|
|
||||||
return [('Macros', 'Macro')]
|
|
||||||
text = read_page(md_path)
|
|
||||||
h1 = get_h1(text)
|
|
||||||
if not h1:
|
|
||||||
problem(md_path, 'no H1 found')
|
|
||||||
return []
|
|
||||||
if md_path.startswith('api/macros/'):
|
|
||||||
return [(n, 'Macro') for n in macro_names(h1)]
|
|
||||||
names = api_names(h1)
|
|
||||||
if not names:
|
|
||||||
problem(md_path, 'no names found')
|
|
||||||
return []
|
|
||||||
decl = first_cpp_block(text)
|
|
||||||
result = []
|
|
||||||
for name in names:
|
|
||||||
kind = api_type(name, decl)
|
|
||||||
if kind is None:
|
|
||||||
problem(md_path, f'no type determinable for {name}')
|
|
||||||
else:
|
|
||||||
result.append((name, kind))
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def guide_entries(nav):
|
|
||||||
"""Yield (name, type, md path) for all non-api nav pages."""
|
|
||||||
for groups, title, md_path in walk_nav(nav):
|
|
||||||
if md_path.startswith('api/') or md_path == 'index.md':
|
|
||||||
continue
|
|
||||||
if not md_path.endswith('.md'):
|
|
||||||
continue
|
|
||||||
groups = groups[1:] # drop the top-level tab
|
|
||||||
if title is None:
|
|
||||||
title = get_h1(read_page(md_path))
|
|
||||||
if not title:
|
|
||||||
problem(md_path, 'no title found')
|
|
||||||
continue
|
|
||||||
# "Parsing: Parsing Untrusted Input" -> "Parsing: Untrusted Input"
|
|
||||||
if groups and title.startswith(groups[-1] + ' ') and title[len(groups[-1]) + 1:][:1].isupper():
|
|
||||||
title = title[len(groups[-1]) + 1:]
|
|
||||||
if md_path.endswith('/index.md') and groups and title == groups[-1]:
|
|
||||||
name = ': '.join(groups)
|
|
||||||
else:
|
|
||||||
name = ': '.join(groups + [title])
|
|
||||||
yield name, 'Guide', md_path
|
|
||||||
|
|
||||||
|
|
||||||
def build_entries() -> list:
|
|
||||||
"""Return the sorted list of (name, type, path) index entries."""
|
|
||||||
nav = load_mkdocs_yml()['nav']
|
|
||||||
|
|
||||||
entries = set()
|
|
||||||
for name, kind, md_path in guide_entries(nav):
|
|
||||||
entries.add((name, kind, page_path(md_path)))
|
|
||||||
|
|
||||||
api_root = os.path.join(PAGES, 'api')
|
|
||||||
on_disk = set()
|
|
||||||
for root, _, files in os.walk(api_root):
|
|
||||||
for file in files:
|
|
||||||
if file.endswith('.md'):
|
|
||||||
rel = os.path.relpath(os.path.join(root, file), PAGES)
|
|
||||||
on_disk.add(rel.replace(os.sep, '/'))
|
|
||||||
for _, _, md_path in walk_nav(nav):
|
|
||||||
if md_path.startswith('api/') and md_path not in on_disk:
|
|
||||||
problem(md_path, 'listed in nav but missing on disk')
|
|
||||||
for md_path in sorted(on_disk):
|
|
||||||
for name, kind in api_entries(md_path):
|
|
||||||
entries.add((name, kind, page_path(md_path)))
|
|
||||||
return sorted(entries)
|
|
||||||
|
|
||||||
|
|
||||||
def write_index(entries, out) -> None:
|
|
||||||
"""Write the entries into a SQLite search index."""
|
|
||||||
if os.path.exists(out):
|
|
||||||
os.remove(out)
|
|
||||||
con = sqlite3.connect(out)
|
|
||||||
con.execute('CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)')
|
|
||||||
con.execute('CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)')
|
|
||||||
con.executemany('INSERT INTO searchIndex(name, type, path) VALUES (?, ?, ?)', entries)
|
|
||||||
con.commit()
|
|
||||||
con.close()
|
|
||||||
|
|
||||||
|
|
||||||
def html_files(root):
|
|
||||||
"""Yield all HTML files below root."""
|
|
||||||
for base, _, files in os.walk(root):
|
|
||||||
for file in files:
|
|
||||||
if file.endswith('.html'):
|
|
||||||
yield os.path.join(base, file)
|
|
||||||
|
|
||||||
|
|
||||||
def read(path) -> str:
|
|
||||||
with open(path, encoding='utf-8') as f:
|
|
||||||
return f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def write(path, text) -> None:
|
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(text)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_source_widget(docs) -> None:
|
|
||||||
"""Drop data-md-component=source so Material does not query api.github.com for the stars and version."""
|
|
||||||
pattern = re.compile(r'\sdata-md-component=(?:"source"|source\b)')
|
|
||||||
for path in html_files(docs):
|
|
||||||
text = read(path)
|
|
||||||
new = pattern.sub('', text)
|
|
||||||
if new != text:
|
|
||||||
write(path, new)
|
|
||||||
|
|
||||||
|
|
||||||
def patch_titles(docs, entries) -> None:
|
|
||||||
"""Strip the site name from all titles; use the index names where available."""
|
|
||||||
names = {}
|
|
||||||
for name, _, path in entries:
|
|
||||||
names.setdefault(path, []).append(name)
|
|
||||||
for file in html_files(docs):
|
|
||||||
rel = os.path.relpath(file, docs).replace(os.sep, '/')
|
|
||||||
text = read(file).replace(TITLE_SUFFIX, '</title>')
|
|
||||||
if rel in names:
|
|
||||||
title = html.escape(', '.join(names[rel]), quote=False)
|
|
||||||
text = re.sub(r'<title>.*?</title>', lambda _: f'<title>{title}</title>', text, count=1, flags=re.S)
|
|
||||||
write(file, text)
|
|
||||||
|
|
||||||
|
|
||||||
IMG_RE = re.compile(r'<img\b[^>]*>', re.I)
|
|
||||||
ATTR_RE = r'''(?:{0})\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))'''
|
|
||||||
|
|
||||||
|
|
||||||
def attr(tag, name):
|
|
||||||
"""Return the value of an attribute in a tag or None."""
|
|
||||||
m = re.search(r'(?<![\w-])' + ATTR_RE.format(name), tag, flags=re.I)
|
|
||||||
return next(g for g in m.groups() if g is not None) if m else None
|
|
||||||
|
|
||||||
|
|
||||||
def is_remote(url) -> bool:
|
|
||||||
return re.match(r'(https?:)?//', url.strip(), flags=re.I) is not None
|
|
||||||
|
|
||||||
|
|
||||||
def download(url, docs) -> str:
|
|
||||||
"""Download url into assets/external and return the path relative to docs."""
|
|
||||||
u = urllib.parse.urlparse(url if not url.startswith('//') else 'https:' + url)
|
|
||||||
if u.scheme.lower() not in ('http', 'https'):
|
|
||||||
raise ValueError(f'not an http(s) URL: {url}')
|
|
||||||
req = urllib.request.Request(u.geturl(), headers={'User-Agent': USER_AGENT})
|
|
||||||
# (the scheme is checked above)
|
|
||||||
with urllib.request.urlopen(req, timeout=20) as r: # nosec B310
|
|
||||||
data = r.read()
|
|
||||||
ctype = r.headers.get_content_type()
|
|
||||||
path = urllib.parse.unquote(u.path).lstrip('/')
|
|
||||||
ext = os.path.splitext(path)[1]
|
|
||||||
if u.query or not ext or path.endswith('/'):
|
|
||||||
digest = hashlib.sha1(url.encode(), usedforsecurity=False).hexdigest()[:12]
|
|
||||||
path = os.path.join(os.path.dirname(path), digest + CONTENT_TYPE_EXT.get(ctype, ext or '.bin'))
|
|
||||||
rel = os.path.normpath(os.path.join('assets', 'external', u.hostname, path))
|
|
||||||
out = os.path.join(docs, rel)
|
|
||||||
os.makedirs(os.path.dirname(out), exist_ok=True)
|
|
||||||
with open(out, 'wb') as f:
|
|
||||||
f.write(data)
|
|
||||||
return rel.replace(os.sep, '/')
|
|
||||||
|
|
||||||
|
|
||||||
def localize_images(docs) -> None:
|
|
||||||
"""Download remote images and rewrite their src; drop them on failure."""
|
|
||||||
cache = {}
|
|
||||||
for file in html_files(docs):
|
|
||||||
text = read(file)
|
|
||||||
|
|
||||||
def repl(m):
|
|
||||||
tag = m.group(0)
|
|
||||||
src = attr(tag, 'src')
|
|
||||||
if src is None or not is_remote(src):
|
|
||||||
return tag
|
|
||||||
if src not in cache:
|
|
||||||
try:
|
|
||||||
cache[src] = download(src, docs)
|
|
||||||
except Exception as e: # noqa: BLE001
|
|
||||||
print(f'generate_docset.py: warning: cannot download {src}: {e}', file=sys.stderr)
|
|
||||||
cache[src] = None
|
|
||||||
if cache[src] is None:
|
|
||||||
return attr(tag, 'alt') or ''
|
|
||||||
local = os.path.relpath(os.path.join(docs, cache[src]), os.path.dirname(file))
|
|
||||||
local = local.replace(os.sep, '/')
|
|
||||||
return re.sub(ATTR_RE.format('src'), lambda _: f'src="{local}"', tag, count=1, flags=re.I)
|
|
||||||
|
|
||||||
new = IMG_RE.sub(repl, text)
|
|
||||||
if new != text:
|
|
||||||
write(file, new)
|
|
||||||
|
|
||||||
|
|
||||||
def load_mkdocs_yml() -> dict:
|
|
||||||
"""Load mkdocs.yml, ignoring tags like !ENV and !!python/name."""
|
|
||||||
with open(MKDOCS_YML, encoding='utf-8') as f:
|
|
||||||
# (Loader is a yaml.SafeLoader)
|
|
||||||
return yaml.load(f, Loader=Loader) # nosec B506
|
|
||||||
|
|
||||||
|
|
||||||
def localize_site_urls(docs, site_url) -> None:
|
|
||||||
"""Load assets that the theme's JavaScript references by absolute site URL from the docset.
|
|
||||||
|
|
||||||
The privacy plugin rewrites the mermaid loader to "<site_url>assets/external/unpkg.com/mermaid@11/...", so the
|
|
||||||
docset would fetch mermaid from the live site. __md_scope is the site root that Material defines in every page.
|
|
||||||
"""
|
|
||||||
pattern = re.compile(r'"' + re.escape(site_url) + r'(assets/[^"]*)"')
|
|
||||||
for base, _, files in os.walk(docs):
|
|
||||||
for file in (f for f in files if f.endswith('.js')):
|
|
||||||
path = os.path.join(base, file)
|
|
||||||
text = read(path)
|
|
||||||
new = pattern.sub(r'new URL("\1",__md_scope).href', text)
|
|
||||||
if new != text:
|
|
||||||
write(path, new)
|
|
||||||
|
|
||||||
|
|
||||||
def remote_loads(docs, site_url) -> list:
|
|
||||||
"""Return 'file: url' strings for resources that would be loaded remotely."""
|
|
||||||
found = []
|
|
||||||
cdn = re.compile(r'https://(?:unpkg\.com|cdn\.jsdelivr\.net|cdnjs\.cloudflare\.com|'
|
|
||||||
r'fonts\.googleapis\.com|fonts\.gstatic\.com)/[^\s"\'`)\\]*')
|
|
||||||
css_url = re.compile(r'url\(\s*["\']?((?:https?:)?//[^)"\']+)', re.I)
|
|
||||||
css_import = re.compile(r'@import\s+(?:url\(\s*)?["\']?((?:https?:)?//[^)"\'; ]+)', re.I)
|
|
||||||
for base, _, files in os.walk(docs):
|
|
||||||
for file in files:
|
|
||||||
path = os.path.join(base, file)
|
|
||||||
rel = os.path.relpath(path, docs)
|
|
||||||
urls = []
|
|
||||||
if file.endswith('.html'):
|
|
||||||
text = read(path)
|
|
||||||
for m in re.finditer(r'<[a-zA-Z][^>]*>', text):
|
|
||||||
tag = m.group(0)
|
|
||||||
for name in ('src', 'poster'):
|
|
||||||
v = attr(tag, name)
|
|
||||||
if v and is_remote(v):
|
|
||||||
urls.append(v)
|
|
||||||
v = attr(tag, 'srcset')
|
|
||||||
if v:
|
|
||||||
urls += [c.split()[0] for c in v.split(',') if c.strip() and is_remote(c.strip())]
|
|
||||||
if re.match(r'<link\b', tag, flags=re.I):
|
|
||||||
rel_attr = (attr(tag, 'rel') or '').lower()
|
|
||||||
v = attr(tag, 'href')
|
|
||||||
if v and is_remote(v) and re.search(r'stylesheet|icon|preload|modulepreload|manifest', rel_attr):
|
|
||||||
urls.append(v)
|
|
||||||
urls += css_url.findall(text) + css_import.findall(text)
|
|
||||||
elif file.endswith('.css'):
|
|
||||||
text = read(path)
|
|
||||||
urls += css_url.findall(text) + css_import.findall(text)
|
|
||||||
elif file.endswith('.js'):
|
|
||||||
text = read(path)
|
|
||||||
urls += cdn.findall(text)
|
|
||||||
urls += re.findall(re.escape(site_url) + r'assets/[^\s"\'`)\\]*', text)
|
|
||||||
found += [f'{rel}: {u}' for u in urls if u not in ALLOWED_REMOTE]
|
|
||||||
return found
|
|
||||||
|
|
||||||
|
|
||||||
def make_docset(site, out_dir) -> int:
|
|
||||||
entries = build_entries()
|
|
||||||
if problems:
|
|
||||||
print('\n'.join(problems), file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
docset = os.path.join(out_dir, DOCSET)
|
|
||||||
docs = os.path.join(docset, 'Contents', 'Resources', 'Documents')
|
|
||||||
if os.path.exists(docset):
|
|
||||||
shutil.rmtree(docset)
|
|
||||||
shutil.copytree(site, docs)
|
|
||||||
for icon in ('icon.png', 'icon@2x.png'):
|
|
||||||
shutil.copy(os.path.join(HERE, icon), docset)
|
|
||||||
shutil.copy(os.path.join(HERE, 'Info.plist'), os.path.join(docset, 'Contents'))
|
|
||||||
write_index(entries, os.path.join(docset, 'Contents', 'Resources', 'docSet.dsidx'))
|
|
||||||
|
|
||||||
# patch CSS to hide navigation items and fix spacing
|
|
||||||
css = glob.glob(os.path.join(docs, 'assets', 'stylesheets', 'main.*.min.css'))
|
|
||||||
if len(css) != 1:
|
|
||||||
print(f'generate_docset.py: expected exactly one main.*.min.css, found {len(css)}', file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
with open(css[0], 'a', encoding='utf-8') as f:
|
|
||||||
f.write(CSS_PATCH)
|
|
||||||
|
|
||||||
patch_titles(docs, entries)
|
|
||||||
remove_source_widget(docs)
|
|
||||||
for sitemap in glob.glob(os.path.join(docs, 'sitemap.*')):
|
|
||||||
os.remove(sitemap)
|
|
||||||
|
|
||||||
# make the docset self-contained
|
|
||||||
site_url = load_mkdocs_yml()['site_url']
|
|
||||||
localize_images(docs)
|
|
||||||
localize_site_urls(docs, site_url)
|
|
||||||
remote = remote_loads(docs, site_url)
|
|
||||||
if remote:
|
|
||||||
print('generate_docset.py: remote resources remain in the docset:', file=sys.stderr)
|
|
||||||
print('\n'.join(' ' + r for r in remote), file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def make_tgz(out_dir) -> int:
|
|
||||||
docset = os.path.join(out_dir, DOCSET)
|
|
||||||
if not os.path.isdir(docset):
|
|
||||||
print(f'generate_docset.py: {docset} does not exist', file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
with tarfile.open(os.path.join(out_dir, 'JSON_for_Modern_C++.tgz'), 'w:gz') as tar:
|
|
||||||
tar.add(docset, arcname=DOCSET, filter=lambda i: None if os.path.basename(i.name) == '.DS_Store' else i)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
|
||||||
sub = parser.add_subparsers(dest='command', required=True)
|
|
||||||
sub.add_parser('list', help='print the index entries as TSV')
|
|
||||||
p = sub.add_parser('index', help='write the SQLite search index')
|
|
||||||
p.add_argument('out')
|
|
||||||
p = sub.add_parser('docset', help='build the docset from a built mkdocs site')
|
|
||||||
p.add_argument('site_dir')
|
|
||||||
p.add_argument('out_dir')
|
|
||||||
p = sub.add_parser('tgz', help='pack the docset into a tarball')
|
|
||||||
p.add_argument('out_dir')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
if args.command == 'docset':
|
|
||||||
return make_docset(args.site_dir, args.out_dir)
|
|
||||||
if args.command == 'tgz':
|
|
||||||
return make_tgz(args.out_dir)
|
|
||||||
|
|
||||||
entries = build_entries()
|
|
||||||
if problems:
|
|
||||||
print('\n'.join(problems), file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
if args.command == 'list':
|
|
||||||
for entry in entries:
|
|
||||||
print('\t'.join(entry))
|
|
||||||
elif args.command == 'index':
|
|
||||||
write_index(entries, args.out)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main())
|
|
||||||
@@ -17,7 +17,6 @@ build: style_check
|
|||||||
|
|
||||||
style_check:
|
style_check:
|
||||||
@cd docs ; ../venv/bin/python3 ../scripts/check_structure.py
|
@cd docs ; ../venv/bin/python3 ../scripts/check_structure.py
|
||||||
@venv/bin/python3 ../docset/generate_docset.py list > /dev/null
|
|
||||||
|
|
||||||
# check that all Mermaid diagrams parse (needs Node.js)
|
# check that all Mermaid diagrams parse (needs Node.js)
|
||||||
# This target is used in the CI (ci_test_documentation_mermaid).
|
# This target is used in the CI (ci_test_documentation_mermaid).
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ To store objects in C++, a type is defined by the template parameters explained
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default type for
|
With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default value for
|
||||||
`array_t` is:
|
`array_t` is:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
|||||||
@@ -241,6 +241,4 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
|
3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
|
||||||
already supported by [`operator[]`](operator[].md), [`value`](value.md), [`find`](find.md), and other lookup
|
already supported by [`operator[]`](operator[].md), [`value`](value.md), [`find`](find.md), and other lookup
|
||||||
functions.
|
functions.
|
||||||
4. Added in version 2.0.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
|
4. Added in version 2.0.0.
|
||||||
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not
|
|
||||||
a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
|
|
||||||
@@ -475,8 +475,10 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
1. Since version 1.0.0.
|
1. Since version 1.0.0.
|
||||||
2. Since version 1.0.0.
|
2. Since version 1.0.0.
|
||||||
3. Since version 2.1.0.
|
3. Since version 2.1.0.
|
||||||
4. Since version 3.2.0. Explicit for different string types if `JSON_USE_IMPLICIT_CONVERSIONS` is `0` since
|
4. Since version 3.2.0. Also initializes the position reported by
|
||||||
version 3.13.0.
|
[`start_pos()`](start_pos.md)/[`end_pos()`](end_pos.md) from `val` when
|
||||||
|
[`JSON_DIAGNOSTIC_POSITIONS`](../macros/json_diagnostic_positions.md) is enabled, since version 3.12.0. Explicit
|
||||||
|
for different string types if `JSON_USE_IMPLICIT_CONVERSIONS` is `0` since version 3.13.0.
|
||||||
5. Since version 1.0.0.
|
5. Since version 1.0.0.
|
||||||
6. Since version 1.0.0.
|
6. Since version 1.0.0.
|
||||||
7. Since version 1.0.0. Fixed in version 3.13.0 to also check the iterator range for binary values; before, a range
|
7. Since version 1.0.0. Fixed in version 3.13.0 to also check the iterator range for binary values; before, a range
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# <small>nlohmann::basic_json::</small>bjdata_version_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
enum class bjdata_version_t
|
||||||
|
{
|
||||||
|
draft2,
|
||||||
|
draft3,
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
This enumeration is used in the [`to_bjdata`](to_bjdata.md) function to choose which draft version of
|
||||||
|
the BJData specification to encode ND-array extensions for:
|
||||||
|
|
||||||
|
draft2
|
||||||
|
: encode using the BJData Draft 2 ND-array format
|
||||||
|
|
||||||
|
draft3
|
||||||
|
: encode using the BJData Draft 3 ND-array format
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows how `bjdata_version_t` selects the BJData draft used by `to_bjdata`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/bjdata_version_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/bjdata_version_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.12.0.
|
||||||
@@ -23,7 +23,7 @@ To store boolean values in C++, a type is defined by the template parameter `Bo
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `BooleanType` (`#!cpp bool`), the default type for `boolean_t` is `#!cpp bool`.
|
With the default values for `BooleanType` (`#!cpp bool`), the default value for `boolean_t` is `#!cpp bool`.
|
||||||
|
|
||||||
### Storage
|
### Storage
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ bool contains(KeyType&& key) const;
|
|||||||
|
|
||||||
// (3)
|
// (3)
|
||||||
bool contains(const json_pointer& ptr) const;
|
bool contains(const json_pointer& ptr) const;
|
||||||
|
|
||||||
// (4)
|
|
||||||
template<typename T>
|
|
||||||
bool contains(T) const = delete;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Check whether an element exists in a JSON object with a key equivalent to `key`. If the element is not found or the
|
1. Check whether an element exists in a JSON object with a key equivalent to `key`. If the element is not found or the
|
||||||
@@ -21,9 +17,6 @@ bool contains(T) const = delete;
|
|||||||
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
||||||
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
||||||
3. Check whether the given JSON pointer `ptr` can be resolved in the current JSON value.
|
3. Check whether the given JSON pointer `ptr` can be resolved in the current JSON value.
|
||||||
4. Deleted: this overload is only available if `T` is an integral type and is declared as deleted, so that a call with
|
|
||||||
an integer `key` (for example, `#!cpp j.contains(0)`) fails to compile. Otherwise, the integer literal `0` would convert to
|
|
||||||
a null `#!cpp const char*` and, from there, to the key type, causing undefined behavior at runtime.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@@ -46,7 +39,6 @@ bool contains(T) const = delete;
|
|||||||
is not an object, `#!cpp false` is returned.
|
is not an object, `#!cpp false` is returned.
|
||||||
2. See 1.
|
2. See 1.
|
||||||
3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise.
|
3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise.
|
||||||
4. Deleted; a call with an integral argument does not compile.
|
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
@@ -57,7 +49,6 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
1. The function does not throw exceptions.
|
1. The function does not throw exceptions.
|
||||||
2. The function does not throw exceptions.
|
2. The function does not throw exceptions.
|
||||||
3. The function does not throw exceptions.
|
3. The function does not throw exceptions.
|
||||||
4. Deleted; a call with an integral argument does not compile.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,12 @@ size_type count(const typename object_t::key_type& key) const;
|
|||||||
// (2)
|
// (2)
|
||||||
template<typename KeyType>
|
template<typename KeyType>
|
||||||
size_type count(KeyType&& key) const;
|
size_type count(KeyType&& key) const;
|
||||||
|
|
||||||
// (3)
|
|
||||||
template<typename T>
|
|
||||||
size_type count(T) const = delete;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Returns the number of elements with key `key`. If `ObjectType` is the default `std::map` type, the return value will
|
1. Returns the number of elements with key `key`. If `ObjectType` is the default `std::map` type, the return value will
|
||||||
always be `0` (`key` was not found) or `1` (`key` was found).
|
always be `0` (`key` was not found) or `1` (`key` was found).
|
||||||
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
||||||
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
||||||
3. Deleted: this overload is only available if `T` is an integral type and is declared as deleted, so that a call with
|
|
||||||
an integer `key` (for example, `#!cpp j.count(0)`) fails to compile. Otherwise, the integer literal `0` would convert to
|
|
||||||
a null `#!cpp const char*` and, from there, to the key type, causing undefined behavior at runtime.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ Currently, only `remove`, `add`, and `replace` operations are generated.
|
|||||||
- [patch](patch.md) applies a JSON Patch
|
- [patch](patch.md) applies a JSON Patch
|
||||||
- [patch_inplace](patch_inplace.md) applies a JSON Patch in place
|
- [patch_inplace](patch_inplace.md) applies a JSON Patch in place
|
||||||
- [merge_patch](merge_patch.md) applies a JSON Merge Patch
|
- [merge_patch](merge_patch.md) applies a JSON Merge Patch
|
||||||
- [merge_diff](merge_diff.md) creates a diff as a JSON Merge Patch
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
|||||||
@@ -62,9 +62,6 @@ Linear.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
Floating-point numbers are written with the fewest digits that read back as the same value (for `#!cpp double`; see
|
|
||||||
[number handling](../../features/types/number_handling.md#number-serialization)).
|
|
||||||
|
|
||||||
Binary values are serialized as an object containing two keys:
|
Binary values are serialized as an object containing two keys:
|
||||||
|
|
||||||
- "bytes": an array of bytes as integers
|
- "bytes": an array of bytes as integers
|
||||||
@@ -100,5 +97,3 @@ Binary values are serialized as an object containing two keys:
|
|||||||
- Error handlers added in version 3.4.0.
|
- Error handlers added in version 3.4.0.
|
||||||
- Serialization of binary values added in version 3.8.0.
|
- Serialization of binary values added in version 3.8.0.
|
||||||
- Error handler `keep` added in version 3.13.0.
|
- Error handler `keep` added in version 3.13.0.
|
||||||
- Doubles are written with the shortest digits (Żmij instead of Grisu2) since version 3.13.0; about 0.1% of doubles are
|
|
||||||
written differently, most of them with fewer digits.
|
|
||||||
@@ -37,8 +37,8 @@ ignore
|
|||||||
: ignore invalid UTF-8 sequences; all valid bytes are copied to the output unchanged, and invalid bytes are dropped
|
: ignore invalid UTF-8 sequences; all valid bytes are copied to the output unchanged, and invalid bytes are dropped
|
||||||
|
|
||||||
keep
|
keep
|
||||||
: keep invalid UTF-8 sequences unchanged; only meaningful for the binary formats mentioned above, since
|
: keep invalid UTF-8 sequences unchanged; only meaningful for the binary formats mentioned above, since [`dump`]
|
||||||
[`dump`](dump.md) itself must produce text, and `keep` there writes the ill-formed bytes to the output as is, so the
|
(dump.md) itself must produce text, and `keep` there writes the ill-formed bytes to the output as is, so the
|
||||||
result is then not valid UTF-8 (but still equals the input bytes exactly, including around any well-formed
|
result is then not valid UTF-8 (but still equals the input bytes exactly, including around any well-formed
|
||||||
characters, which are still escaped as usual)
|
characters, which are still escaped as usual)
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,12 @@ template<typename KeyType>
|
|||||||
iterator find(KeyType&& key);
|
iterator find(KeyType&& key);
|
||||||
template<typename KeyType>
|
template<typename KeyType>
|
||||||
const_iterator find(KeyType&& key) const;
|
const_iterator find(KeyType&& key) const;
|
||||||
|
|
||||||
// (3)
|
|
||||||
template<typename T>
|
|
||||||
iterator find(T) = delete;
|
|
||||||
template<typename T>
|
|
||||||
const_iterator find(T) const = delete;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Finds an element in a JSON object with a key equivalent to `key`. If the element is not found or the
|
1. Finds an element in a JSON object with a key equivalent to `key`. If the element is not found or the
|
||||||
JSON value is not an object, `end()` is returned.
|
JSON value is not an object, `end()` is returned.
|
||||||
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
2. See 1. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
||||||
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
||||||
3. Deleted: this overload is only available if `T` is an integral type and is declared as deleted, so that a call with
|
|
||||||
an integer `key` (for example, `#!cpp j.find(0)`) fails to compile. Otherwise, the integer literal `0` would convert to
|
|
||||||
a null `#!cpp const char*` and, from there, to the key type, causing undefined behavior at runtime.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
|
|||||||
@@ -124,8 +124,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_bjdata` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_bjdata` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.13.0. In version 4.0.0, this overload
|
deprecated in version 3.13.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_bjdata(ptr, len, ...);` with `#!cpp from_bjdata(ptr, ptr+len, ...);`.
|
`#!cpp from_bjdata(ptr, len, ...);` with `#!cpp from_bjdata(ptr, ptr+len, ...);`.
|
||||||
|
|
||||||
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_bon8` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_bon8` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.13.0. In version 4.0.0, this overload
|
deprecated in version 3.13.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_bon8(ptr, len, ...);` with `#!cpp from_bon8(ptr, ptr+len, ...);`.
|
`#!cpp from_bon8(ptr, len, ...);` with `#!cpp from_bon8(ptr, ptr+len, ...);`.
|
||||||
|
|
||||||
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_bson` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_bson` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.8.0. In version 4.0.0, this overload
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_bson(ptr, len, ...);` with `#!cpp from_bson(ptr, ptr+len, ...);`.
|
`#!cpp from_bson(ptr, len, ...);` with `#!cpp from_bson(ptr, ptr+len, ...);`.
|
||||||
- Overload (2) replaces calls to `from_bson` with a pair of iterators as their first parameter, which has been
|
- Overload (2) replaces calls to `from_bson` with a pair of iterators as their first parameter, which has been
|
||||||
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
|
|||||||
@@ -135,8 +135,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_cbor` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_cbor` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.8.0. In version 4.0.0, this overload
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_cbor(ptr, len, ...);` with `#!cpp from_cbor(ptr, ptr+len, ...);`.
|
`#!cpp from_cbor(ptr, len, ...);` with `#!cpp from_cbor(ptr, ptr+len, ...);`.
|
||||||
- Overload (2) replaces calls to `from_cbor` with a pair of iterators as their first parameter, which has been
|
- Overload (2) replaces calls to `from_cbor` with a pair of iterators as their first parameter, which has been
|
||||||
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_msgpack` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_msgpack` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.8.0. In version 4.0.0, this overload
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_msgpack(ptr, len, ...);` with `#!cpp from_msgpack(ptr, ptr+len, ...);`.
|
`#!cpp from_msgpack(ptr, len, ...);` with `#!cpp from_msgpack(ptr, ptr+len, ...);`.
|
||||||
- Overload (2) replaces calls to `from_msgpack` with a pair of iterators as their first parameter, which has been
|
- Overload (2) replaces calls to `from_msgpack` with a pair of iterators as their first parameter, which has been
|
||||||
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
|
|||||||
@@ -125,8 +125,7 @@ Linear in the size of the input.
|
|||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
- Overload (2) replaces calls to `from_ubjson` with a pointer and a length as first two parameters, which has been
|
- Overload (2) replaces calls to `from_ubjson` with a pointer and a length as first two parameters, which has been
|
||||||
deprecated in version 3.8.0. In version 4.0.0, this overload
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
will be deleted (`= delete`) rather than removed. Please replace all calls like
|
|
||||||
`#!cpp from_ubjson(ptr, len, ...);` with `#!cpp from_ubjson(ptr, ptr+len, ...);`.
|
`#!cpp from_ubjson(ptr, len, ...);` with `#!cpp from_ubjson(ptr, ptr+len, ...);`.
|
||||||
- Overload (2) replaces calls to `from_ubjson` with a pair of iterators as their first parameter, which has been
|
- Overload (2) replaces calls to `from_ubjson` with a pair of iterators as their first parameter, which has been
|
||||||
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ The class satisfies the following concept requirements:
|
|||||||
- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with
|
- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with
|
||||||
`==`, see [`operator==`](operator_eq.md).
|
`==`, see [`operator==`](operator_eq.md).
|
||||||
- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with
|
- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with
|
||||||
`<`, see [`operator<`](operator_lt.md).
|
`<`, see [`operator<`](operator_le.md).
|
||||||
- [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with
|
- [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with
|
||||||
any lvalue or rvalue of other compatible types, using unqualified function `swap`.
|
any lvalue or rvalue of other compatible types, using unqualified function `swap`.
|
||||||
- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against
|
- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against
|
||||||
@@ -285,7 +285,6 @@ Access to the JSON value
|
|||||||
### JSON Merge Patch functions
|
### JSON Merge Patch functions
|
||||||
|
|
||||||
- [**merge_patch**](merge_patch.md) - applies a JSON Merge Patch
|
- [**merge_patch**](merge_patch.md) - applies a JSON Merge Patch
|
||||||
- [**merge_diff**](merge_diff.md) (_static_) - creates a diff as a JSON Merge Patch
|
|
||||||
|
|
||||||
## Static functions
|
## Static functions
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# <small>nlohmann::basic_json::</small>initializer_list_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used for the initializer-list [constructor](basic_json.md) (overload 5) and for functions
|
||||||
|
such as [`operator=`](operator=.md) that accept a braced-init-list of JSON values. Each element wraps a
|
||||||
|
`basic_json` value or something convertible to one, deferring the decision of whether the list should be
|
||||||
|
parsed as a JSON array or a JSON object to the constructor itself.
|
||||||
|
|
||||||
|
See the [constructor](basic_json.md) documentation for how `initializer_list_t` values are interpreted.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows how an `initializer_list_t` is used to construct a JSON value.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/initializer_list_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/initializer_list_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Since version 1.0.0.
|
||||||
@@ -62,5 +62,5 @@ same name. Hidden members remain accessible via [`as_base_class`](as_base_class.
|
|||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.3.
|
- Added in version 3.12.0.
|
||||||
- Made a public member type in version 3.13.0; it was private before, so it could not be named outside the class.
|
- Made a public member type in version 3.13.0; it was private before, so it could not be named outside the class.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# <small>nlohmann::basic_json::</small>json_sax_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using json_sax_t = json_sax<basic_json>;
|
||||||
|
```
|
||||||
|
|
||||||
|
The [`json_sax`](../json_sax/index.md) interface bound to this `basic_json` specialization, i.e. with
|
||||||
|
`BasicJsonType` fixed to `basic_json`. Used as the SAX interface type by [`sax_parse`](sax_parse.md) and
|
||||||
|
other SAX-based parsing functions.
|
||||||
|
|
||||||
|
See [`nlohmann::json_sax`](../json_sax/index.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `json_sax_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
# <small>nlohmann::basic_json::</small>merge_diff
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
static basic_json merge_diff(const basic_json& source,
|
|
||||||
const basic_json& target);
|
|
||||||
```
|
|
||||||
|
|
||||||
Creates a [JSON Merge Patch](https://tools.ietf.org/html/rfc7396) so that value `source` can be changed into the value
|
|
||||||
`target` by calling the [`merge_patch`](merge_patch.md) function. The patch contains only what differs: changed and
|
|
||||||
added members with their new values, and removed members with the value `#!json null`. Nested objects are compared
|
|
||||||
member by member; any other value that differs, including an array, is replaced as a whole.
|
|
||||||
|
|
||||||
For two JSON values `source` and `target`, where `target` contains no object member whose value is `#!json null`, the
|
|
||||||
following code always yields `#!cpp true` (for [`ordered_json`](../ordered_json.md), see the notes below):
|
|
||||||
```cpp
|
|
||||||
basic_json patched = source;
|
|
||||||
patched.merge_patch(merge_diff(source, target));
|
|
||||||
patched == target;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
`source` (in)
|
|
||||||
: JSON value to compare from
|
|
||||||
|
|
||||||
`target` (in)
|
|
||||||
: JSON value to compare against
|
|
||||||
|
|
||||||
## Return value
|
|
||||||
|
|
||||||
a JSON Merge Patch to convert the `source` to `target`
|
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: `source` and `target` are never modified.
|
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Linear in the total number of values (including nested ones) in `source` and `target`, times the cost of a key-based
|
|
||||||
object operation (looking up a key, or adding one to the patch): logarithmic for [`json`](../json.md), and linear for
|
|
||||||
[`ordered_json`](../ordered_json.md) (see [`ordered_map` complexity](../ordered_map.md#complexity)). For
|
|
||||||
`ordered_json`, diffing two objects with `n` and `m` members therefore takes O((n+m)²).
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- A merge patch uses `#!json null` to remove a member, so it cannot set a member to `#!json null`. As in RFC 7396, a
|
|
||||||
`#!json null` member of `target` is treated as absent: the patch removes the member from `source` instead of setting
|
|
||||||
it to `#!json null`. A member that is `#!json null` in both `source` and `target` is unchanged and left out of the
|
|
||||||
patch, so `source` keeps it.
|
|
||||||
- A merge patch cannot reorder object members, and [`merge_patch`](merge_patch.md) appends added members at the end.
|
|
||||||
For [`ordered_json`](../ordered_json.md), the patched value therefore has the same members as `target`, but not
|
|
||||||
necessarily in the same order, and may compare unequal to it. The patch lists changed and removed members in the
|
|
||||||
order of `source`, followed by added members in the order of `target`.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
??? example
|
|
||||||
|
|
||||||
The following code shows how a JSON Merge Patch is created as a diff for two JSON values.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/merge_diff.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/merge_diff.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
|
|
||||||
- [merge_patch](merge_patch.md) applies a JSON Merge Patch
|
|
||||||
- [diff](diff.md) creates a diff as a JSON Patch
|
|
||||||
|
|
||||||
## Version history
|
|
||||||
|
|
||||||
- Added in version 3.13.0.
|
|
||||||
@@ -67,7 +67,6 @@ returned by `#!cpp (*this)[key]`); it is read as it was when `merge_patch()` was
|
|||||||
|
|
||||||
- [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
|
- [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
|
||||||
- [patch](patch.md) apply a JSON patch
|
- [patch](patch.md) apply a JSON patch
|
||||||
- [merge_diff](merge_diff.md) creates a diff as a JSON Merge Patch
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ type to use.
|
|||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
`NumberFloatType`
|
`NumberFloatType`
|
||||||
: the type to store floating-point numbers. The type must be `#!cpp float`, `#!cpp double`, or
|
: the type to store floating-point numbers. Parsing and serialization are implemented in terms of
|
||||||
`#!cpp long double`. The parser converts `#!cpp float`, `#!cpp double`, and a `#!cpp long double` that is IEEE 754
|
`#!cpp std::strtof`/`#!cpp std::strtod`/`#!cpp std::strtold` and `#!cpp std::snprintf`, so the type must be
|
||||||
binary64 itself. It converts other `#!cpp long double` formats with `#!cpp std::from_chars` where available, or
|
`#!cpp float`, `#!cpp double`, or `#!cpp long double`. The
|
||||||
with `#!cpp std::strtold` otherwise. Serialization falls back to `#!cpp std::snprintf`. The
|
|
||||||
[binary formats](../../features/binary_formats/index.md) additionally require `#!cpp float` or `#!cpp double`,
|
[binary formats](../../features/binary_formats/index.md) additionally require `#!cpp float` or `#!cpp double`,
|
||||||
because they have no encoding for `#!cpp long double`. See
|
because they have no encoding for `#!cpp long double`. See
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#numberfloattype).
|
[Template Parameter Requirements](../../features/types/template_parameters.md#numberfloattype).
|
||||||
@@ -35,7 +34,7 @@ type to use.
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `NumberFloatType` (`double`), the default type for `number_float_t` is `#!cpp double`.
|
With the default values for `NumberFloatType` (`double`), the default value for `number_float_t` is `#!cpp double`.
|
||||||
|
|
||||||
### Default behavior
|
### Default behavior
|
||||||
|
|
||||||
@@ -52,11 +51,9 @@ With the default values for `NumberFloatType` (`double`), the default type for `
|
|||||||
> interoperability can be achieved by implementations that expect no more precision or range than these provide, in the
|
> interoperability can be achieved by implementations that expect no more precision or range than these provide, in the
|
||||||
> sense that implementations will approximate JSON numbers within the expected precision.
|
> sense that implementations will approximate JSON numbers within the expected precision.
|
||||||
|
|
||||||
This implementation does exactly follow this approach, as it uses double precision floating-point numbers by default.
|
This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values
|
||||||
Note that with the default `double`, numbers smaller than `-1.79769313486232e+308` or greater than
|
smaller than `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` will be stored as NaN internally
|
||||||
`1.79769313486232e+308` are rejected during parsing with
|
and be serialized to `null`.
|
||||||
[`out_of_range.406`](../../home/exceptions.md#jsonexceptionout_of_range406). Non-finite values (NaN and infinity) can
|
|
||||||
only be stored by assigning them directly and are serialized to `null`.
|
|
||||||
|
|
||||||
During deserialization (from JSON text or any of the binary formats), a finite number that does not fit into
|
During deserialization (from JSON text or any of the binary formats), a finite number that does not fit into
|
||||||
`number_float_t` is rejected with [`out_of_range.406`](../../home/exceptions.md#jsonexceptionout_of_range406), for
|
`number_float_t` is rejected with [`out_of_range.406`](../../home/exceptions.md#jsonexceptionout_of_range406), for
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ to use.
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `NumberIntegerType` (`std::int64_t`), the default type for `number_integer_t` is
|
With the default values for `NumberIntegerType` (`std::int64_t`), the default value for `number_integer_t` is
|
||||||
`#!cpp std::int64_t`.
|
`#!cpp std::int64_t`.
|
||||||
|
|
||||||
### Default behavior
|
### Default behavior
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ the type to use.
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `NumberUnsignedType` (`std::uint64_t`), the default type for `number_unsigned_t` is
|
With the default values for `NumberUnsignedType` (`std::uint64_t`), the default value for `number_unsigned_t` is
|
||||||
`#!cpp std::uint64_t`.
|
`#!cpp std::uint64_t`.
|
||||||
|
|
||||||
### Default behavior
|
### Default behavior
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ To store objects in C++, a type is defined by the template parameters described
|
|||||||
|
|
||||||
`StringType`
|
`StringType`
|
||||||
: the type of the keys or names (e.g., `std::string`). The comparison function `std::less<StringType>` is used to
|
: the type of the keys or names (e.g., `std::string`). The comparison function `std::less<StringType>` is used to
|
||||||
order elements inside the container.
|
order elements inside the container. `object_t::key_type` must be implicitly convertible to `string_t` (required by the
|
||||||
|
binary formats).
|
||||||
|
|
||||||
`AllocatorType`
|
`AllocatorType`
|
||||||
: the allocator to use for objects (e.g., `std::allocator`)
|
: the allocator to use for objects (e.g., `std::allocator`)
|
||||||
@@ -36,7 +37,7 @@ To store objects in C++, a type is defined by the template parameters described
|
|||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `ObjectType` (`std::map`), `StringType` (`std::string`), and `AllocatorType`
|
With the default values for `ObjectType` (`std::map`), `StringType` (`std::string`), and `AllocatorType`
|
||||||
(`std::allocator`), the default type for `object_t` is:
|
(`std::allocator`), the default value for `object_t` is:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// until C++14
|
// until C++14
|
||||||
|
|||||||
@@ -51,3 +51,5 @@ Linear.
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
- The `noexcept` specification was extended to also depend on
|
||||||
|
[`json_base_class_t`](json_base_class_t.md)'s move-assignment in version 3.11.3.
|
||||||
@@ -286,6 +286,4 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
|
3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
|
||||||
already supported by [`at`](at.md), [`value`](value.md), [`find`](find.md), and other lookup functions.
|
already supported by [`at`](at.md), [`value`](value.md), [`find`](find.md), and other lookup functions.
|
||||||
4. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since
|
4. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since
|
||||||
version 3.13.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
|
version 3.13.0.
|
||||||
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not
|
|
||||||
a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
|
|
||||||
@@ -92,3 +92,8 @@ Linear in the size of the JSON value.
|
|||||||
- Since version 1.0.0.
|
- Since version 1.0.0.
|
||||||
- Macros `JSON_EXPLICIT`/[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) added
|
- Macros `JSON_EXPLICIT`/[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) added
|
||||||
in version 3.9.0.
|
in version 3.9.0.
|
||||||
|
- The exclusion of `std::any` from this conversion became conditional on
|
||||||
|
[`JSON_HAS_STATIC_RTTI`](../macros/json_has_static_rtti.md) in version 3.11.3.
|
||||||
|
- `std::optional<T>` excluded from this conversion in version 3.13.0; use
|
||||||
|
[`get<std::optional<T>>()`](get.md)/[`get_to()`](get_to.md) instead (see
|
||||||
|
[Converting values](../../features/conversions.md)).
|
||||||
@@ -11,17 +11,18 @@ template<typename ScalarType>
|
|||||||
bool operator==(ScalarType lhs, const const_reference rhs) noexcept(/* see below */); // (2)
|
bool operator==(ScalarType lhs, const const_reference rhs) noexcept(/* see below */); // (2)
|
||||||
|
|
||||||
// since C++20
|
// since C++20
|
||||||
bool operator==(const_reference rhs) const noexcept; // (1)
|
class basic_json {
|
||||||
|
bool operator==(const_reference rhs) const noexcept; // (1)
|
||||||
|
|
||||||
template<typename ScalarType>
|
template<typename ScalarType>
|
||||||
bool operator==(ScalarType rhs) const noexcept(/* see below */); // (2)
|
bool operator==(ScalarType rhs) const noexcept(/* see below */); // (2)
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Compares two JSON values for equality according to the following rules:
|
1. Compares two JSON values for equality according to the following rules:
|
||||||
- Two JSON values are equal if (1) neither value is discarded, and (2) they are of the same type and their stored
|
- Two JSON values are equal if (1) neither value is discarded, and (2) they are of the same type and their stored
|
||||||
values are the same according to their respective `operator==`.
|
values are the same according to their respective `operator==`.
|
||||||
- Integer and floating-point numbers are compared by their exact values, without converting the integer to
|
- Integer and floating-point numbers are automatically converted before comparison.
|
||||||
floating-point. For instance, `9007199254740993` and `9007199254740992.0` are not equal.
|
|
||||||
|
|
||||||
2. Compares a JSON value and a scalar or a scalar and a JSON value for equality by converting the
|
2. Compares a JSON value and a scalar or a scalar and a JSON value for equality by converting the
|
||||||
scalar to a JSON value and comparing both JSON values according to 1.
|
scalar to a JSON value and comparing both JSON values according to 1.
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ bool operator<(ScalarType lhs, const const_reference rhs) noexcept(/* see below
|
|||||||
following rules:
|
following rules:
|
||||||
- If either operand is discarded, the comparison yields `#!cpp false`.
|
- If either operand is discarded, the comparison yields `#!cpp false`.
|
||||||
- If both operands have the same type, the values are compared using their respective `operator<`.
|
- If both operands have the same type, the values are compared using their respective `operator<`.
|
||||||
- Integer and floating-point numbers are compared by their exact values, without converting the integer to
|
- Integer and floating-point numbers are automatically converted before comparison.
|
||||||
floating-point. For instance, `9007199254740992.0` is less than `9007199254740993`.
|
|
||||||
- In case `lhs` and `rhs` have different types, the values are ignored and the order of the types
|
- In case `lhs` and `rhs` have different types, the values are ignored and the order of the types
|
||||||
is considered, which is:
|
is considered, which is:
|
||||||
1. null
|
1. null
|
||||||
|
|||||||
@@ -2,18 +2,22 @@
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// since C++20
|
// since C++20
|
||||||
std::partial_ordering operator<=>(const_reference rhs) const noexcept; // (1)
|
class basic_json {
|
||||||
|
std::partial_ordering operator<=>(const_reference rhs) const noexcept; // (1)
|
||||||
|
|
||||||
template<typename ScalarType>
|
template<typename ScalarType>
|
||||||
std::partial_ordering operator<=>(const ScalarType rhs) const noexcept(/* see below */); // (2)
|
std::partial_ordering operator<=>(const ScalarType rhs) const noexcept(/* see below */); // (2)
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
1. 3-way compares two JSON values producing a result of type `std::partial_ordering` according to the following rules:
|
1. 3-way compares two JSON values producing a result of type `std::partial_ordering` according to the following rules:
|
||||||
- Two JSON values compare with a result of `std::partial_ordering::unordered` if either value is discarded.
|
- Two JSON values compare with a result of `std::partial_ordering::unordered` if either value is discarded.
|
||||||
- If both JSON values are of the same type, the result is produced by 3-way comparing their stored values using
|
- If both JSON values are of the same type, the result is produced by 3-way comparing their stored values using
|
||||||
their respective `operator<=>`.
|
their respective `operator<=>`.
|
||||||
- Integer and floating-point numbers are 3-way compared by their exact values, without converting the integer to
|
- Integer and floating-point numbers are converted to their common type and then 3-way compared using their
|
||||||
floating-point. For instance, `9007199254740993` compares greater than `9007199254740992.0`.
|
respective `operator<=>`.
|
||||||
|
For instance, comparing an integer and a floating-point value will 3-way compare the first value converted to
|
||||||
|
floating-point with the second value.
|
||||||
- Otherwise, yields a result by comparing the type (see [`value_t`](value_t.md)).
|
- Otherwise, yields a result by comparing the type (see [`value_t`](value_t.md)).
|
||||||
|
|
||||||
2. 3-way compares a JSON value and a scalar or a scalar and a JSON value by converting the scalar to a JSON value and
|
2. 3-way compares a JSON value and a scalar or a scalar and a JSON value by converting the scalar to a JSON value and
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
pointer inside the patch cannot be resolved, e.g., `-` in a "remove" operation or `1a` for an array; example:
|
pointer inside the patch cannot be resolved, e.g., `-` in a "remove" operation or `1a` for an array; example:
|
||||||
`"unresolved reference token '-'"`.
|
`"unresolved reference token '-'"`.
|
||||||
- Throws [`out_of_range.405`](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent
|
- Throws [`out_of_range.405`](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent
|
||||||
("remove", "move")
|
("add", "remove", "move")
|
||||||
- Throws [`out_of_range.411`](../../home/exceptions.md#jsonexceptionout_of_range411) if an "add" operation's target
|
- Throws [`out_of_range.411`](../../home/exceptions.md#jsonexceptionout_of_range411) if an "add" operation's target
|
||||||
location has a parent that is neither an object nor an array.
|
location has a parent that is neither an object nor an array.
|
||||||
- Throws [`out_of_range.413`](../../home/exceptions.md#jsonexceptionout_of_range413) if a "remove" operation's target
|
- Throws [`out_of_range.413`](../../home/exceptions.md#jsonexceptionout_of_range413) if a "remove" operation's target
|
||||||
@@ -112,6 +112,3 @@ is thrown. In any case, the original value is not changed: the patch is applied
|
|||||||
location has a non-object/non-array parent in version 3.13.0.
|
location has a non-object/non-array parent in version 3.13.0.
|
||||||
- Added [`out_of_range.414`](../../home/exceptions.md#jsonexceptionout_of_range414) and rejected a "move" operation whose "from" location is a proper
|
- Added [`out_of_range.414`](../../home/exceptions.md#jsonexceptionout_of_range414) and rejected a "move" operation whose "from" location is a proper
|
||||||
prefix of its "path" location instead of silently producing a corrupted result in version 3.13.0.
|
prefix of its "path" location instead of silently producing a corrupted result in version 3.13.0.
|
||||||
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
|
|
||||||
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is
|
|
||||||
not a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
|
|
||||||
@@ -41,7 +41,7 @@ No guarantees, value may be corrupted by an unsuccessful patch operation.
|
|||||||
pointer inside the patch cannot be resolved, e.g., `-` in a "remove" operation or `1a` for an array; example:
|
pointer inside the patch cannot be resolved, e.g., `-` in a "remove" operation or `1a` for an array; example:
|
||||||
`"unresolved reference token '-'"`.
|
`"unresolved reference token '-'"`.
|
||||||
- Throws [`out_of_range.405`](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent
|
- Throws [`out_of_range.405`](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent
|
||||||
("remove", "move")
|
("add", "remove", "move")
|
||||||
- Throws [`out_of_range.411`](../../home/exceptions.md#jsonexceptionout_of_range411) if an "add" operation's target
|
- Throws [`out_of_range.411`](../../home/exceptions.md#jsonexceptionout_of_range411) if an "add" operation's target
|
||||||
location has a parent that is neither an object nor an array.
|
location has a parent that is neither an object nor an array.
|
||||||
- Throws [`out_of_range.413`](../../home/exceptions.md#jsonexceptionout_of_range413) if a "remove" operation's target
|
- Throws [`out_of_range.413`](../../home/exceptions.md#jsonexceptionout_of_range413) if a "remove" operation's target
|
||||||
@@ -110,6 +110,3 @@ function throws an exception.
|
|||||||
location has a non-object/non-array parent in version 3.13.0.
|
location has a non-object/non-array parent in version 3.13.0.
|
||||||
- Added [`out_of_range.414`](../../home/exceptions.md#jsonexceptionout_of_range414) and rejected a "move" operation whose "from" location is a proper
|
- Added [`out_of_range.414`](../../home/exceptions.md#jsonexceptionout_of_range414) and rejected a "move" operation whose "from" location is a proper
|
||||||
prefix of its "path" location instead of silently producing a corrupted result in version 3.13.0.
|
prefix of its "path" location instead of silently producing a corrupted result in version 3.13.0.
|
||||||
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
|
|
||||||
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is
|
|
||||||
not a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
|
|
||||||
@@ -32,7 +32,7 @@ JSON class into byte-sized characters during deserialization.
|
|||||||
|
|
||||||
### Default type
|
### Default type
|
||||||
|
|
||||||
With the default values for `StringType` (`std::string`), the default type for `string_t` is `#!cpp std::string`.
|
With the default values for `StringType` (`std::string`), the default value for `string_t` is `#!cpp std::string`.
|
||||||
|
|
||||||
### Encoding
|
### Encoding
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ With (2), the bytes written before the exception remain in the output adapter.
|
|||||||
above 9223372036854775807, which BON8 cannot represent
|
above 9223372036854775807, which BON8 cannot represent
|
||||||
- Throws [type_error.316](../../home/exceptions.md#jsonexceptiontype_error316) if `j` contains a string that is not
|
- Throws [type_error.316](../../home/exceptions.md#jsonexceptiontype_error316) if `j` contains a string that is not
|
||||||
valid UTF-8
|
valid UTF-8
|
||||||
- Throws [type_error.321](../../home/exceptions.md#jsonexceptiontype_error321) if `j` or a value nested in it is
|
|
||||||
discarded; example: `"cannot serialize discarded value to BON8"`
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,8 @@ The function can throw the following exceptions:
|
|||||||
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in a key is not a
|
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in a key is not a
|
||||||
number; example: `"array index 'one' is not a number"`
|
number; example: `"array index 'one' is not a number"`
|
||||||
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if a level becomes an array
|
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if a level becomes an array
|
||||||
(because one of its keys is `0`) and another key at that level begins with a digit but is not a valid array index
|
(because one of its keys is `0`) and another key at that level cannot be an array index; example:
|
||||||
(such as `1a`), or is `-`; example:
|
`"unresolved reference token 'x'"`
|
||||||
`"unresolved reference token '-'"`
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
@@ -81,6 +80,3 @@ Apart from these two cases, for a JSON value `j`, the following is always true:
|
|||||||
|
|
||||||
- Added in version 2.0.0.
|
- Added in version 2.0.0.
|
||||||
- Made the array/object decision independent of the object's iteration order in version 3.13.0.
|
- Made the array/object decision independent of the object's iteration order in version 3.13.0.
|
||||||
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
|
|
||||||
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is
|
|
||||||
not a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
|
|
||||||
@@ -119,14 +119,6 @@ changes to any JSON value.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
!!! warning "`null` members are not missing"
|
|
||||||
|
|
||||||
The default value is used only if the key (or JSON Pointer) does not exist. A member that exists but is
|
|
||||||
`#!json null` is converted like any other value, so `#!cpp j.value("k", 0)` throws a
|
|
||||||
[`type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) if `"k"` is `#!json null`. See
|
|
||||||
[Access with default value](../../features/element_access/default_value.md)
|
|
||||||
for alternatives.
|
|
||||||
|
|
||||||
!!! warning "Return type"
|
!!! warning "Return type"
|
||||||
|
|
||||||
The value function is a template, and the return type of the function is determined by the type of the provided
|
The value function is a template, and the return type of the function is determined by the type of the provided
|
||||||
@@ -235,6 +227,4 @@ changes to any JSON value.
|
|||||||
[`operator[]`](operator[].md), [`at`](at.md), [`find`](find.md), and other lookup functions.
|
[`operator[]`](operator[].md), [`at`](at.md), [`find`](find.md), and other lookup functions.
|
||||||
3. Added in version 2.0.2. Extended to work with arrays in version 3.13.0, including fixing an issue where resolving
|
3. Added in version 2.0.2. Extended to work with arrays in version 3.13.0, including fixing an issue where resolving
|
||||||
`ptr` through an array unexpectedly threw `out_of_range` instead of returning the resolved element (or
|
`ptr` through an array unexpectedly threw `out_of_range` instead of returning the resolved element (or
|
||||||
`default_value`, as documented). Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109)
|
`default_value`, as documented).
|
||||||
instead of returning `default_value` for a one-character array index that is not a digit (e.g., `/x`) in version
|
|
||||||
3.13.0, as it already did for longer ones.
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# <small>nlohmann::byte_container_with_subtype::</small>container_type
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using container_type = BinaryType;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type of the underlying binary container, forwarded from the `BinaryType` template parameter that
|
||||||
|
`byte_container_with_subtype` is instantiated with. `byte_container_with_subtype` publicly inherits from
|
||||||
|
`container_type`.
|
||||||
|
|
||||||
|
See [`basic_json::binary_t`](../basic_json/binary_t.md) for the type typically used to instantiate
|
||||||
|
`BinaryType`.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `container_type`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/byte_container_with_subtype__container_type.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/byte_container_with_subtype__container_type.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Since version 3.8.0.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# <small>nlohmann::byte_container_with_subtype::</small>subtype_type
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using subtype_type = std::uint64_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used to store the optional binary subtype tag. See [`subtype`](subtype.md) and
|
||||||
|
[`set_subtype`](set_subtype.md).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `subtype_type`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/byte_container_with_subtype__subtype_type.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/byte_container_with_subtype__subtype_type.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Since version 3.8.0.
|
||||||
@@ -18,11 +18,13 @@ bool operator==(
|
|||||||
const json_pointer<RefStringTypeRhs>& rhs); // (2)
|
const json_pointer<RefStringTypeRhs>& rhs); // (2)
|
||||||
|
|
||||||
// since C++20
|
// since C++20
|
||||||
template<typename RefStringTypeRhs>
|
class json_pointer {
|
||||||
bool operator==(
|
template<typename RefStringTypeRhs>
|
||||||
const json_pointer<RefStringTypeRhs>& rhs) const noexcept; // (1)
|
bool operator==(
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs) const noexcept; // (1)
|
||||||
|
|
||||||
bool operator==(const string_t& rhs) const; // (2)
|
bool operator==(const string_t& rhs) const; // (2)
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Compares two JSON pointers for equality by comparing their reference tokens.
|
1. Compares two JSON pointers for equality by comparing their reference tokens.
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// since C++20
|
// since C++20
|
||||||
template<typename RefStringTypeRhs>
|
class json_pointer {
|
||||||
std::strong_ordering operator<=>(const json_pointer<RefStringTypeRhs>& rhs) const noexcept; // *NOPAD*
|
template<typename RefStringTypeRhs>
|
||||||
|
std::strong_ordering operator<=>(const json_pointer<RefStringTypeRhs>& rhs) const noexcept; // *NOPAD*
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
3-way compares two JSON pointers by lexicographically comparing their sequences of reference tokens: corresponding
|
3-way compares two JSON pointers by lexicographically comparing their sequences of reference tokens: corresponding
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>binary_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using binary_t = typename BasicJsonType::binary_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used by the [`binary`](binary.md) callback for JSON binary values, forwarded from the
|
||||||
|
`BasicJsonType` template parameter.
|
||||||
|
|
||||||
|
See [`basic_json::binary_t`](../basic_json/binary_t.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `binary_t` and its relation to `basic_json::binary_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax__binary_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax__binary_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.8.0.
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>json_sax
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// (1)
|
||||||
|
json_sax() = default;
|
||||||
|
|
||||||
|
// (2)
|
||||||
|
json_sax(const json_sax&) = default;
|
||||||
|
|
||||||
|
// (3)
|
||||||
|
json_sax(json_sax&&) noexcept = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Default constructor.
|
||||||
|
2. Copy constructor.
|
||||||
|
3. Move constructor.
|
||||||
|
|
||||||
|
`json_sax` is a pure abstract base class with no data members of its own, so all three constructors are
|
||||||
|
defaulted and only exist to make derived SAX consumers explicitly copyable/movable.
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
No-throw guarantee: none of these constructors throw exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
|
<!-- NOLINT Examples -->
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>number_float_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using number_float_t = typename BasicJsonType::number_float_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used by the [`number_float`](number_float.md) callback for JSON floating-point numbers,
|
||||||
|
forwarded from the `BasicJsonType` template parameter.
|
||||||
|
|
||||||
|
See [`basic_json::number_float_t`](../basic_json/number_float_t.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `number_float_t` and its relation to `basic_json::number_float_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax__number_float_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax__number_float_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>number_integer_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using number_integer_t = typename BasicJsonType::number_integer_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used by the [`number_integer`](number_integer.md) callback for JSON integer numbers, forwarded
|
||||||
|
from the `BasicJsonType` template parameter.
|
||||||
|
|
||||||
|
See [`basic_json::number_integer_t`](../basic_json/number_integer_t.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `number_integer_t` and its relation to `basic_json::number_integer_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax__number_integer_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax__number_integer_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>number_unsigned_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used by the [`number_unsigned`](number_unsigned.md) callback for JSON unsigned integer numbers,
|
||||||
|
forwarded from the `BasicJsonType` template parameter.
|
||||||
|
|
||||||
|
See [`basic_json::number_unsigned_t`](../basic_json/number_unsigned_t.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `number_unsigned_t` and its relation to `basic_json::number_unsigned_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax__number_unsigned_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax__number_unsigned_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>operator=
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// (1)
|
||||||
|
json_sax& operator=(const json_sax&) = default;
|
||||||
|
|
||||||
|
// (2)
|
||||||
|
json_sax& operator=(json_sax&&) noexcept = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Copy assignment operator.
|
||||||
|
2. Move assignment operator.
|
||||||
|
|
||||||
|
`json_sax` is a pure abstract base class with no data members of its own, so both assignment operators
|
||||||
|
are defaulted and only exist to make derived SAX consumers explicitly copy-/move-assignable.
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
No-throw guarantee: neither operator throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
|
<!-- NOLINT Examples -->
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>string_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using string_t = typename BasicJsonType::string_t;
|
||||||
|
```
|
||||||
|
|
||||||
|
The type used by the [`string`](string.md) and [`key`](key.md) callbacks for JSON strings and object
|
||||||
|
keys, forwarded from the `BasicJsonType` template parameter.
|
||||||
|
|
||||||
|
See [`basic_json::string_t`](../basic_json/string_t.md) for more information.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows the type `string_t` and its relation to `basic_json::string_t`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_sax__string_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_sax__string_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# <small>nlohmann::json_sax::</small>~json_sax
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
virtual ~json_sax() = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
Destructor. Virtual to allow proper destruction of derived SAX consumer classes through a
|
||||||
|
pointer/reference to `json_sax`.
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
No-throw guarantee: this destructor never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
|
<!-- NOLINT Examples -->
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.2.0.
|
||||||
@@ -27,7 +27,6 @@ header. See also the [macro overview page](../../features/macros.md).
|
|||||||
|
|
||||||
- [**JSON_HAS_CPP_11**<br>**JSON_HAS_CPP_14**<br>**JSON_HAS_CPP_17**<br>**JSON_HAS_CPP_20**](json_has_cpp_11.md) - set supported C++ standard
|
- [**JSON_HAS_CPP_11**<br>**JSON_HAS_CPP_14**<br>**JSON_HAS_CPP_17**<br>**JSON_HAS_CPP_20**](json_has_cpp_11.md) - set supported C++ standard
|
||||||
- [**JSON_HAS_FILESYSTEM**<br>**JSON_HAS_EXPERIMENTAL_FILESYSTEM**](json_has_filesystem.md) - control `std::filesystem` support
|
- [**JSON_HAS_FILESYSTEM**<br>**JSON_HAS_EXPERIMENTAL_FILESYSTEM**](json_has_filesystem.md) - control `std::filesystem` support
|
||||||
- [**JSON_HAS_RANGE_VIEW_CONVERSION**](json_has_range_view_conversion.md) - control construction from `std::ranges` views
|
|
||||||
- [**JSON_HAS_RANGES**](json_has_ranges.md) - control `std::ranges` support
|
- [**JSON_HAS_RANGES**](json_has_ranges.md) - control `std::ranges` support
|
||||||
- [**JSON_HAS_STATIC_RTTI**](json_has_static_rtti.md) - control RTTI (run time type information) support
|
- [**JSON_HAS_STATIC_RTTI**](json_has_static_rtti.md) - control RTTI (run time type information) support
|
||||||
- [**JSON_HAS_STD_FORMAT**](json_has_std_format.md) - control `std::format`/`std::formatter` support
|
- [**JSON_HAS_STD_FORMAT**](json_has_std_format.md) - control `std::format`/`std::formatter` support
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ The default value is detected based on preprocessor macros such as `#!cpp __cplu
|
|||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.10.0.
|
- Added in version 3.10.5.
|
||||||
- Added `JSON_HAS_CPP_23` in version 3.12.0.
|
- Added `JSON_HAS_CPP_23` in version 3.12.0.
|
||||||
- Added `JSON_HAS_CPP_26` in version 3.13.0.
|
- Added `JSON_HAS_CPP_26` in version 3.13.0.
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# JSON_HAS_RANGE_VIEW_CONVERSION
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
#define JSON_HAS_RANGE_VIEW_CONVERSION /* value */
|
|
||||||
```
|
|
||||||
|
|
||||||
This macro indicates whether a JSON array can be constructed directly from a C++20 range view (`std::ranges::view`),
|
|
||||||
such as the result of `std::views::filter` or `std::views::transform`. Possible values are `1` when supported or `0`
|
|
||||||
when unsupported.
|
|
||||||
|
|
||||||
## Default definition
|
|
||||||
|
|
||||||
The default value is `1` if [`JSON_HAS_RANGES`](json_has_ranges.md) is `1` and the compiler is not MinGW (that is,
|
|
||||||
`#!cpp __MINGW32__` is not defined), and `0` otherwise.
|
|
||||||
|
|
||||||
When the macro is not defined, the library will define it to its default value.
|
|
||||||
|
|
||||||
!!! info "Known compiler/stdlib exclusions"
|
|
||||||
|
|
||||||
- **MinGW** -- disabled, because its `std::ranges` support is incomplete ([issue #4916](https://github.com/nlohmann/json/issues/4916)).
|
|
||||||
- All toolchains for which [`JSON_HAS_RANGES`](json_has_ranges.md#default-definition) is disabled.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
??? example
|
|
||||||
|
|
||||||
The code below forces the library to disable the conversion from range views:
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
#define JSON_HAS_RANGE_VIEW_CONVERSION 0
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [JSON_HAS_RANGES](json_has_ranges.md) - control `std::ranges` support
|
|
||||||
- [Constructing from a C++20 range view](../../features/conversions.md#putting-values-in) - usage of the feature
|
|
||||||
|
|
||||||
## Version history
|
|
||||||
|
|
||||||
- Added in version 3.13.0.
|
|
||||||
@@ -20,7 +20,7 @@ When the macro is not defined, the library will define it to its default value.
|
|||||||
|
|
||||||
- **GCC 11.1.0** — disabled (the shipped `<ranges>` header has a syntax error; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
- **GCC 11.1.0** — disabled (the shipped `<ranges>` header has a syntax error; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
||||||
- **libstdc++ < 11** — disabled (incomplete C++20 ranges support; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
- **libstdc++ < 11** — disabled (incomplete C++20 ranges support; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
||||||
- **Clang < 16 with libstdc++** — disabled (incomplete ranges support; [issue #5161](https://github.com/nlohmann/json/issues/5161))
|
- **Clang < 16 with libstdc++** — disabled (incomplete ranges support; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
||||||
- **libc++ < 160000** — disabled (incomplete C++20 ranges support; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
- **libc++ < 160000** — disabled (incomplete C++20 ranges support; [issue #4440](https://github.com/nlohmann/json/issues/4440))
|
||||||
- **nvcc (CUDA) 12.0.x and 12.1.x** — disabled (the `enable_borrowed_range` variable-template syntax triggers a parse error
|
- **nvcc (CUDA) 12.0.x and 12.1.x** — disabled (the `enable_borrowed_range` variable-template syntax triggers a parse error
|
||||||
under these two toolkit versions; fixed in CUDA 12.2; [issue #3907](https://github.com/nlohmann/json/issues/3907))
|
under these two toolkit versions; fixed in CUDA 12.2; [issue #3907](https://github.com/nlohmann/json/issues/3907))
|
||||||
@@ -44,12 +44,9 @@ When the macro is not defined, the library will define it to its default value.
|
|||||||
|
|
||||||
- [JSON_HAS_CPP_11 / JSON_HAS_CPP_14 / JSON_HAS_CPP_17 / JSON_HAS_CPP_20 / JSON_HAS_CPP_23 /
|
- [JSON_HAS_CPP_11 / JSON_HAS_CPP_14 / JSON_HAS_CPP_17 / JSON_HAS_CPP_20 / JSON_HAS_CPP_23 /
|
||||||
JSON_HAS_CPP_26](json_has_cpp_11.md) - set supported C++ standard
|
JSON_HAS_CPP_26](json_has_cpp_11.md) - set supported C++ standard
|
||||||
- [JSON_HAS_RANGE_VIEW_CONVERSION](json_has_range_view_conversion.md) - control construction from `std::ranges` views
|
|
||||||
- [JSON_HAS_STD_FORMAT](json_has_std_format.md) - a similar feature-detection macro, for `std::format`/`std::formatter`
|
- [JSON_HAS_STD_FORMAT](json_has_std_format.md) - a similar feature-detection macro, for `std::format`/`std::formatter`
|
||||||
support
|
support
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.0.
|
- Added in version 3.11.0.
|
||||||
- Added the exclusions for libstdc++ < 11, Clang < 16 with libstdc++, libc++ < 16, and nvcc (CUDA) 12.0.x and 12.1.x in
|
|
||||||
version 3.13.0. Before, only GCC 11.1.0 was excluded.
|
|
||||||
@@ -20,10 +20,7 @@ The macro does not affect:
|
|||||||
- The binary readers ([`from_cbor`](../basic_json/from_cbor.md), [`from_msgpack`](../basic_json/from_msgpack.md),
|
- The binary readers ([`from_cbor`](../basic_json/from_cbor.md), [`from_msgpack`](../basic_json/from_msgpack.md),
|
||||||
[`from_ubjson`](../basic_json/from_ubjson.md), [`from_bjdata`](../basic_json/from_bjdata.md),
|
[`from_ubjson`](../basic_json/from_ubjson.md), [`from_bjdata`](../basic_json/from_bjdata.md),
|
||||||
[`from_bson`](../basic_json/from_bson.md)): none of these formats requires a decoder to reject ill-formed UTF-8, so
|
[`from_bson`](../basic_json/from_bson.md)): none of these formats requires a decoder to reject ill-formed UTF-8, so
|
||||||
by default they return the bytes unchanged (`error_handler_t::keep`), independent of this macro. Pass an
|
they always return the bytes unchanged.
|
||||||
`error_handler` argument explicitly to validate or sanitize the strings they read.
|
|
||||||
- [`from_bon8`](../basic_json/from_bon8.md): BON8 always validates, because the UTF-8 lead bytes mark where a string
|
|
||||||
ends.
|
|
||||||
|
|
||||||
## Default definition
|
## Default definition
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ When enabled, comparisons involving at least one discarded JSON value yield resu
|
|||||||
| `>=` | `#!cpp true` |
|
| `>=` | `#!cpp true` |
|
||||||
| `>` | `#!cpp false` |
|
| `>` | `#!cpp false` |
|
||||||
|
|
||||||
Otherwise, comparisons involving at least one discarded JSON value yield `#!cpp false`, except for `!=`, which is the
|
Otherwise, comparisons involving at least one discarded JSON value always yield `#!cpp false`.
|
||||||
negation of `==` and yields `#!cpp true`.
|
|
||||||
|
|
||||||
## Default definition
|
## Default definition
|
||||||
|
|
||||||
|
|||||||
@@ -190,5 +190,3 @@ void to_json(BasicJsonType& j, const B& b) {
|
|||||||
4. Added in version 3.12.0.
|
4. Added in version 3.12.0.
|
||||||
5. Added in version 3.12.0.
|
5. Added in version 3.12.0.
|
||||||
6. Added in version 3.12.0.
|
6. Added in version 3.12.0.
|
||||||
|
|
||||||
All six macros were changed to allow an empty member list in version 3.13.0.
|
|
||||||
@@ -186,6 +186,3 @@ See the examples below for the concrete generated code.
|
|||||||
1. Added in version 3.9.0.
|
1. Added in version 3.9.0.
|
||||||
2. Added in version 3.11.0.
|
2. Added in version 3.11.0.
|
||||||
3. Added in version 3.11.3.
|
3. Added in version 3.11.3.
|
||||||
|
|
||||||
All three macros were changed to work with any `basic_json` specialization (not only `nlohmann::json`) in version 3.12.0,
|
|
||||||
and to allow an empty member list in version 3.13.0.
|
|
||||||
@@ -185,6 +185,3 @@ See the examples below for the concrete generated code.
|
|||||||
1. Added in version 3.9.0.
|
1. Added in version 3.9.0.
|
||||||
2. Added in version 3.11.0.
|
2. Added in version 3.11.0.
|
||||||
3. Added in version 3.11.3.
|
3. Added in version 3.11.3.
|
||||||
|
|
||||||
All three macros were changed to work with any `basic_json` specialization (not only `nlohmann::json`) in version 3.12.0,
|
|
||||||
and to allow an empty member list in version 3.13.0.
|
|
||||||
@@ -38,6 +38,4 @@ the library.
|
|||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.0. Changed inline namespace name in version 3.11.2. Added the ABI tag `_dp` in
|
- Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
|
||||||
version 3.12.0, and the ABI tags `_bics`, `_psp`, `_snul`, `_sbu8`, and `_ekmo` in version 3.13.0; see
|
|
||||||
[`nlohmann` Namespace](../../features/namespace.md#structure).
|
|
||||||
@@ -14,7 +14,7 @@ These macros can be used to open and close the `nlohmann` namespace. See
|
|||||||
## Default definition
|
## Default definition
|
||||||
|
|
||||||
The default definitions open and close the `nlohmann` namespace. The precise definition of
|
The default definitions open and close the `nlohmann` namespace. The precise definition of
|
||||||
`NLOHMANN_JSON_NAMESPACE_BEGIN` varies as described [here](../../features/namespace.md#structure).
|
[`NLOHMANN_JSON_NAMESPACE_BEGIN`] varies as described [here](../../features/namespace.md#structure).
|
||||||
|
|
||||||
1. Default definition of `NLOHMANN_JSON_NAMESPACE_BEGIN`:
|
1. Default definition of `NLOHMANN_JSON_NAMESPACE_BEGIN`:
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 290 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user