mirror of
https://github.com/nlohmann/json.git
synced 2026-10-02 20:50:32 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
671dc345d7 |
+17
@@ -0,0 +1,17 @@
|
|||||||
|
arm_container:
|
||||||
|
image: gcc:latest
|
||||||
|
|
||||||
|
check_task:
|
||||||
|
check_script:
|
||||||
|
# the gcc image ships an outdated CMake, so fetch a recent prebuilt binary
|
||||||
|
# instead of compiling CMake from source
|
||||||
|
- wget -q https://github.com/Kitware/CMake/releases/download/v4.3.4/cmake-4.3.4-linux-aarch64.tar.gz
|
||||||
|
- tar xfz cmake-4.3.4-linux-aarch64.tar.gz
|
||||||
|
- export PATH="$(pwd)/cmake-4.3.4-linux-aarch64/bin:$PATH"
|
||||||
|
- cmake --version
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake .. -DJSON_FastTests=ON
|
||||||
|
- make -j4
|
||||||
|
- cd tests
|
||||||
|
- ctest -j4
|
||||||
+5
-14
@@ -1,15 +1,9 @@
|
|||||||
# bugprone-use-after-move (hicpp-invalid-access-moved is its alias) still flags
|
# TODO: The first three checks are only removed to get the CI going. They have to be addressed at some point.
|
||||||
# the basic_json move constructor, which forwards the whole object to its base
|
# TODO: portability-avoid-pragma-once: should be fixed eventually
|
||||||
# class (#5724), and two forwards in the error-message construction of
|
|
||||||
# at(KeyType&&) (json.hpp, both overloads: find(std::forward<KeyType>(key))
|
|
||||||
# followed by string_t(std::forward<KeyType>(key)) in the throw), which #5689
|
|
||||||
# rewrites. Re-enable both checks once those changes have landed.
|
|
||||||
# portability-avoid-pragma-once: kept disabled on purpose. #pragma once is accepted
|
|
||||||
# by every supported compiler, and tools/amalgamate/amalgamate.py strips it from
|
|
||||||
# single_include, so there is nothing left to fix here.
|
|
||||||
|
|
||||||
Checks: '*,
|
Checks: '*,
|
||||||
|
|
||||||
|
-portability-template-virtual-member-function,
|
||||||
-bugprone-use-after-move,
|
-bugprone-use-after-move,
|
||||||
-hicpp-invalid-access-moved,
|
-hicpp-invalid-access-moved,
|
||||||
|
|
||||||
@@ -43,6 +37,7 @@ Checks: '*,
|
|||||||
-google-readability-function-size,
|
-google-readability-function-size,
|
||||||
-google-runtime-float,
|
-google-runtime-float,
|
||||||
-google-runtime-int,
|
-google-runtime-int,
|
||||||
|
-google-runtime-references,
|
||||||
-hicpp-avoid-goto,
|
-hicpp-avoid-goto,
|
||||||
-hicpp-explicit-conversions,
|
-hicpp-explicit-conversions,
|
||||||
-hicpp-function-size,
|
-hicpp-function-size,
|
||||||
@@ -76,7 +71,6 @@ Checks: '*,
|
|||||||
-readability-magic-numbers,
|
-readability-magic-numbers,
|
||||||
-readability-redundant-access-specifiers,
|
-readability-redundant-access-specifiers,
|
||||||
-readability-redundant-parentheses,
|
-readability-redundant-parentheses,
|
||||||
-readability-redundant-typename,
|
|
||||||
-readability-simplify-boolean-expr,
|
-readability-simplify-boolean-expr,
|
||||||
-readability-uppercase-literal-suffix,
|
-readability-uppercase-literal-suffix,
|
||||||
-readability-use-concise-preprocessor-directives'
|
-readability-use-concise-preprocessor-directives'
|
||||||
@@ -84,11 +78,8 @@ Checks: '*,
|
|||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
|
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
|
||||||
value: 1
|
value: 1
|
||||||
# clang-tidy 22.1 extended this check to classes and enums; the test files
|
|
||||||
# define many such helper types at namespace scope, which is harmless
|
|
||||||
- key: misc-use-internal-linkage.AnalyzeTypes
|
|
||||||
value: false
|
|
||||||
|
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
|
|
||||||
|
#HeaderFilterRegex: '.*nlohmann.*'
|
||||||
HeaderFilterRegex: '.*hpp$'
|
HeaderFilterRegex: '.*hpp$'
|
||||||
|
|||||||
+1
-22
@@ -108,9 +108,7 @@ The tests are located in [`tests/src/unit-*.cpp`](https://github.com/nlohmann/js
|
|||||||
are structured along the features of the library or the nature of the tests. Usually, it should be clear from the
|
are structured along the features of the library or the nature of the tests. Usually, it should be clear from the
|
||||||
context which existing file needs to be extended, and only very few cases require creating new test files.
|
context which existing file needs to be extended, and only very few cases require creating new test files.
|
||||||
|
|
||||||
When fixing a bug, edit `unit-regression3.cpp` and add a section referencing the fixed issue.
|
When fixing a bug, edit `unit-regression2.cpp` and add a section referencing the fixed issue.
|
||||||
`unit-regression2.cpp` holds the older tests; the two files exist because a single one grew large enough for the
|
|
||||||
MinGW linker to fail relocating it, so please keep adding to the smaller file rather than growing the larger one.
|
|
||||||
|
|
||||||
#### Exceptions
|
#### Exceptions
|
||||||
|
|
||||||
@@ -142,16 +140,6 @@ The documentation will then be available at <http://127.0.0.1:8000/>. See the do
|
|||||||
[mkdocs](https://www.mkdocs.org) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for more
|
[mkdocs](https://www.mkdocs.org) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Before opening a pull request, check the documentation like the CI does:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make build -C docs/mkdocs # strict build: fails on broken links, anchors, and structure problems
|
|
||||||
make check_mermaid -C docs/mkdocs # checks the Mermaid diagrams (requires Node.js)
|
|
||||||
```
|
|
||||||
|
|
||||||
A new API page also needs an entry in [`docs/docset/docSet.sql`](https://github.com/nlohmann/json/blob/develop/docs/docset/docSet.sql),
|
|
||||||
the search index of the docset; `make build` reports missing entries.
|
|
||||||
|
|
||||||
### Amalgamate the source code
|
### Amalgamate the source code
|
||||||
|
|
||||||
The single-header files
|
The single-header files
|
||||||
@@ -168,15 +156,6 @@ make amalgamate
|
|||||||
Running `make amalgamate` will also apply automatic formatting to the source files using
|
Running `make amalgamate` will also apply automatic formatting to the source files using
|
||||||
[`Artistic Style`](https://astyle.sourceforge.net/). This formatting may modify your source files in-place. Be certain to review and commit any changes to avoid unintended formatting diffs in commits.
|
[`Artistic Style`](https://astyle.sourceforge.net/). This formatting may modify your source files in-place. Be certain to review and commit any changes to avoid unintended formatting diffs in commits.
|
||||||
|
|
||||||
If you add, rename, or remove a header in `include/nlohmann`, also regenerate the header list in
|
|
||||||
[`BUILD.bazel`](https://github.com/nlohmann/json/blob/develop/BUILD.bazel) (requires CMake) by executing:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make BUILD.bazel
|
|
||||||
```
|
|
||||||
|
|
||||||
The amalgamation check in CI fails if any of these generated files is out of date.
|
|
||||||
|
|
||||||
## Recommended documentation
|
## Recommended documentation
|
||||||
|
|
||||||
- The library’s [README file](https://github.com/nlohmann/json/blob/master/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
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
- [ ] The changes are described in detail, both the what and why.
|
- [ ] The changes are described in detail, both the what and why.
|
||||||
- [ ] If applicable, an [existing issue](https://github.com/nlohmann/json/issues) is referenced.
|
- [ ] If applicable, an [existing issue](https://github.com/nlohmann/json/issues) is referenced.
|
||||||
- [ ] If applicable, a fixed [OSS-Fuzz](https://issues.oss-fuzz.com) issue is referenced as `OSS-Fuzz: <id>` (see [fuzz testing](https://github.com/nlohmann/json/blob/develop/tests/fuzzing.md#handling-oss-fuzz-reports)).
|
|
||||||
- [ ] The [Code coverage](https://coveralls.io/github/nlohmann/json) remained at 100%. A test case for every new line of code.
|
- [ ] The [Code coverage](https://coveralls.io/github/nlohmann/json) remained at 100%. A test case for every new line of code.
|
||||||
- [ ] If applicable, the [documentation](https://json.nlohmann.me) is updated.
|
- [ ] If applicable, the [documentation](https://json.nlohmann.me) is updated.
|
||||||
- [ ] The source code is amalgamated by running `make amalgamate`.
|
- [ ] The source code is amalgamated by running `make amalgamate`.
|
||||||
|
|||||||
+3
-14
@@ -9,23 +9,12 @@ identified a security vulnerability in this repository, please use the GitHub Se
|
|||||||
Until it is published, this draft security advisory will only be visible to the maintainers of this project. Other
|
Until it is published, this draft security advisory will only be visible to the maintainers of this project. Other
|
||||||
users and teams may be added once the advisory is created.
|
users and teams may be added once the advisory is created.
|
||||||
|
|
||||||
We will send a first response within 14 days, indicating the next steps in handling your report. After the initial
|
We will send a response indicating the next steps in handling your report. After the initial reply to your report, we
|
||||||
reply to your report, we will keep you informed of the progress towards a fix and full announcement and may ask for
|
will keep you informed of the progress towards a fix and full announcement and may ask for additional information or
|
||||||
additional information or guidance.
|
guidance.
|
||||||
|
|
||||||
For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.
|
For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.
|
||||||
|
|
||||||
## Disclosure and credit
|
|
||||||
|
|
||||||
Once a fix is released, we publish the security advisory and list the fixed vulnerability in the release notes. We
|
|
||||||
credit the reporter in both, unless they ask not to be named.
|
|
||||||
|
|
||||||
## Supported versions
|
|
||||||
|
|
||||||
Security fixes are made on the `develop` branch and shipped with the next release. Only the latest release receives
|
|
||||||
security fixes; they are not backported to older releases. A release stops receiving security fixes when the next
|
|
||||||
release is published, so please update to the latest release to get them.
|
|
||||||
|
|
||||||
## Unofficial packages
|
## Unofficial packages
|
||||||
|
|
||||||
This project does not publish an official npm package. The npm package
|
This project does not publish an official npm package. The npm package
|
||||||
|
|||||||
@@ -18,27 +18,12 @@ updates:
|
|||||||
cooldown:
|
cooldown:
|
||||||
default-days: 7
|
default-days: 7
|
||||||
|
|
||||||
- package-ecosystem: npm
|
|
||||||
directory: /docs/mkdocs/scripts/mermaid
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
cooldown:
|
|
||||||
default-days: 7
|
|
||||||
ignore:
|
|
||||||
# Material for MkDocs loads mermaid@11; keep the checker on the same major version
|
|
||||||
- dependency-name: mermaid
|
|
||||||
update-types: ["version-update:semver-major"]
|
|
||||||
|
|
||||||
- package-ecosystem: pip
|
- package-ecosystem: pip
|
||||||
directory: /tools/astyle
|
directory: /tools/astyle
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
cooldown:
|
cooldown:
|
||||||
default-days: 7
|
default-days: 7
|
||||||
ignore:
|
|
||||||
# astyle is deliberately pinned (see tools/astyle/requirements.txt): newer versions
|
|
||||||
# reformat the code, and the pinned version defines the formatting CI enforces
|
|
||||||
- dependency-name: astyle
|
|
||||||
|
|
||||||
- package-ecosystem: pip
|
- package-ecosystem: pip
|
||||||
directory: /tools/generate_natvis
|
directory: /tools/generate_natvis
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ environment:
|
|||||||
CMAKE_OPTIONS: ""
|
CMAKE_OPTIONS: ""
|
||||||
GENERATOR: Visual Studio 14 2015
|
GENERATOR: Visual Studio 14 2015
|
||||||
|
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
configuration: Release
|
||||||
|
platform: x86
|
||||||
|
name: with_win_header
|
||||||
|
CXX_FLAGS: "/W4 /WX"
|
||||||
|
CMAKE_OPTIONS: ""
|
||||||
|
GENERATOR: Visual Studio 14 2015
|
||||||
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform: x86
|
platform: x86
|
||||||
@@ -66,6 +74,9 @@ install:
|
|||||||
- if "%platform%"=="x86" set GENERATOR_PLATFORM=Win32
|
- if "%platform%"=="x86" set GENERATOR_PLATFORM=Win32
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
|
# for with_win_header build, inject the inclusion of Windows.h to the single-header library
|
||||||
|
- ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" }
|
||||||
|
- ps: if ($env:name -Eq "with_win_header") { "#include <Windows.h>`n" + (Get-Content $header_path | Out-String) | Set-Content $header_path }
|
||||||
- cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%"
|
- cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%"
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
|||||||
@@ -29,27 +29,6 @@ labels:
|
|||||||
files:
|
files:
|
||||||
- ".github/external_ci/.*"
|
- ".github/external_ci/.*"
|
||||||
|
|
||||||
- label: "CI"
|
|
||||||
files:
|
|
||||||
- ".github/(dependabot|labeler)\\.yml"
|
|
||||||
|
|
||||||
- label: "aspect: binary formats"
|
|
||||||
files:
|
|
||||||
- "include/nlohmann/detail/input/binary_reader\\.hpp"
|
|
||||||
- "include/nlohmann/detail/output/binary_writer\\.hpp"
|
|
||||||
- "tests/src/unit-(bson|cbor|msgpack|ubjson|bjdata|bon8|binary_formats)"
|
|
||||||
- "tests/src/fuzzer-parse_(bson|cbor|msgpack|ubjson|bjdata|bon8)"
|
|
||||||
- "docs/mkdocs/docs/features/binary_formats/"
|
|
||||||
- "docs/mkdocs/docs/(api/basic_json|examples)/(to|from)_(bson|cbor|msgpack|ubjson|bjdata|bon8)"
|
|
||||||
|
|
||||||
- label: "aspect: binary formats"
|
|
||||||
title: "(?i)(bson|cbor|msgpack|messagepack|ubjson|bjdata|bon8|binary format)"
|
|
||||||
|
|
||||||
- label: "python"
|
|
||||||
files:
|
|
||||||
- "\\.py$"
|
|
||||||
- "requirements[^/]*\\.txt$"
|
|
||||||
|
|
||||||
- label: "S"
|
- label: "S"
|
||||||
size-below: 10
|
size-below: 10
|
||||||
- label: "M"
|
- label: "M"
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
name: "Cancel runs of closed pull requests"
|
|
||||||
|
|
||||||
# The concurrency groups of the other workflows cancel superseded runs when a
|
|
||||||
# pull request gets new commits, but nothing stops the runs of its last commit
|
|
||||||
# once the pull request is merged or closed. They then keep the runners busy
|
|
||||||
# for hours while the queue of the open pull requests waits.
|
|
||||||
#
|
|
||||||
# pull_request_target is needed to get a token that can cancel runs for pull
|
|
||||||
# requests from forks. This is safe because the workflow never checks out or
|
|
||||||
# runs code from the pull request; it only calls the API.
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types: [closed]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cancel:
|
|
||||||
permissions:
|
|
||||||
actions: write
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Harden Runner
|
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
|
||||||
with:
|
|
||||||
egress-policy: audit
|
|
||||||
|
|
||||||
- name: Cancel unfinished runs of the pull request's head commit
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GH_REPO: ${{ github.repository }}
|
|
||||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
||||||
SELF: ${{ github.run_id }}
|
|
||||||
# only runs triggered by the pull request: when a branch is pushed to
|
|
||||||
# develop directly, its push runs share the head commit
|
|
||||||
run: |
|
|
||||||
gh api --paginate "repos/$GH_REPO/actions/runs?head_sha=$HEAD_SHA&per_page=100" \
|
|
||||||
--jq ".workflow_runs[]
|
|
||||||
| select(.status != \"completed\" and .id != $SELF)
|
|
||||||
| select(.event == \"pull_request\" or .event == \"pull_request_target\")
|
|
||||||
| \"\(.id) \(.name)\"" |
|
|
||||||
while read -r id name; do
|
|
||||||
echo "Cancelling run $id ($name)"
|
|
||||||
# a run may finish between listing and cancelling; that is not an error
|
|
||||||
gh run cancel "$id" || true
|
|
||||||
done
|
|
||||||
@@ -2,27 +2,16 @@ name: "Check amalgamation"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
# also check develop itself: a PR can be merged before its own run of this
|
|
||||||
# workflow completes (e.g. while it is still queued), leaving single_include
|
|
||||||
# stale on develop without any failing check
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
save:
|
save:
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -42,19 +31,18 @@ jobs:
|
|||||||
MAIN_DIR: ${{ github.workspace }}/main
|
MAIN_DIR: ${{ github.workspace }}/main
|
||||||
INCLUDE_DIR: ${{ github.workspace }}/main/single_include/nlohmann
|
INCLUDE_DIR: ${{ github.workspace }}/main/single_include/nlohmann
|
||||||
TOOL_DIR: ${{ github.workspace }}/tools/tools/amalgamate
|
TOOL_DIR: ${{ github.workspace }}/tools/tools/amalgamate
|
||||||
NATVIS_TOOL_DIR: ${{ github.workspace }}/tools/tools/generate_natvis
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout pull request or pushed commit
|
- name: Checkout pull request
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
path: main
|
path: main
|
||||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Checkout tools
|
- name: Checkout tools
|
||||||
@@ -69,87 +57,18 @@ jobs:
|
|||||||
python3 -mvenv venv
|
python3 -mvenv venv
|
||||||
venv/bin/pip3 install -r $MAIN_DIR/tools/astyle/requirements.txt
|
venv/bin/pip3 install -r $MAIN_DIR/tools/astyle/requirements.txt
|
||||||
|
|
||||||
- name: Install generate_natvis dependencies
|
- name: Regenerate amalgamation and formatting
|
||||||
run: pip3 install -r $NATVIS_TOOL_DIR/requirements.txt
|
|
||||||
|
|
||||||
- name: Regenerate the tools/macro_builder tables in macro_scope.hpp
|
|
||||||
run: |
|
|
||||||
cd $MAIN_DIR
|
|
||||||
|
|
||||||
# Built from this PR's own tools/macro_builder/main.cpp, not a
|
|
||||||
# develop checkout: unlike amalgamate.py and generate_natvis.py,
|
|
||||||
# this tool has no other source of truth to check against (its
|
|
||||||
# own README documents that it must reproduce macro_scope.hpp
|
|
||||||
# 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
|
|
||||||
# that adds support for a new dispatch table until that PR itself
|
|
||||||
# merges to develop, the same way generate_natvis.py's --version
|
|
||||||
# requirement briefly did.
|
|
||||||
TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX)
|
|
||||||
c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder"
|
|
||||||
"$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp"
|
|
||||||
"$TMPDIR/macro_builder" type_body > "$TMPDIR/type_body.hpp"
|
|
||||||
|
|
||||||
# Splice the (still unindented) generated blocks back into
|
|
||||||
# macro_scope.hpp; the astyle pass below indents their
|
|
||||||
# continuation lines the same way it does for the rest of
|
|
||||||
# include/, so a correctly regenerated file comes out unchanged.
|
|
||||||
awk -v newfile="$TMPDIR/paste.hpp" '
|
|
||||||
BEGIN { while ((getline line < newfile) > 0) { new = new line "\n" } }
|
|
||||||
/^#define NLOHMANN_JSON_EXPAND\( x \) x$/ { printf "%s", new; skip=1 }
|
|
||||||
skip && /^#define NLOHMANN_JSON_DOUBLE_PASTE63\(/ { skip=0; next }
|
|
||||||
skip { next }
|
|
||||||
{ print }
|
|
||||||
' include/nlohmann/detail/macro_scope.hpp > "$TMPDIR/macro_scope_1.hpp"
|
|
||||||
awk -v newfile="$TMPDIR/type_body.hpp" '
|
|
||||||
BEGIN { while ((getline line < newfile) > 0) { new = new line "\n" } }
|
|
||||||
/^#define NLOHMANN_JSON_TYPE_BODY\(Prefix, \.\.\.\)/ { printf "%s", new; skip=1 }
|
|
||||||
skip && /^[[:space:]]*NLOHMANN_JSON_TYPE_BODY_SENTINEL\)\)$/ { skip=0; next }
|
|
||||||
skip { next }
|
|
||||||
{ print }
|
|
||||||
' "$TMPDIR/macro_scope_1.hpp" > "$TMPDIR/macro_scope_2.hpp"
|
|
||||||
mv "$TMPDIR/macro_scope_2.hpp" include/nlohmann/detail/macro_scope.hpp
|
|
||||||
rm -rf "$TMPDIR"
|
|
||||||
|
|
||||||
- name: Regenerate amalgamation, formatting, and BUILD.bazel
|
|
||||||
run: |
|
run: |
|
||||||
cd $MAIN_DIR
|
cd $MAIN_DIR
|
||||||
|
|
||||||
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/
|
|
||||||
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
|
||||||
|
|
||||||
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet \
|
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet \
|
||||||
$INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
|
$INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
|
||||||
|
|
||||||
# fail loudly if a directory is renamed or removed: find would only warn
|
|
||||||
# about the missing path and silently drop its files from the check
|
|
||||||
SOURCE_DIRS="docs/mkdocs/docs/examples include tests"
|
|
||||||
for DIR in $SOURCE_DIRS; do
|
|
||||||
if [ ! -d "$DIR" ]; then
|
|
||||||
echo "::error::source directory '$DIR' does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
${{ 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 docs/examples include tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||||
|
|
||||||
- name: Regenerate nlohmann_json.natvis
|
|
||||||
run: |
|
|
||||||
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]\+')
|
|
||||||
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
|
||||||
@@ -158,7 +77,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 is out of date. Diff:"
|
echo "The source code has not been amalgamated/formatted correctly. 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
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
name: Check documentation links
|
|
||||||
|
|
||||||
# check the links of the documentation weekly; external links break without any change in this repository
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '17 4 * * 1'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check_docs_links:
|
|
||||||
if: github.repository == 'nlohmann/json'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- name: Harden Runner
|
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
|
||||||
with:
|
|
||||||
egress-policy: audit
|
|
||||||
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Install virtual environment
|
|
||||||
run: make install_venv -C docs/mkdocs
|
|
||||||
|
|
||||||
- name: Check links
|
|
||||||
shell: bash # adds -o pipefail, so tee does not hide the exit code
|
|
||||||
run: make link_check -C docs/mkdocs 2>&1 | tee link_check.log
|
|
||||||
|
|
||||||
- name: Summarize broken links
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
{
|
|
||||||
echo '### Broken documentation links'
|
|
||||||
echo '```'
|
|
||||||
grep 'invalid url' link_check.log || true
|
|
||||||
echo '```'
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
name: CIFuzz
|
name: CIFuzz
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -13,7 +9,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@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
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@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -38,14 +38,14 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
with:
|
with:
|
||||||
languages: c-cpp
|
languages: c-cpp
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/autobuild@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
comment:
|
comment:
|
||||||
# push runs on develop have no PR to comment on (and no "pr" artifact)
|
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -20,7 +19,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -96,13 +95,13 @@ 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` is out of date.'
|
body: '## 🔴 Amalgamation check failed! 🔴\nThe source code has not been amalgamated and/or formatted correctly.'
|
||||||
+ (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'
|
||||||
+ 'This does not require installing astyle yourself.'
|
+ 'This does not require installing astyle yourself.'
|
||||||
: '')
|
: '')
|
||||||
+ (first ? '\n\n@' + author + ' Please read and follow the [Contribution Guidelines]'
|
+ (first ? '\n\n@' + author + ' Please read and follow the [Contribution Guidelines]'
|
||||||
+ '(https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#amalgamate-the-source-code).'
|
+ '(https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).'
|
||||||
: '')
|
: '')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,10 +9,6 @@
|
|||||||
name: 'Dependency Review'
|
name: 'Dependency Review'
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -21,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
|
|
||||||
name: flawfinder
|
name: flawfinder
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -31,7 +27,7 @@ jobs:
|
|||||||
security-events: write
|
security-events: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -47,6 +43,6 @@ jobs:
|
|||||||
output: 'flawfinder_results.sarif'
|
output: 'flawfinder_results.sarif'
|
||||||
|
|
||||||
- name: Upload analysis results to GitHub Security tab
|
- name: Upload analysis results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/upload-sarif@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
with:
|
with:
|
||||||
sarif_file: ${{github.workspace}}/flawfinder_results.sarif
|
sarif_file: ${{github.workspace}}/flawfinder_results.sarif
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ on:
|
|||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
|
|
||||||
# pull_request_target runs on the base branch, so github.ref would put all pull
|
|
||||||
# requests into one group; group by pull request number instead
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -23,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,7 @@ on:
|
|||||||
- develop
|
- develop
|
||||||
paths:
|
paths:
|
||||||
- docs/mkdocs/**
|
- docs/mkdocs/**
|
||||||
# the site also embeds these files via pymdownx.snippets
|
- docs/examples/**
|
||||||
# (mkdocs.yml sets restrict_base_path: false for this)
|
|
||||||
- .clang-tidy
|
|
||||||
- .github/CODE_OF_CONDUCT.md
|
|
||||||
- .github/CONTRIBUTING.md
|
|
||||||
- .github/SECURITY.md
|
|
||||||
- cmake/clang_flags.cmake
|
|
||||||
- cmake/gcc_flags.cmake
|
|
||||||
- tests/fmt_formatter/project/main.cpp
|
|
||||||
- tools/astyle/.astylerc
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# we don't want to have concurrent jobs, and we don't want to cancel running jobs to avoid broken publications
|
# we don't want to have concurrent jobs, and we don't want to cancel running jobs to avoid broken publications
|
||||||
@@ -33,19 +24,14 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
if: github.repository == 'nlohmann/json'
|
if: github.repository == 'nlohmann/json'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
# the git-revision-date-localized plugin needs the history for correct "last update" dates and so the
|
|
||||||
# strict build does not fail on a shallow clone
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install virtual environment
|
- name: Install virtual environment
|
||||||
run: make install_venv -C docs/mkdocs
|
run: make install_venv -C docs/mkdocs
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: ["develop"]
|
branches: ["develop"]
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -40,7 +36,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -50,7 +46,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: "Run analysis"
|
- name: "Run analysis"
|
||||||
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
|
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||||
with:
|
with:
|
||||||
results_file: results.sarif
|
results_file: results.sarif
|
||||||
results_format: sarif
|
results_format: sarif
|
||||||
@@ -80,6 +76,6 @@ jobs:
|
|||||||
|
|
||||||
# Upload the results to GitHub's code scanning dashboard.
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/upload-sarif@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '23 2 * * 4'
|
- cron: '23 2 * * 4'
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -36,7 +32,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -65,7 +61,7 @@ jobs:
|
|||||||
|
|
||||||
# Upload SARIF file generated in previous step
|
# Upload SARIF file generated in previous step
|
||||||
- name: Upload SARIF file
|
- name: Upload SARIF file
|
||||||
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
uses: github/codeql-action/upload-sarif@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
|
||||||
with:
|
with:
|
||||||
sarif_file: semgrep.sarif
|
sarif_file: semgrep.sarif
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
|
- uses: actions/stale@1e223db275d687790206a7acac4d1a11bd6fe629 # v10.4.0
|
||||||
with:
|
with:
|
||||||
stale-issue-label: 'state: stale'
|
stale-issue-label: 'state: stale'
|
||||||
stale-pr-label: 'state: stale'
|
stale-pr-label: 'state: stale'
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -47,18 +47,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build --target ci_infer
|
run: cmake --build build --target ci_infer
|
||||||
- name: Archive Infer report
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
||||||
with:
|
|
||||||
name: infer-report
|
|
||||||
path: ${{ github.workspace }}/build/build_infer/infer-out/report.txt
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
ci_static_analysis_ubuntu:
|
ci_static_analysis_ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -67,7 +60,7 @@ jobs:
|
|||||||
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]
|
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@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -77,7 +70,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -85,7 +78,7 @@ jobs:
|
|||||||
|
|
||||||
ci_static_analysis_clang:
|
ci_static_analysis_clang:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: silkeh/clang:22
|
container: silkeh/clang:dev
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_test_clang, ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze, ci_single_binaries]
|
target: [ci_test_clang, ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze, ci_single_binaries]
|
||||||
@@ -96,7 +89,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -104,18 +97,18 @@ jobs:
|
|||||||
|
|
||||||
ci_cmake_options:
|
ci_cmake_options:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ubuntu:24.04
|
container: ubuntu:focal
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_cmake_flags, ci_test_diagnostics, ci_test_diagnostic_positions, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls, ci_test_disableenumserialization, ci_test_disabletuplereferenceconversion, ci_test_skiplibraryversioncheck, ci_test_simdutf, ci_test_strict_nul_handling, ci_test_no_thread_local]
|
target: [ci_cmake_flags, ci_test_diagnostics, ci_test_diagnostic_positions, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls]
|
||||||
steps:
|
steps:
|
||||||
- name: Install build-essential
|
- name: Install build-essential
|
||||||
run: apt-get update ; apt-get install -y build-essential unzip wget git
|
run: apt-get update ; apt-get install -y build-essential unzip wget git libssl-dev
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -125,7 +118,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -149,7 +142,7 @@ jobs:
|
|||||||
name: code-coverage-report
|
name: code-coverage-report
|
||||||
path: ${{ github.workspace }}/build/html
|
path: ${{ github.workspace }}/build/html
|
||||||
- name: Publish report to Coveralls
|
- name: Publish report to Coveralls
|
||||||
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
|
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept
|
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept
|
||||||
@@ -170,15 +163,7 @@ jobs:
|
|||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y --no-install-recommends software-properties-common ca-certificates gnupg make git
|
apt-get install -y --no-install-recommends software-properties-common ca-certificates gnupg make git
|
||||||
# add-apt-repository resolves the PPA through the Launchpad API,
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
# which intermittently times out or fails the team lookup (the plain
|
|
||||||
# "deb ..." sources below never hit Launchpad and never flake).
|
|
||||||
# Retry with backoff so a transient Launchpad blip does not fail CI.
|
|
||||||
for attempt in 1 2 3 4 5; do
|
|
||||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test && break
|
|
||||||
echo "::warning::add-apt-repository ppa:ubuntu-toolchain-r/test failed (attempt ${attempt}/5); retrying"
|
|
||||||
sleep $((attempt * 10))
|
|
||||||
done
|
|
||||||
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic main"
|
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic main"
|
||||||
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic universe"
|
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic universe"
|
||||||
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main"
|
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main"
|
||||||
@@ -191,7 +176,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On
|
run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -209,7 +194,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -219,14 +204,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', '21', '22', 'latest']
|
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest']
|
||||||
container: silkeh/clang:${{ matrix.compiler }}
|
container: silkeh/clang:${{ matrix.compiler }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Set env FORCE_STDCPPFS_FLAG 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' }}
|
||||||
@@ -246,7 +231,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -266,7 +251,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build with libc++
|
- name: Build with libc++
|
||||||
@@ -293,7 +278,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -313,7 +298,7 @@ jobs:
|
|||||||
# import-std support. Its opt-in token is CMake-version-specific, so pin
|
# import-std support. Its opt-in token is CMake-version-specific, so pin
|
||||||
# CMake to the version whose token is set in tests/module_cpp20/CMakeLists.txt.
|
# CMake to the version whose token is set in tests/module_cpp20/CMakeLists.txt.
|
||||||
- name: Get pinned CMake and ninja
|
- name: Get pinned CMake and ninja
|
||||||
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
with:
|
with:
|
||||||
cmakeVersion: 4.3.4
|
cmakeVersion: 4.3.4
|
||||||
# Clang: the std library module is provided by libc++ (the image's libstdc++
|
# Clang: the std library module is provided by libc++ (the image's libstdc++
|
||||||
@@ -339,7 +324,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -353,10 +338,8 @@ jobs:
|
|||||||
container: intel/oneapi-hpckit:latest
|
container: intel/oneapi-hpckit:latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -367,10 +350,8 @@ jobs:
|
|||||||
container: nvcr.io/nvidia/nvhpc:25.5-devel-cuda12.9-ubuntu22.04
|
container: nvcr.io/nvidia/nvhpc:25.5-devel-cuda12.9-ubuntu22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -380,7 +361,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -390,7 +371,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -GNinja
|
run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -GNinja
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -400,41 +381,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_test_examples, ci_test_build_documentation, ci_test_documentation_mermaid]
|
target: [ci_test_examples, ci_test_build_documentation]
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
# the git-revision-date-localized plugin needs the history; a shallow clone makes the strict build fail
|
|
||||||
fetch-depth: ${{ matrix.target == 'ci_test_build_documentation' && '0' || '1' }}
|
|
||||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
||||||
if: matrix.target == 'ci_test_documentation_mermaid'
|
|
||||||
with:
|
|
||||||
node-version: 24
|
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build --target ${{ matrix.target }}
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
|
||||||
# Native Linux ARM64 runner with the latest GCC. The ubuntu-24.04-arm label is
|
|
||||||
# only available for public repositories.
|
|
||||||
ci_test_arm64:
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
container: gcc:latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Get latest CMake and ninja
|
|
||||||
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
|
||||||
- name: Check that the job runs natively on arm64
|
|
||||||
run: uname -m && test "$(uname -m)" = aarch64
|
|
||||||
- name: Run CMake
|
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
|
||||||
- name: Build
|
|
||||||
run: cmake --build build --target ci_test_compiler_default
|
|
||||||
|
|||||||
@@ -87,10 +87,8 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
|
||||||
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@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
- name: Set extra CXX_FLAGS for latest std_version
|
- name: Set extra CXX_FLAGS for latest std_version
|
||||||
# /wd5285 silences C5285 emitted by the bundled third-party doctest.h, which
|
# /wd5285 silences C5285 emitted by the bundled third-party doctest.h, which
|
||||||
# specializes std::tuple (newly diagnosed by the VS2026 v145 toolset)
|
# specializes std::tuple (newly diagnosed by the VS2026 v145 toolset)
|
||||||
@@ -125,14 +123,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Run CMake (Release)
|
- name: Run CMake (Release)
|
||||||
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ARM64 -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ARM64 -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Release'
|
if: matrix.build_type == 'Release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- name: Run CMake (Debug)
|
- name: Run CMake (Debug)
|
||||||
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ARM64 -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ARM64 -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Debug'
|
if: matrix.build_type == 'Debug'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -157,20 +153,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
platform: x64
|
platform: x64
|
||||||
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
|
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
|
||||||
# CMAKE_CXX_FLAGS_DEBUG is overridden to drop the default -g: linking
|
|
||||||
# test-regression2_cpp20 intermittently fails with "relocation truncated
|
|
||||||
# to fit: IMAGE_REL_AMD64_SECREL against `.debug_line'" because the
|
|
||||||
# MinGW linker cannot relocate the debug sections this test produces.
|
|
||||||
# The tests are only built and run here, so the debug info is not used.
|
|
||||||
# Do not add -O1 here to shrink the objects further: it does make them
|
|
||||||
# link, but the binaries clang 11.0.1 and clang 18.1.8 then produce crash
|
|
||||||
# before doctest prints its first line - 39 of 102 tests on clang 18.
|
|
||||||
# Keep the objects small by splitting the test files instead.
|
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build ^
|
run: cmake -S . -B build ^
|
||||||
-DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" ^
|
-DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" ^
|
||||||
-DCMAKE_CXX_FLAGS="--target=x86_64-w64-mingw32 -stdlib=libstdc++ -pthread" ^
|
-DCMAKE_CXX_FLAGS="--target=x86_64-w64-mingw32 -stdlib=libstdc++ -pthread" ^
|
||||||
-DCMAKE_CXX_FLAGS_DEBUG="-g0" ^
|
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-lwinpthread" ^
|
-DCMAKE_EXE_LINKER_FLAGS="-lwinpthread" ^
|
||||||
-G"MinGW Makefiles" ^
|
-G"MinGW Makefiles" ^
|
||||||
-DCMAKE_BUILD_TYPE=Debug ^
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
@@ -207,7 +193,7 @@ jobs:
|
|||||||
# import-std support. Its opt-in token is CMake-version-specific, so pin
|
# import-std support. Its opt-in token is CMake-version-specific, so pin
|
||||||
# CMake to the version whose token is set in tests/module_cpp20/CMakeLists.txt.
|
# CMake to the version whose token is set in tests/module_cpp20/CMakeLists.txt.
|
||||||
- name: Get pinned CMake and ninja
|
- name: Get pinned CMake and ninja
|
||||||
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
|
||||||
with:
|
with:
|
||||||
cmakeVersion: 4.3.4
|
cmakeVersion: 4.3.4
|
||||||
- name: Run CMake (Debug)
|
- name: Run CMake (Debug)
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
/docs/docset/docSet.dsidx
|
/docs/docset/docSet.dsidx
|
||||||
/docs/mkdocs/.cache/
|
/docs/mkdocs/.cache/
|
||||||
/docs/mkdocs/docs/__pycache__/
|
/docs/mkdocs/docs/__pycache__/
|
||||||
/docs/mkdocs/hooks/__pycache__/
|
|
||||||
/docs/mkdocs/scripts/mermaid/node_modules/
|
|
||||||
/docs/mkdocs/site/
|
/docs/mkdocs/site/
|
||||||
/docs/mkdocs/venv/
|
/docs/mkdocs/venv/
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"_comment": "Used by the ci_infer CMake target (#5715 item 4b). fail-on-issue makes CI fail on Infer findings; disable-issue-type is a type-level baseline for the ~174 pre-existing findings (all PULSE_UNNECESSARY_COPY*/PULSE_RESOURCE_LEAK/PULSE_CONST_REFABLE, mostly in test code) triaged in run https://github.com/nlohmann/json/actions/runs/35829411620 on commit 1054b2097, so CI fails only on a NEW issue type. Remove an entry here once its findings have been fixed or explicitly accepted.",
|
|
||||||
"fail-on-issue": true,
|
|
||||||
"disable-issue-type": [
|
|
||||||
"PULSE_UNNECESSARY_COPY_ASSIGNMENT",
|
|
||||||
"PULSE_UNNECESSARY_COPY",
|
|
||||||
"PULSE_UNNECESSARY_COPY_INTERMEDIATE",
|
|
||||||
"PULSE_UNNECESSARY_COPY_OPTIONAL",
|
|
||||||
"PULSE_RESOURCE_LEAK",
|
|
||||||
"PULSE_CONST_REFABLE"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -23,6 +23,10 @@ Files: tests/thirdparty/fifo_map/*
|
|||||||
Copyright: 2015-2017 Niels Lohmann
|
Copyright: 2015-2017 Niels Lohmann
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
|
Files: tests/thirdparty/Fuzzer/*
|
||||||
|
Copyright: 2003-2022 LLVM Project.
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
Files: tests/thirdparty/imapdl/*
|
Files: tests/thirdparty/imapdl/*
|
||||||
Copyright: 2017 Georg Sauthoff <mail@gms.tf>
|
Copyright: 2017 Georg Sauthoff <mail@gms.tf>
|
||||||
License: GPL-3.0-only
|
License: GPL-3.0-only
|
||||||
|
|||||||
+1
-7
@@ -21,7 +21,6 @@ cc_library(
|
|||||||
"include/nlohmann/adl_serializer.hpp",
|
"include/nlohmann/adl_serializer.hpp",
|
||||||
"include/nlohmann/byte_container_with_subtype.hpp",
|
"include/nlohmann/byte_container_with_subtype.hpp",
|
||||||
"include/nlohmann/detail/abi_macros.hpp",
|
"include/nlohmann/detail/abi_macros.hpp",
|
||||||
"include/nlohmann/detail/bit_ops.hpp",
|
|
||||||
"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",
|
||||||
@@ -31,11 +30,8 @@ cc_library(
|
|||||||
"include/nlohmann/detail/input/input_adapters.hpp",
|
"include/nlohmann/detail/input/input_adapters.hpp",
|
||||||
"include/nlohmann/detail/input/json_sax.hpp",
|
"include/nlohmann/detail/input/json_sax.hpp",
|
||||||
"include/nlohmann/detail/input/lexer.hpp",
|
"include/nlohmann/detail/input/lexer.hpp",
|
||||||
"include/nlohmann/detail/input/number_parse.hpp",
|
|
||||||
"include/nlohmann/detail/input/parser.hpp",
|
"include/nlohmann/detail/input/parser.hpp",
|
||||||
"include/nlohmann/detail/input/position_t.hpp",
|
"include/nlohmann/detail/input/position_t.hpp",
|
||||||
"include/nlohmann/detail/input/pow5_table.hpp",
|
|
||||||
"include/nlohmann/detail/input/string_scan.hpp",
|
|
||||||
"include/nlohmann/detail/iterators/internal_iterator.hpp",
|
"include/nlohmann/detail/iterators/internal_iterator.hpp",
|
||||||
"include/nlohmann/detail/iterators/iter_impl.hpp",
|
"include/nlohmann/detail/iterators/iter_impl.hpp",
|
||||||
"include/nlohmann/detail/iterators/iteration_proxy.hpp",
|
"include/nlohmann/detail/iterators/iteration_proxy.hpp",
|
||||||
@@ -53,27 +49,25 @@ cc_library(
|
|||||||
"include/nlohmann/detail/meta/detected.hpp",
|
"include/nlohmann/detail/meta/detected.hpp",
|
||||||
"include/nlohmann/detail/meta/identity_tag.hpp",
|
"include/nlohmann/detail/meta/identity_tag.hpp",
|
||||||
"include/nlohmann/detail/meta/is_sax.hpp",
|
"include/nlohmann/detail/meta/is_sax.hpp",
|
||||||
"include/nlohmann/detail/meta/logic.hpp",
|
|
||||||
"include/nlohmann/detail/meta/std_fs.hpp",
|
"include/nlohmann/detail/meta/std_fs.hpp",
|
||||||
"include/nlohmann/detail/meta/type_traits.hpp",
|
"include/nlohmann/detail/meta/type_traits.hpp",
|
||||||
"include/nlohmann/detail/meta/void_t.hpp",
|
"include/nlohmann/detail/meta/void_t.hpp",
|
||||||
"include/nlohmann/detail/output/binary_writer.hpp",
|
"include/nlohmann/detail/output/binary_writer.hpp",
|
||||||
"include/nlohmann/detail/output/output_adapters.hpp",
|
"include/nlohmann/detail/output/output_adapters.hpp",
|
||||||
"include/nlohmann/detail/output/serializer.hpp",
|
"include/nlohmann/detail/output/serializer.hpp",
|
||||||
"include/nlohmann/detail/recursion_depth_limit.hpp",
|
|
||||||
"include/nlohmann/detail/string_concat.hpp",
|
"include/nlohmann/detail/string_concat.hpp",
|
||||||
"include/nlohmann/detail/string_escape.hpp",
|
"include/nlohmann/detail/string_escape.hpp",
|
||||||
"include/nlohmann/detail/string_utils.hpp",
|
"include/nlohmann/detail/string_utils.hpp",
|
||||||
"include/nlohmann/detail/value_t.hpp",
|
"include/nlohmann/detail/value_t.hpp",
|
||||||
"include/nlohmann/json.hpp",
|
"include/nlohmann/json.hpp",
|
||||||
"include/nlohmann/json_fwd.hpp",
|
"include/nlohmann/json_fwd.hpp",
|
||||||
"include/nlohmann/json_literals.hpp",
|
|
||||||
"include/nlohmann/ordered_map.hpp",
|
"include/nlohmann/ordered_map.hpp",
|
||||||
"include/nlohmann/thirdparty/hedley/hedley.hpp",
|
"include/nlohmann/thirdparty/hedley/hedley.hpp",
|
||||||
"include/nlohmann/thirdparty/hedley/hedley_undef.hpp",
|
"include/nlohmann/thirdparty/hedley/hedley_undef.hpp",
|
||||||
],
|
],
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
alwayslink = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
|||||||
@@ -55,12 +55,10 @@ option(JSON_Diagnostic_Positions "Enable diagnostic positions." OFF)
|
|||||||
option(JSON_GlobalUDLs "Place user-defined string literals in the global namespace." ON)
|
option(JSON_GlobalUDLs "Place user-defined string literals in the global namespace." ON)
|
||||||
option(JSON_ImplicitConversions "Enable implicit conversions." ON)
|
option(JSON_ImplicitConversions "Enable implicit conversions." ON)
|
||||||
option(JSON_DisableEnumSerialization "Disable default integer enum serialization." OFF)
|
option(JSON_DisableEnumSerialization "Disable default integer enum serialization." OFF)
|
||||||
option(JSON_DisableTupleReferenceConversion "Disable conversion from a one-element tuple of a JSON reference." OFF)
|
|
||||||
option(JSON_LegacyDiscardedValueComparison "Enable legacy discarded value comparison." OFF)
|
option(JSON_LegacyDiscardedValueComparison "Enable legacy discarded value comparison." OFF)
|
||||||
option(JSON_Install "Install CMake targets during install step." ${MAIN_PROJECT})
|
option(JSON_Install "Install CMake targets during install step." ${MAIN_PROJECT})
|
||||||
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." ON)
|
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." ON)
|
||||||
option(JSON_SystemInclude "Include as system headers (skip for clang-tidy)." OFF)
|
option(JSON_SystemInclude "Include as system headers (skip for clang-tidy)." OFF)
|
||||||
option(JSON_StrictNulHandling "Build with strict NUL-byte handling enabled." OFF)
|
|
||||||
|
|
||||||
if (JSON_CI)
|
if (JSON_CI)
|
||||||
include(ci)
|
include(ci)
|
||||||
@@ -102,10 +100,6 @@ if (JSON_DisableEnumSerialization)
|
|||||||
message(STATUS "Enum integer serialization is disabled (JSON_DISABLE_ENUM_SERIALIZATION=1)")
|
message(STATUS "Enum integer serialization is disabled (JSON_DISABLE_ENUM_SERIALIZATION=1)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_DisableTupleReferenceConversion)
|
|
||||||
message(STATUS "Tuple reference conversion is disabled (JSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (JSON_LegacyDiscardedValueComparison)
|
if (JSON_LegacyDiscardedValueComparison)
|
||||||
message(STATUS "Legacy discarded value comparison enabled (JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1)")
|
message(STATUS "Legacy discarded value comparison enabled (JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1)")
|
||||||
endif()
|
endif()
|
||||||
@@ -114,10 +108,6 @@ if (JSON_Diagnostics)
|
|||||||
message(STATUS "Diagnostics enabled (JSON_DIAGNOSTICS=1)")
|
message(STATUS "Diagnostics enabled (JSON_DIAGNOSTICS=1)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_StrictNulHandling)
|
|
||||||
message(STATUS "Strict NUL-byte handling enabled (JSON_STRICT_NUL_HANDLING=1)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (JSON_Diagnostic_Positions)
|
if (JSON_Diagnostic_Positions)
|
||||||
message(STATUS "Diagnostic positions enabled (JSON_DIAGNOSTIC_POSITIONS=1)")
|
message(STATUS "Diagnostic positions enabled (JSON_DIAGNOSTIC_POSITIONS=1)")
|
||||||
endif()
|
endif()
|
||||||
@@ -148,11 +138,9 @@ target_compile_definitions(
|
|||||||
$<$<NOT:$<BOOL:${JSON_GlobalUDLs}>>:JSON_USE_GLOBAL_UDLS=0>
|
$<$<NOT:$<BOOL:${JSON_GlobalUDLs}>>:JSON_USE_GLOBAL_UDLS=0>
|
||||||
$<$<NOT:$<BOOL:${JSON_ImplicitConversions}>>:JSON_USE_IMPLICIT_CONVERSIONS=0>
|
$<$<NOT:$<BOOL:${JSON_ImplicitConversions}>>:JSON_USE_IMPLICIT_CONVERSIONS=0>
|
||||||
$<$<BOOL:${JSON_DisableEnumSerialization}>:JSON_DISABLE_ENUM_SERIALIZATION=1>
|
$<$<BOOL:${JSON_DisableEnumSerialization}>:JSON_DISABLE_ENUM_SERIALIZATION=1>
|
||||||
$<$<BOOL:${JSON_DisableTupleReferenceConversion}>:JSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1>
|
|
||||||
$<$<BOOL:${JSON_Diagnostics}>:JSON_DIAGNOSTICS=1>
|
$<$<BOOL:${JSON_Diagnostics}>:JSON_DIAGNOSTICS=1>
|
||||||
$<$<BOOL:${JSON_Diagnostic_Positions}>:JSON_DIAGNOSTIC_POSITIONS=1>
|
$<$<BOOL:${JSON_Diagnostic_Positions}>:JSON_DIAGNOSTIC_POSITIONS=1>
|
||||||
$<$<BOOL:${JSON_LegacyDiscardedValueComparison}>:JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1>
|
$<$<BOOL:${JSON_LegacyDiscardedValueComparison}>:JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1>
|
||||||
$<$<BOOL:${JSON_StrictNulHandling}>:JSON_STRICT_NUL_HANDLING=1>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ Further documentation:
|
|||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> The folder `.github/workflows` is predetermined by GitHub.
|
> The folder `.github/workflows` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.cirrus.yml`
|
||||||
|
|
||||||
|
Configuration file for the pipeline at [Cirrus CI](https://cirrus-ci.com/github/nlohmann/json).
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Writing tasks](https://cirrus-ci.org/guide/writing-tasks/)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.cirrus.yml` and position (root of the repository) are predetermined by Cirrus CI.
|
||||||
|
|
||||||
### `.github/external_ci/appveyor.yml`
|
### `.github/external_ci/appveyor.yml`
|
||||||
|
|
||||||
Configuration for the pipelines at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json).
|
Configuration for the pipelines at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json).
|
||||||
@@ -239,16 +250,12 @@ Further documentation:
|
|||||||
|
|
||||||
### `BUILD.bazel`
|
### `BUILD.bazel`
|
||||||
|
|
||||||
The build definition for [Bazel](https://bazel.build). The file is generated by
|
The file can be updated by calling
|
||||||
`cmake/scripts/gen_bazel_build_file.cmake`, which derives the header list from the files in `include`; change the
|
|
||||||
script rather than editing the file by hand. The file can be updated by calling
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
make BUILD.bazel
|
make BUILD.bazel
|
||||||
```
|
```
|
||||||
|
|
||||||
The "Check amalgamation" workflow fails if the file is out of date.
|
|
||||||
|
|
||||||
### `meson.build`
|
### `meson.build`
|
||||||
|
|
||||||
The build definition for the [Meson](https://mesonbuild.com) build system.
|
The build definition for the [Meson](https://mesonbuild.com) build system.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: pretty clean ChangeLog.md release update_hedley update_hedley_undef BUILD.bazel natvis macro_builder_check
|
.PHONY: pretty clean ChangeLog.md release
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# configuration
|
# configuration
|
||||||
@@ -21,11 +21,6 @@ TESTS_SRCS=$(shell find tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name
|
|||||||
# the single headers (amalgamated from the source files)
|
# the single headers (amalgamated from the source files)
|
||||||
AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
||||||
AMALGAMATED_FWD_FILE=single_include/nlohmann/json_fwd.hpp
|
AMALGAMATED_FWD_FILE=single_include/nlohmann/json_fwd.hpp
|
||||||
# json_literals.hpp only includes <nlohmann/json.hpp>, so it is copied verbatim
|
|
||||||
AMALGAMATED_LITERALS_FILE=single_include/nlohmann/json_literals.hpp
|
|
||||||
|
|
||||||
# the header with the argument-counting macros generated by tools/macro_builder
|
|
||||||
MACRO_SCOPE_HPP=include/nlohmann/detail/macro_scope.hpp
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@@ -34,18 +29,18 @@ MACRO_SCOPE_HPP=include/nlohmann/detail/macro_scope.hpp
|
|||||||
|
|
||||||
# main target
|
# main target
|
||||||
all:
|
all:
|
||||||
@echo "amalgamate - amalgamate files single_include/nlohmann/json{,_fwd,_literals}.hpp from the include/nlohmann sources"
|
@echo "amalgamate - amalgamate files single_include/nlohmann/json{,_fwd}.hpp 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"
|
||||||
@echo "clean - remove built files"
|
@echo "clean - remove built files"
|
||||||
@echo "fuzzing - see tests/fuzzing.md for how to build and run the fuzzers"
|
@echo "doctest - compile example files and check their output"
|
||||||
@echo "macro_builder_check - check that macro_scope.hpp matches tools/macro_builder's output"
|
@echo "fuzz_testing - prepare fuzz testing of the JSON parser"
|
||||||
@echo "natvis - regenerate nlohmann_json.natvis from the current ABI tags and version"
|
@echo "fuzz_testing_bson - prepare fuzz testing of the BSON parser"
|
||||||
|
@echo "fuzz_testing_cbor - prepare fuzz testing of the CBOR parser"
|
||||||
|
@echo "fuzz_testing_msgpack - prepare fuzz testing of the MessagePack parser"
|
||||||
|
@echo "fuzz_testing_ubjson - prepare fuzz testing of the UBJSON parser"
|
||||||
@echo "pretty - beautify code with Artistic Style"
|
@echo "pretty - beautify code with Artistic Style"
|
||||||
@echo "run_benchmarks - build and run benchmarks"
|
@echo "run_benchmarks - build and run benchmarks"
|
||||||
@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"
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@@ -60,6 +55,66 @@ run_benchmarks:
|
|||||||
cd cmake-build-benchmarks ; ./json_benchmarks
|
cd cmake-build-benchmarks ; ./json_benchmarks
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# fuzzing
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
# the overall fuzz testing target
|
||||||
|
fuzz_testing:
|
||||||
|
rm -fr fuzz-testing
|
||||||
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
|
$(MAKE) parse_afl_fuzzer -C tests CXX=afl-clang++
|
||||||
|
mv tests/parse_afl_fuzzer fuzz-testing/fuzzer
|
||||||
|
find tests/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
|
fuzz_testing_bson:
|
||||||
|
rm -fr fuzz-testing
|
||||||
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
|
$(MAKE) parse_bson_fuzzer -C tests CXX=afl-clang++
|
||||||
|
mv tests/parse_bson_fuzzer fuzz-testing/fuzzer
|
||||||
|
find tests/data -size -5k -name *.bson | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
|
fuzz_testing_cbor:
|
||||||
|
rm -fr fuzz-testing
|
||||||
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
|
$(MAKE) parse_cbor_fuzzer -C tests CXX=afl-clang++
|
||||||
|
mv tests/parse_cbor_fuzzer fuzz-testing/fuzzer
|
||||||
|
find tests/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
|
fuzz_testing_msgpack:
|
||||||
|
rm -fr fuzz-testing
|
||||||
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
|
$(MAKE) parse_msgpack_fuzzer -C tests CXX=afl-clang++
|
||||||
|
mv tests/parse_msgpack_fuzzer fuzz-testing/fuzzer
|
||||||
|
find tests/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
|
fuzz_testing_ubjson:
|
||||||
|
rm -fr fuzz-testing
|
||||||
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
|
$(MAKE) parse_ubjson_fuzzer -C tests CXX=afl-clang++
|
||||||
|
mv tests/parse_ubjson_fuzzer fuzz-testing/fuzzer
|
||||||
|
find tests/data -size -5k -name *.ubjson | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
|
fuzzing-start:
|
||||||
|
afl-fuzz -S fuzzer1 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer2 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer3 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer4 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer5 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer6 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -S fuzzer7 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
||||||
|
afl-fuzz -M fuzzer0 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer
|
||||||
|
|
||||||
|
fuzzing-stop:
|
||||||
|
-killall fuzzer
|
||||||
|
-killall afl-fuzz
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Static analysis
|
# Static analysis
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@@ -87,10 +142,14 @@ install_astyle:
|
|||||||
|
|
||||||
# call the Artistic Style pretty printer on all source files
|
# call the Artistic Style pretty printer on all source files
|
||||||
pretty: install_astyle
|
pretty: install_astyle
|
||||||
$(ASTYLE) --project=tools/astyle/.astylerc $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE) docs/mkdocs/docs/examples/*.cpp docs/mkdocs/docs/examples/*.hpp
|
$(ASTYLE) --project=tools/astyle/.astylerc $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/mkdocs/docs/examples/*.cpp
|
||||||
|
|
||||||
|
# call the Clang-Format on all source files
|
||||||
|
pretty_format:
|
||||||
|
for FILE in $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/mkdocs/docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
||||||
|
|
||||||
# create single header files and pretty print
|
# create single header files and pretty print
|
||||||
amalgamate: $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE)
|
amalgamate: $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE)
|
||||||
$(MAKE) pretty
|
$(MAKE) pretty
|
||||||
|
|
||||||
# call the amalgamation tool for json.hpp
|
# call the amalgamation tool for json.hpp
|
||||||
@@ -101,53 +160,18 @@ $(AMALGAMATED_FILE): $(SRCS)
|
|||||||
$(AMALGAMATED_FWD_FILE): $(SRCS)
|
$(AMALGAMATED_FWD_FILE): $(SRCS)
|
||||||
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json_fwd.json -s . --verbose=yes
|
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json_fwd.json -s . --verbose=yes
|
||||||
|
|
||||||
# copy json_literals.hpp
|
|
||||||
$(AMALGAMATED_LITERALS_FILE): include/nlohmann/json_literals.hpp
|
|
||||||
cp include/nlohmann/json_literals.hpp $(AMALGAMATED_LITERALS_FILE)
|
|
||||||
|
|
||||||
# regenerate nlohmann_json.natvis from the ABI tags and version in include/nlohmann/detail/abi_macros.hpp
|
|
||||||
natvis:
|
|
||||||
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
|
|
||||||
# checked-in header; phony, because it never writes $(MACRO_SCOPE_HPP) itself
|
|
||||||
macro_builder_check:
|
|
||||||
@set -e; \
|
|
||||||
TMPDIR=$$(mktemp -d ./macro_builder_check.XXXXXX); \
|
|
||||||
trap 'rm -rf "$$TMPDIR"' EXIT; \
|
|
||||||
$(CXX) -std=c++11 tools/macro_builder/main.cpp -o "$$TMPDIR/macro_builder"; \
|
|
||||||
"$$TMPDIR/macro_builder" > "$$TMPDIR/paste.hpp"; \
|
|
||||||
"$$TMPDIR/macro_builder" type_body > "$$TMPDIR/type_body.hpp"; \
|
|
||||||
$(ASTYLE) --project=tools/astyle/.astylerc --suffix=none --quiet "$$TMPDIR/paste.hpp" "$$TMPDIR/type_body.hpp"; \
|
|
||||||
sed -n '/^#define NLOHMANN_JSON_EXPAND( x ) x$$/,/^#define NLOHMANN_JSON_DOUBLE_PASTE63(/p' $(MACRO_SCOPE_HPP) > "$$TMPDIR/paste_actual.hpp"; \
|
|
||||||
sed -n '/^#define NLOHMANN_JSON_TYPE_BODY(Prefix, \.\.\.)/,/^ NLOHMANN_JSON_TYPE_BODY_SENTINEL))$$/p' $(MACRO_SCOPE_HPP) > "$$TMPDIR/type_body_actual.hpp"; \
|
|
||||||
diff "$$TMPDIR/paste.hpp" "$$TMPDIR/paste_actual.hpp" || (echo "===================================================================\n $(MACRO_SCOPE_HPP) (NLOHMANN_JSON_EXPAND..NLOHMANN_JSON_DOUBLE_PASTE63) is out of date!\n Regenerate it, see tools/macro_builder/README.md.\n===================================================================" ; exit 1); \
|
|
||||||
diff "$$TMPDIR/type_body.hpp" "$$TMPDIR/type_body_actual.hpp" || (echo "===================================================================\n $(MACRO_SCOPE_HPP) (NLOHMANN_JSON_TYPE_BODY) is out of date!\n Regenerate it, see tools/macro_builder/README.md.\n===================================================================" ; exit 1)
|
|
||||||
|
|
||||||
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
||||||
|
# Note: this target is called by Travis
|
||||||
check-amalgamation:
|
check-amalgamation:
|
||||||
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
||||||
@mv $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~
|
@mv $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~
|
||||||
@mv $(AMALGAMATED_LITERALS_FILE) $(AMALGAMATED_LITERALS_FILE)~
|
|
||||||
@$(MAKE) amalgamate
|
@$(MAKE) amalgamate
|
||||||
@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)
|
@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)
|
||||||
@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)
|
@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)
|
||||||
@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)
|
|
||||||
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
||||||
@mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE)
|
@mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE)
|
||||||
@mv $(AMALGAMATED_LITERALS_FILE)~ $(AMALGAMATED_LITERALS_FILE)
|
|
||||||
@mv BUILD.bazel BUILD.bazel~
|
|
||||||
@$(MAKE) BUILD.bazel
|
|
||||||
@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)
|
|
||||||
@mv BUILD.bazel~ BUILD.bazel
|
|
||||||
@mv nlohmann_json.natvis nlohmann_json.natvis~
|
|
||||||
@$(MAKE) natvis
|
|
||||||
@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)
|
|
||||||
@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
|
BUILD.bazel: $(SRCS)
|
||||||
BUILD.bazel:
|
|
||||||
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@@ -181,7 +205,7 @@ json.tar.xz:
|
|||||||
# We use `-X` to make the resulting ZIP file reproducible, see
|
# We use `-X` to make the resulting ZIP file reproducible, see
|
||||||
# <https://content.pivotal.io/blog/barriers-to-deterministic-reproducible-zip-files>.
|
# <https://content.pivotal.io/blog/barriers-to-deterministic-reproducible-zip-files>.
|
||||||
include.zip: BUILD.bazel
|
include.zip: BUILD.bazel
|
||||||
zip -9 --recurse-paths -X include.zip $(SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_LITERALS_FILE) BUILD.bazel MODULE.bazel meson.build LICENSE.MIT
|
zip -9 --recurse-paths -X include.zip $(SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) BUILD.bazel MODULE.bazel meson.build LICENSE.MIT
|
||||||
|
|
||||||
# Create the files for a release and add signatures and hashes.
|
# Create the files for a release and add signatures and hashes.
|
||||||
release: include.zip json.tar.xz
|
release: include.zip json.tar.xz
|
||||||
@@ -190,13 +214,11 @@ release: include.zip json.tar.xz
|
|||||||
gpg --armor --detach-sig include.zip
|
gpg --armor --detach-sig include.zip
|
||||||
gpg --armor --detach-sig $(AMALGAMATED_FILE)
|
gpg --armor --detach-sig $(AMALGAMATED_FILE)
|
||||||
gpg --armor --detach-sig $(AMALGAMATED_FWD_FILE)
|
gpg --armor --detach-sig $(AMALGAMATED_FWD_FILE)
|
||||||
gpg --armor --detach-sig $(AMALGAMATED_LITERALS_FILE)
|
|
||||||
gpg --armor --detach-sig json.tar.xz
|
gpg --armor --detach-sig json.tar.xz
|
||||||
cp $(AMALGAMATED_FILE) release_files
|
cp $(AMALGAMATED_FILE) release_files
|
||||||
cp $(AMALGAMATED_FWD_FILE) release_files
|
cp $(AMALGAMATED_FWD_FILE) release_files
|
||||||
cp $(AMALGAMATED_LITERALS_FILE) release_files
|
mv $(AMALGAMATED_FILE).asc $(AMALGAMATED_FWD_FILE).asc json.tar.xz json.tar.xz.asc include.zip include.zip.asc release_files
|
||||||
mv $(AMALGAMATED_FILE).asc $(AMALGAMATED_FWD_FILE).asc $(AMALGAMATED_LITERALS_FILE).asc json.tar.xz json.tar.xz.asc include.zip include.zip.asc release_files
|
cd release_files ; shasum -a 256 json.hpp include.zip json.tar.xz > hashes.txt
|
||||||
cd release_files ; shasum -a 256 $$(find . -type f -not -name '*.asc' | sed 's|^\./||' | sort) > hashes.txt
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@@ -206,6 +228,7 @@ release: include.zip json.tar.xz
|
|||||||
# clean up
|
# clean up
|
||||||
clean:
|
clean:
|
||||||
rm -fr fuzz fuzz-testing *.dSYM tests/*.dSYM
|
rm -fr fuzz fuzz-testing *.dSYM tests/*.dSYM
|
||||||
|
rm -fr benchmarks/files/numbers/*.json
|
||||||
rm -fr cmake-build-benchmarks fuzz-testing 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
|
||||||
|
|
||||||
@@ -218,24 +241,11 @@ update_hedley:
|
|||||||
rm -f include/nlohmann/thirdparty/hedley/hedley.hpp include/nlohmann/thirdparty/hedley/hedley_undef.hpp
|
rm -f include/nlohmann/thirdparty/hedley/hedley.hpp include/nlohmann/thirdparty/hedley/hedley_undef.hpp
|
||||||
curl https://raw.githubusercontent.com/nemequ/hedley/master/hedley.h -o include/nlohmann/thirdparty/hedley/hedley.hpp
|
curl https://raw.githubusercontent.com/nemequ/hedley/master/hedley.h -o include/nlohmann/thirdparty/hedley/hedley.hpp
|
||||||
$(SED) -i 's/HEDLEY_/JSON_HEDLEY_/g' include/nlohmann/thirdparty/hedley/hedley.hpp
|
$(SED) -i 's/HEDLEY_/JSON_HEDLEY_/g' include/nlohmann/thirdparty/hedley/hedley.hpp
|
||||||
|
grep "[[:blank:]]*#[[:blank:]]*undef" include/nlohmann/thirdparty/hedley/hedley.hpp | grep -v "__" | sort | uniq | $(SED) 's/ //g' | $(SED) 's/undef/undef /g' > include/nlohmann/thirdparty/hedley/hedley_undef.hpp
|
||||||
$(SED) -i '1s/^/#pragma once\n\n/' include/nlohmann/thirdparty/hedley/hedley.hpp
|
$(SED) -i '1s/^/#pragma once\n\n/' include/nlohmann/thirdparty/hedley/hedley.hpp
|
||||||
$(MAKE) update_hedley_undef
|
$(SED) -i '1s/^/#pragma once\n\n/' include/nlohmann/thirdparty/hedley/hedley_undef.hpp
|
||||||
$(MAKE) amalgamate
|
$(MAKE) amalgamate
|
||||||
|
|
||||||
# Rebuild hedley_undef.hpp from every JSON_HEDLEY_* name that hedley.hpp
|
|
||||||
# #defines. Hedley does not #undef all of its public macros internally (see
|
|
||||||
# #5408), so grepping those #undef lines misses names such as
|
|
||||||
# JSON_HEDLEY_PRAGMA. cmake/scripts/gen_hedley_undef_check.cmake is the
|
|
||||||
# single source of truth for this extraction (tests/CMakeLists.txt uses the
|
|
||||||
# same script, in MODE=checks, to generate the matching leak-check test), so
|
|
||||||
# the vendored header, the generated #undef list, and the regression test
|
|
||||||
# cannot drift apart.
|
|
||||||
update_hedley_undef:
|
|
||||||
cmake -DHEDLEY_HPP=include/nlohmann/thirdparty/hedley/hedley.hpp \
|
|
||||||
-DOUTPUT=include/nlohmann/thirdparty/hedley/hedley_undef.hpp \
|
|
||||||
-DMODE=undef \
|
|
||||||
-P cmake/scripts/gen_hedley_undef_check.cmake
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# serve_header.py
|
# serve_header.py
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|||||||
@@ -7,15 +7,17 @@
|
|||||||
[](https://coveralls.io/github/nlohmann/json?branch=develop)
|
[](https://coveralls.io/github/nlohmann/json?branch=develop)
|
||||||
[](https://scan.coverity.com/projects/nlohmann-json)
|
[](https://scan.coverity.com/projects/nlohmann-json)
|
||||||
[](https://app.codacy.com/gh/nlohmann/json/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
[](https://app.codacy.com/gh/nlohmann/json/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
||||||
|
[](https://cirrus-ci.com/github/nlohmann/json)
|
||||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
|
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
|
||||||
[](https://wandbox.org/permlink/1mp10JbaANo6FUc7)
|
[](https://wandbox.org/permlink/1mp10JbaANo6FUc7)
|
||||||
[](https://json.nlohmann.me)
|
[](https://json.nlohmann.me)
|
||||||
[](https://raw.githubusercontent.com/nlohmann/json/develop/LICENSE.MIT)
|
[](https://raw.githubusercontent.com/nlohmann/json/develop/LICENSE.MIT)
|
||||||
[](https://github.com/nlohmann/json/releases)
|
[](https://github.com/nlohmann/json/releases)
|
||||||
|
[](https://repology.org/project/nlohmann-json/versions)
|
||||||
[](https://github.com/nlohmann/json/releases)
|
[](https://github.com/nlohmann/json/releases)
|
||||||
[](https://github.com/nlohmann/json/issues)
|
[](https://github.com/nlohmann/json/issues)
|
||||||
[](https://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
|
[](https://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
|
||||||
[](https://www.bestpractices.dev/projects/289)
|
[](https://bestpractices.coreinfrastructure.org/projects/289)
|
||||||
[](https://scorecard.dev/viewer/?uri=github.com/nlohmann/json)
|
[](https://scorecard.dev/viewer/?uri=github.com/nlohmann/json)
|
||||||
[](https://cloudback.it)
|
[](https://cloudback.it)
|
||||||
[](https://github.com/sponsors/nlohmann)
|
[](https://github.com/sponsors/nlohmann)
|
||||||
@@ -38,9 +40,8 @@
|
|||||||
- [Implicit conversions](#implicit-conversions)
|
- [Implicit conversions](#implicit-conversions)
|
||||||
- [Conversions to/from arbitrary types](#arbitrary-types-conversions)
|
- [Conversions to/from arbitrary types](#arbitrary-types-conversions)
|
||||||
- [Specializing enum conversion](#specializing-enum-conversion)
|
- [Specializing enum conversion](#specializing-enum-conversion)
|
||||||
- [Binary formats (BSON, CBOR, MessagePack, UBJSON, BJData, and BON8)](#binary-formats-bson-cbor-messagepack-ubjson-bjdata-and-bon8)
|
- [Binary formats (BSON, CBOR, MessagePack, UBJSON, and BJData)](#binary-formats-bson-cbor-messagepack-ubjson-and-bjdata)
|
||||||
- [Customers](#customers)
|
- [Customers](#customers)
|
||||||
- [Ecosystem](#ecosystem)
|
|
||||||
- [Supported compilers](#supported-compilers)
|
- [Supported compilers](#supported-compilers)
|
||||||
- [Integration](#integration)
|
- [Integration](#integration)
|
||||||
- [CMake](#cmake)
|
- [CMake](#cmake)
|
||||||
@@ -61,7 +62,7 @@ There are myriads of [JSON](https://json.org) libraries out there, and each may
|
|||||||
|
|
||||||
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. The library is also included in all popular [package managers](https://json.nlohmann.me/integration/package_managers/).
|
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. The library is also included in all popular [package managers](https://json.nlohmann.me/integration/package_managers/).
|
||||||
|
|
||||||
- **Serious testing**. Our code is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/tests/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [OpenSSF Best Practices](https://www.bestpractices.dev/projects/289). See the [quality assurance](https://json.nlohmann.me/community/quality_assurance) overview documentation.
|
- **Serious testing**. Our code is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/tests/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289). See the [quality assurance](https://json.nlohmann.me/community/quality_assurance) overview documentation.
|
||||||
|
|
||||||
Other aspects were not so important to us:
|
Other aspects were not so important to us:
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nl
|
|||||||
- [Steve Sperandeo](https://github.com/homer6)
|
- [Steve Sperandeo](https://github.com/homer6)
|
||||||
- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe)
|
- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe)
|
||||||
- [Steve Wagner](https://github.com/ciroque)
|
- [Steve Wagner](https://github.com/ciroque)
|
||||||
|
- [Lion Yang](https://github.com/LionNatsu)
|
||||||
|
|
||||||
### Further support
|
### Further support
|
||||||
|
|
||||||
@@ -126,7 +128,7 @@ There is also a [**docset**](https://github.com/Kapeli/Dash-User-Contributions/t
|
|||||||
- **JSON Pointer functions**: [flatten](https://json.nlohmann.me/api/basic_json/flatten), [unflatten](https://json.nlohmann.me/api/basic_json/unflatten)
|
- **JSON Pointer functions**: [flatten](https://json.nlohmann.me/api/basic_json/flatten), [unflatten](https://json.nlohmann.me/api/basic_json/unflatten)
|
||||||
- **JSON Patch functions**: [patch](https://json.nlohmann.me/api/basic_json/patch), [patch_inplace](https://json.nlohmann.me/api/basic_json/patch_inplace), [diff](https://json.nlohmann.me/api/basic_json/diff), [merge_patch](https://json.nlohmann.me/api/basic_json/merge_patch)
|
- **JSON Patch functions**: [patch](https://json.nlohmann.me/api/basic_json/patch), [patch_inplace](https://json.nlohmann.me/api/basic_json/patch_inplace), [diff](https://json.nlohmann.me/api/basic_json/diff), [merge_patch](https://json.nlohmann.me/api/basic_json/merge_patch)
|
||||||
- **Static functions**: [meta](https://json.nlohmann.me/api/basic_json/meta), [get_allocator](https://json.nlohmann.me/api/basic_json/get_allocator)
|
- **Static functions**: [meta](https://json.nlohmann.me/api/basic_json/meta), [get_allocator](https://json.nlohmann.me/api/basic_json/get_allocator)
|
||||||
- **Binary formats**: [from_bjdata](https://json.nlohmann.me/api/basic_json/from_bjdata), [from_bon8](https://json.nlohmann.me/api/basic_json/from_bon8), [from_bson](https://json.nlohmann.me/api/basic_json/from_bson), [from_cbor](https://json.nlohmann.me/api/basic_json/from_cbor), [from_msgpack](https://json.nlohmann.me/api/basic_json/from_msgpack), [from_ubjson](https://json.nlohmann.me/api/basic_json/from_ubjson), [to_bjdata](https://json.nlohmann.me/api/basic_json/to_bjdata), [to_bon8](https://json.nlohmann.me/api/basic_json/to_bon8), [to_bson](https://json.nlohmann.me/api/basic_json/to_bson), [to_cbor](https://json.nlohmann.me/api/basic_json/to_cbor), [to_msgpack](https://json.nlohmann.me/api/basic_json/to_msgpack), [to_ubjson](https://json.nlohmann.me/api/basic_json/to_ubjson)
|
- **Binary formats**: [from_bjdata](https://json.nlohmann.me/api/basic_json/from_bjdata), [from_bson](https://json.nlohmann.me/api/basic_json/from_bson), [from_cbor](https://json.nlohmann.me/api/basic_json/from_cbor), [from_msgpack](https://json.nlohmann.me/api/basic_json/from_msgpack), [from_ubjson](https://json.nlohmann.me/api/basic_json/from_ubjson), [to_bjdata](https://json.nlohmann.me/api/basic_json/to_bjdata), [to_bson](https://json.nlohmann.me/api/basic_json/to_bson), [to_cbor](https://json.nlohmann.me/api/basic_json/to_cbor), [to_msgpack](https://json.nlohmann.me/api/basic_json/to_msgpack), [to_ubjson](https://json.nlohmann.me/api/basic_json/to_ubjson)
|
||||||
- **Non-member functions**: [operator<<](https://json.nlohmann.me/api/operator_ltlt/), [operator>>](https://json.nlohmann.me/api/operator_gtgt/), [to_string](https://json.nlohmann.me/api/basic_json/to_string)
|
- **Non-member functions**: [operator<<](https://json.nlohmann.me/api/operator_ltlt/), [operator>>](https://json.nlohmann.me/api/operator_gtgt/), [to_string](https://json.nlohmann.me/api/basic_json/to_string)
|
||||||
- **Literals**: [operator""_json](https://json.nlohmann.me/api/operator_literal_json)
|
- **Literals**: [operator""_json](https://json.nlohmann.me/api/operator_literal_json)
|
||||||
- **Helper classes**: [std::hash<basic_json>](https://json.nlohmann.me/api/basic_json/std_hash), [std::swap<basic_json>](https://json.nlohmann.me/api/basic_json/std_swap)
|
- **Helper classes**: [std::hash<basic_json>](https://json.nlohmann.me/api/basic_json/std_hash), [std::swap<basic_json>](https://json.nlohmann.me/api/basic_json/std_swap)
|
||||||
@@ -1108,9 +1110,9 @@ Other Important points:
|
|||||||
- When using `get<ENUM_TYPE>()`, undefined JSON values will default to the first pair specified in your map. Select this default pair carefully. If you desire an exception in this circumstance use `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT()` which behaves identically except for throwing an exception on unrecognized values.
|
- When using `get<ENUM_TYPE>()`, undefined JSON values will default to the first pair specified in your map. Select this default pair carefully. If you desire an exception in this circumstance use `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT()` which behaves identically except for throwing an exception on unrecognized values.
|
||||||
- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON.
|
- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON.
|
||||||
|
|
||||||
### Binary formats (BSON, CBOR, MessagePack, UBJSON, BJData, and BON8)
|
### Binary formats (BSON, CBOR, MessagePack, UBJSON, and BJData)
|
||||||
|
|
||||||
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](https://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), [UBJSON](https://ubjson.org) (Universal Binary JSON Specification), [BJData](https://neurojson.org/bjdata) (Binary JData), and [BON8](https://github.com/hikoworks/hikogui/blob/main/docs/BON8.md) (Binary Object Notation 8) to efficiently encode JSON values to byte vectors and to decode such vectors.
|
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](https://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), [UBJSON](https://ubjson.org) (Universal Binary JSON Specification) and [BJData](https://neurojson.org/bjdata) (Binary JData) to efficiently encode JSON values to byte vectors and to decode such vectors.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// create a JSON value
|
// create a JSON value
|
||||||
@@ -1147,14 +1149,6 @@ std::vector<std::uint8_t> v_ubjson = json::to_ubjson(j);
|
|||||||
|
|
||||||
// roundtrip
|
// roundtrip
|
||||||
json j_from_ubjson = json::from_ubjson(v_ubjson);
|
json j_from_ubjson = json::from_ubjson(v_ubjson);
|
||||||
|
|
||||||
// serialize to BON8
|
|
||||||
std::vector<std::uint8_t> v_bon8 = json::to_bon8(j);
|
|
||||||
|
|
||||||
// 0x88, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0xF9, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x90
|
|
||||||
|
|
||||||
// roundtrip
|
|
||||||
json j_from_bon8 = json::from_bon8(v_bon8);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The library also supports binary types from BSON, CBOR (byte strings), and MessagePack (bin, ext, fixext). They are stored by default as `std::vector<std::uint8_t>` to be processed outside the library.
|
The library also supports binary types from BSON, CBOR (byte strings), and MessagePack (bin, ext, fixext). They are stored by default as `std::vector<std::uint8_t>` to be processed outside the library.
|
||||||
@@ -1193,11 +1187,6 @@ The library is used in multiple projects, applications, operating systems, etc.
|
|||||||
|
|
||||||
[](https://json.nlohmann.me/home/customers/)
|
[](https://json.nlohmann.me/home/customers/)
|
||||||
|
|
||||||
## Ecosystem
|
|
||||||
|
|
||||||
Beyond projects that use the library, there are third-party projects that build on top of it - schema validators,
|
|
||||||
language bindings, format converters, and the like. See the curated [Ecosystem](https://json.nlohmann.me/community/ecosystem/) page.
|
|
||||||
|
|
||||||
## Supported compilers
|
## Supported compilers
|
||||||
|
|
||||||
Though it's 2026 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
|
Though it's 2026 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
|
||||||
@@ -1393,7 +1382,6 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
|
|||||||
- The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](https://florian.loitsch.com/)
|
- The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](https://florian.loitsch.com/)
|
||||||
- The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/).
|
- The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/).
|
||||||
- The class contains parts of [Google Abseil](https://github.com/abseil/abseil-cpp) which is licensed under the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
|
- The class contains parts of [Google Abseil](https://github.com/abseil/abseil-cpp) which is licensed under the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
|
||||||
- The class contains an adapted version of the Eisel-Lemire algorithm and its table of powers of five from [fast_float](https://github.com/fastfloat/fast_float) by Daniel Lemire and contributors, which is available under the [MIT License](https://opensource.org/licenses/MIT) (used here), the Apache 2.0 License, and the Boost Software License. Copyright © 2021 The fast_float authors
|
|
||||||
|
|
||||||
<img align="right" src="https://git.fsfe.org/reuse/reuse-ci/raw/branch/master/reuse-horizontal.png" alt="REUSE Software">
|
<img align="right" src="https://git.fsfe.org/reuse/reuse-ci/raw/branch/master/reuse-horizontal.png" alt="REUSE Software">
|
||||||
|
|
||||||
@@ -1428,7 +1416,7 @@ I deeply appreciate the help of the following people.
|
|||||||
6. [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization.
|
6. [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization.
|
||||||
7. [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing.
|
7. [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing.
|
||||||
8. [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0.
|
8. [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0.
|
||||||
9. [Fiona Johanna Weber](https://github.com/Fiona-J-W) fixed a bug in and improved the performance of the comparison operators.
|
9. [Florian Weber](https://github.com/Florianjw) fixed a bug in and improved the performance of the comparison operators.
|
||||||
10. [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping.
|
10. [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping.
|
||||||
11. [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums.
|
11. [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums.
|
||||||
12. [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual Studio.
|
12. [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual Studio.
|
||||||
@@ -1530,14 +1518,14 @@ I deeply appreciate the help of the following people.
|
|||||||
108. [Kevin Tonon](https://github.com/ktonon) overworked the C++11 compiler checks in CMake.
|
108. [Kevin Tonon](https://github.com/ktonon) overworked the C++11 compiler checks in CMake.
|
||||||
109. [Axel Huebl](https://github.com/ax3l) simplified a CMake check and added support for the [Spack package manager](https://spack.io).
|
109. [Axel Huebl](https://github.com/ax3l) simplified a CMake check and added support for the [Spack package manager](https://spack.io).
|
||||||
110. [Carlos O'Ryan](https://github.com/coryan) fixed a typo.
|
110. [Carlos O'Ryan](https://github.com/coryan) fixed a typo.
|
||||||
111. [James Upjohn](https://github.com/jupjohn) fixed a version number in the compilers section.
|
111. [James Upjohn](https://github.com/jammehcow) fixed a version number in the compilers section.
|
||||||
112. [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines and provided documentation for the CMake integration.
|
112. [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines and provided documentation for the CMake integration.
|
||||||
113. [Jan Schöppach](https://github.com/dns13) fixed a typo.
|
113. [Jan Schöppach](https://github.com/dns13) fixed a typo.
|
||||||
114. [martin-mfg](https://github.com/martin-mfg) fixed a typo.
|
114. [martin-mfg](https://github.com/martin-mfg) fixed a typo.
|
||||||
115. [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`.
|
115. [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`.
|
||||||
116. [agrianius](https://github.com/agrianius) added code to use alternative string implementations.
|
116. [agrianius](https://github.com/agrianius) added code to use alternative string implementations.
|
||||||
117. [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function.
|
117. [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function.
|
||||||
118. [Julius Rakow](https://github.com/juliusrakow) fixed the Meson include directory and fixed the links to [cppreference.com](https://cppreference.com).
|
118. [Julius Rakow](https://github.com/jrakow) fixed the Meson include directory and fixed the links to [cppreference.com](https://cppreference.com).
|
||||||
119. [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode.
|
119. [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode.
|
||||||
120. [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases.
|
120. [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases.
|
||||||
121. [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library.
|
121. [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library.
|
||||||
@@ -1588,7 +1576,7 @@ I deeply appreciate the help of the following people.
|
|||||||
166. [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
166. [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
||||||
167. [yann-morin-1998](https://github.com/yann-morin-1998) helped to reduce the CMake requirement to version 3.1.
|
167. [yann-morin-1998](https://github.com/yann-morin-1998) helped to reduce the CMake requirement to version 3.1.
|
||||||
168. [Konstantin Podsvirov](https://github.com/podsvirov) maintains a package for the MSYS2 software distro.
|
168. [Konstantin Podsvirov](https://github.com/podsvirov) maintains a package for the MSYS2 software distro.
|
||||||
169. [remyabel](https://github.com/remyabel2) added GNUInstallDirs to the CMake files.
|
169. [remyabel](https://github.com/remyabel) added GNUInstallDirs to the CMake files.
|
||||||
170. [Taylor Howard](https://github.com/taylorhoward92) fixed a unit test.
|
170. [Taylor Howard](https://github.com/taylorhoward92) fixed a unit test.
|
||||||
171. [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method.
|
171. [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method.
|
||||||
172. [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning.
|
172. [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning.
|
||||||
@@ -1615,7 +1603,7 @@ I deeply appreciate the help of the following people.
|
|||||||
193. [Hubert Chathi](https://github.com/uhoreg) made CMake's version config file architecture-independent.
|
193. [Hubert Chathi](https://github.com/uhoreg) made CMake's version config file architecture-independent.
|
||||||
194. [OmnipotentEntity](https://github.com/OmnipotentEntity) implemented the binary values for CBOR, MessagePack, BSON, and UBJSON.
|
194. [OmnipotentEntity](https://github.com/OmnipotentEntity) implemented the binary values for CBOR, MessagePack, BSON, and UBJSON.
|
||||||
195. [ArtemSarmini](https://github.com/ArtemSarmini) fixed a compilation issue with GCC 10 and fixed a leak.
|
195. [ArtemSarmini](https://github.com/ArtemSarmini) fixed a compilation issue with GCC 10 and fixed a leak.
|
||||||
196. [Evgenii Sopov](https://github.com/sea5kg) integrated the library to the wsjcpp package manager.
|
196. [Evgenii Sopov](https://github.com/sea-kg) integrated the library to the wsjcpp package manager.
|
||||||
197. [Sergey Linev](https://github.com/linev) fixed a compiler warning.
|
197. [Sergey Linev](https://github.com/linev) fixed a compiler warning.
|
||||||
198. [Miguel Magalhães](https://github.com/magamig) fixed the year in the copyright.
|
198. [Miguel Magalhães](https://github.com/magamig) fixed the year in the copyright.
|
||||||
199. [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) fixed a compilation issue with MSVC.
|
199. [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) fixed a compilation issue with MSVC.
|
||||||
@@ -1709,7 +1697,7 @@ I deeply appreciate the help of the following people.
|
|||||||
287. [NN](https://github.com/NN---) added the Visual Studio output directory to `.gitignore`.
|
287. [NN](https://github.com/NN---) added the Visual Studio output directory to `.gitignore`.
|
||||||
288. [Romain Reignier](https://github.com/romainreignier) improved the performance of the vector output adapter.
|
288. [Romain Reignier](https://github.com/romainreignier) improved the performance of the vector output adapter.
|
||||||
289. [Mike](https://github.com/Mike-Leo-Smith) fixed the `std::iterator_traits`.
|
289. [Mike](https://github.com/Mike-Leo-Smith) fixed the `std::iterator_traits`.
|
||||||
290. [Richard Hozák](https://github.com/richardhozak) added macro `JSON_NO_ENUM` to disable default enum conversions.
|
290. [Richard Hozák](https://github.com/zxey) added macro `JSON_NO_ENUM` to disable default enum conversions.
|
||||||
291. [vakokako](https://github.com/vakokako) fixed tests when compiling with C++20.
|
291. [vakokako](https://github.com/vakokako) fixed tests when compiling with C++20.
|
||||||
292. [Alexander “weej” Jones](https://github.com/alexweej) fixed an example in the README.
|
292. [Alexander “weej” Jones](https://github.com/alexweej) fixed an example in the README.
|
||||||
293. [Eli Schwartz](https://github.com/eli-schwartz) added more files to the `include.zip` archive.
|
293. [Eli Schwartz](https://github.com/eli-schwartz) added more files to the `include.zip` archive.
|
||||||
@@ -1734,7 +1722,7 @@ I deeply appreciate the help of the following people.
|
|||||||
312. [Gareth Sylvester-Bradley](https://github.com/garethsb) added `operator/=` and `operator/` to construct JSON pointers.
|
312. [Gareth Sylvester-Bradley](https://github.com/garethsb) added `operator/=` and `operator/` to construct JSON pointers.
|
||||||
313. [Michael Macnair](https://github.com/mykter) added support for afl-fuzz testing.
|
313. [Michael Macnair](https://github.com/mykter) added support for afl-fuzz testing.
|
||||||
314. [Berkus Decker](https://github.com/berkus) fixed a typo in the README.
|
314. [Berkus Decker](https://github.com/berkus) fixed a typo in the README.
|
||||||
315. [Illia Polishchuk](https://github.com/ilqvya) improved the CMake testing.
|
315. [Illia Polishchuk](https://github.com/effolkronium) improved the CMake testing.
|
||||||
316. [Ikko Ashimine](https://github.com/eltociear) fixed a typo.
|
316. [Ikko Ashimine](https://github.com/eltociear) fixed a typo.
|
||||||
317. [Raphael Grimm](https://github.com/barcode) added the possibility to define a custom base class.
|
317. [Raphael Grimm](https://github.com/barcode) added the possibility to define a custom base class.
|
||||||
318. [tocic](https://github.com/tocic) fixed typos in the documentation.
|
318. [tocic](https://github.com/tocic) fixed typos in the documentation.
|
||||||
@@ -1804,66 +1792,6 @@ I deeply appreciate the help of the following people.
|
|||||||
382. [bitFiedler](https://github.com/bitFiedler) made GDB pretty printer work with Python 3.8.
|
382. [bitFiedler](https://github.com/bitFiedler) made GDB pretty printer work with Python 3.8.
|
||||||
383. [Gianfranco Costamagna](https://github.com/LocutusOfBorg) fixed a compiler warning.
|
383. [Gianfranco Costamagna](https://github.com/LocutusOfBorg) fixed a compiler warning.
|
||||||
384. [risa2000](https://github.com/risa2000) made `std::filesystem::path` conversion to/from UTF-8 encoded string explicit.
|
384. [risa2000](https://github.com/risa2000) made `std::filesystem::path` conversion to/from UTF-8 encoded string explicit.
|
||||||
385. [AM](https://github.com/maqnouch) fixed typos in the README.
|
|
||||||
386. [dmenendez-gruposantander](https://github.com/dmenendez-gruposantander) fixed typos in the comments of the examples.
|
|
||||||
387. [Mihai Stan](https://github.com/mstan-xx) fixed comparisons against the literal `0`.
|
|
||||||
388. [Matt Gumbel](https://github.com/intelmatt) fixed some `-Weffc++` warnings.
|
|
||||||
389. [vimpunk](https://github.com/vimpunk) moved a lambda out of an unevaluated context to support older compilers.
|
|
||||||
390. [Chris Harris](https://github.com/cjh1) fixed the compilation with GCC 4.8.
|
|
||||||
391. [Palmer Dabbelt](https://github.com/palmer-dabbelt) generated and installed a pkg-config file.
|
|
||||||
392. [Gus Pozuelo](https://github.com/ap-viavi) made `ordered_map` compatible with GCC 5.5, Clang 3.6, and Xcode 9.
|
|
||||||
393. [AK](https://github.com/Lioncky) fixed an MSVC build error caused by the `min`/`max` macros from `windows.h`.
|
|
||||||
394. [Sergiu Deitsch](https://github.com/sergiud) provided a fallback for missing `char8_t` support.
|
|
||||||
395. [Xiaochuan Ye](https://github.com/XueSongTap) fixed `from_msgpack` for `std::byte` input by specializing `std::char_traits`.
|
|
||||||
396. [Ville Vesilehto](https://github.com/thevilledev) fixed an overflow in the BJData size calculation and rejected overflowing negative integers in CBOR.
|
|
||||||
397. [NmPassTHFan](https://github.com/nmpassthf) replaced the deprecated `std::is_trivial` for C++26.
|
|
||||||
398. [Chris Ever](https://github.com/chirsz-ever) added the `ignore_trailing_commas` parser option.
|
|
||||||
399. [Kuan-Fu Wu](https://github.com/kfwu1999) fixed the example code for `json_pointer` initialization.
|
|
||||||
400. [David Kilzer](https://github.com/ddkilzer) added a missing header to the input adapters.
|
|
||||||
401. [Miko](https://github.com/mikomikotaishi) added proper C++20 module support, simplified the module API, and fixed missing exports.
|
|
||||||
402. [hitgirl](https://github.com/hitgil) fixed the CMake configuration when cross-compiling.
|
|
||||||
403. [Devon Thomas](https://github.com/ThomaDevOSU) mentioned the Artistic Style formatting in the contribution guidelines.
|
|
||||||
404. [Erik Hu](https://github.com/Erikhu1) made Coveralls upload errors non-fatal in the CI.
|
|
||||||
405. [co63oc](https://github.com/co63oc) fixed typos.
|
|
||||||
406. [DmitriBogdanov](https://github.com/DmitriBogdanov) fixed broken package manager links in the documentation.
|
|
||||||
407. [Bander](https://github.com/banderzhm) improved the MSVC compatibility of the C++ modules.
|
|
||||||
408. [Andy Choi](https://github.com/ccpong) removed an unnecessary `template` keyword before `get` in the README and the documentation.
|
|
||||||
409. [SamareshSingh](https://github.com/ssam18) fixed single-element brace initialization to copy/move instead of wrapping in an array, fixed the `WITH_DEFAULT` macros for `ordered_map`, and handled moved events in `serve_header.py`.
|
|
||||||
410. [Aditya](https://github.com/Lumowhisp) improved the documentation of the documentation generation.
|
|
||||||
411. [cheese1](https://github.com/cheese1) clarified the README.
|
|
||||||
412. [KhloodElhossiny](https://github.com/khloodelhossiny) enabled `std::string_view` keys in `operator[]`.
|
|
||||||
413. [Charles Cabergs](https://github.com/cacharle) fixed a `-Wtautological-constant-out-of-range-compare` warning.
|
|
||||||
414. [EALePain](https://github.com/EALePain) made the `std::tuple` conversion work with reference types such as `std::tie`.
|
|
||||||
415. [koala_oishi](https://github.com/chibi-dogs) fixed grammatical wording in the README.
|
|
||||||
416. [riccardoori11](https://github.com/riccardoori11) fixed a typo in the documentation.
|
|
||||||
417. [Swastik Bose](https://github.com/VasuBhakt) fixed the parent pointers after `update()` with `JSON_DIAGNOSTICS` and fixed the Doxygen autolinking of requirements.
|
|
||||||
418. [trdesilva](https://github.com/trdesilva) added `front`, `pop_front`, and `push_front` to `json_pointer`.
|
|
||||||
419. [Akhilesh Arora](https://github.com/akhilesharora) fixed an incomplete-type error with `ordered_json`.
|
|
||||||
420. [Hariom Phulre](https://github.com/hariomphulre) fixed the C++20 modules compilation with GCC.
|
|
||||||
421. [Kirill Lokotkov](https://github.com/RUSLoker) fixed printing `long double` values.
|
|
||||||
422. [George Sedov](https://github.com/radistmorse) added the `NLOHMANN_DEFINE_TYPE_*_WITH_NAMES` macros.
|
|
||||||
423. [Caillin Nugent](https://github.com/nugentcaillin) added the `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT` macro.
|
|
||||||
424. [Cosmin D.](https://github.com/drcosmin) fixed `std::filesystem::path` conversions and added an MSVC workaround for `std::unique_ptr`.
|
|
||||||
425. [Paul Dreik](https://github.com/pauldreik) fixed a test relying on implementation-specific behavior.
|
|
||||||
426. [Daniel Falk](https://github.com/daniel-falk) added missing copyright notices to the SBOM.
|
|
||||||
427. [Federico Sfriso](https://github.com/federicosfriso05-dotcom) added support for constructing JSON values from C++20 range views.
|
|
||||||
428. [Luke Banicevic](https://github.com/banaboi) fixed corrupt BSON output for lengths exceeding `INT32_MAX`, cleaned up the BSON writer, and improved the documentation.
|
|
||||||
429. [Patrick Armstrong](https://github.com/Patrick10199) updated the CBOR references and the half-precision float assertions.
|
|
||||||
430. [Yash Bavadiya](https://github.com/xevrion) added checks to all BSON reads.
|
|
||||||
431. [hum4nBeing](https://github.com/hum4nBeing) fixed the overflow handling of high-precision numbers in UBJSON.
|
|
||||||
432. [tomatotomata](https://github.com/tomatotomata) added checks for reading CBOR tagged subtypes.
|
|
||||||
433. [YingqiDuan](https://github.com/YingqiDuan) documented the BSON interoperability.
|
|
||||||
434. [KBS](https://github.com/youdie006) documented the standards compliance and the strictness of `parse()` and `operator>>`.
|
|
||||||
435. [Petr Bělohlávek](https://github.com/petrbel) added Clang 21 and 22 to the CI.
|
|
||||||
436. [Dmitry Rantovov](https://github.com/darkdi) fixed the placement of a CBOR documentation block.
|
|
||||||
437. [ljcjclljc](https://github.com/ljcjclljc) fixed the comparison of large unsigned integers with signed integers.
|
|
||||||
438. [Sahil Kamate](https://github.com/sahilkamate03) fixed the handling of CBOR tags 0-5 and 21-23.
|
|
||||||
439. [Krishnanand G](https://github.com/Krishnanand-G) made the UBJSON writer reject `use_type` without `use_size`.
|
|
||||||
440. [whn](https://github.com/Whning0513) documented the lenient BSON input handling and corrected the complexity of `to_bson`.
|
|
||||||
441. [elix3r](https://github.com/22elix3r) fixed `update()` with `merge_objects` when merging a primitive into an object.
|
|
||||||
442. [Avionic Harshit](https://github.com/avionicharshit-byte) made `diff()` linear when an array shrinks.
|
|
||||||
443. [Qatadaha Bin Matloob](https://github.com/qatcod) fixed comparisons between integers and floats and fixed unparsable BJData output.
|
|
||||||
444. [Wu Shuwen](https://github.com/dajiaohuang) removed an unused include.
|
|
||||||
|
|
||||||
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
||||||
|
|
||||||
@@ -1874,13 +1802,13 @@ The library itself consists of a single header file licensed under the MIT licen
|
|||||||
- [**amalgamate.py - Amalgamate C source and header files**](https://github.com/edlund/amalgamate) to create a single header file
|
- [**amalgamate.py - Amalgamate C source and header files**](https://github.com/edlund/amalgamate) to create a single header file
|
||||||
- [**American fuzzy lop**](https://lcamtuf.coredump.cx/afl/) for fuzz testing
|
- [**American fuzzy lop**](https://lcamtuf.coredump.cx/afl/) for fuzz testing
|
||||||
- [**AppVeyor**](https://www.appveyor.com) for [continuous integration](https://ci.appveyor.com/project/nlohmann/json) on Windows
|
- [**AppVeyor**](https://www.appveyor.com) for [continuous integration](https://ci.appveyor.com/project/nlohmann/json) on Windows
|
||||||
- [**Artistic Style**](https://astyle.sourceforge.net) for automatic source code indentation
|
- [**Artistic Style**](http://astyle.sourceforge.net) for automatic source code indentation
|
||||||
- [**Clang**](https://clang.llvm.org) for compilation with code sanitizers
|
- [**Clang**](https://clang.llvm.org) for compilation with code sanitizers
|
||||||
- [**CMake**](https://cmake.org) for build automation
|
- [**CMake**](https://cmake.org) for build automation
|
||||||
- [**Codacy**](https://www.codacy.com) for further [code analysis](https://app.codacy.com/gh/nlohmann/json/dashboard)
|
- [**Codacy**](https://www.codacy.com) for further [code analysis](https://app.codacy.com/gh/nlohmann/json/dashboard)
|
||||||
- [**Coveralls**](https://coveralls.io) to measure [code coverage](https://coveralls.io/github/nlohmann/json)
|
- [**Coveralls**](https://coveralls.io) to measure [code coverage](https://coveralls.io/github/nlohmann/json)
|
||||||
- [**Coverity Scan**](https://scan.coverity.com) for [static analysis](https://scan.coverity.com/projects/nlohmann-json)
|
- [**Coverity Scan**](https://scan.coverity.com) for [static analysis](https://scan.coverity.com/projects/nlohmann-json)
|
||||||
- [**cppcheck**](https://cppcheck.sourceforge.io) for static analysis
|
- [**cppcheck**](http://cppcheck.sourceforge.net) for static analysis
|
||||||
- [**doctest**](https://github.com/onqtam/doctest) for the unit tests
|
- [**doctest**](https://github.com/onqtam/doctest) for the unit tests
|
||||||
- [**GitHub Changelog Generator**](https://github.com/skywinder/github-changelog-generator) to generate the [ChangeLog](https://github.com/nlohmann/json/blob/develop/ChangeLog.md)
|
- [**GitHub Changelog Generator**](https://github.com/skywinder/github-changelog-generator) to generate the [ChangeLog](https://github.com/nlohmann/json/blob/develop/ChangeLog.md)
|
||||||
- [**Google Benchmark**](https://github.com/google/benchmark) to implement the benchmarks
|
- [**Google Benchmark**](https://github.com/google/benchmark) to implement the benchmarks
|
||||||
@@ -1895,15 +1823,6 @@ The library itself consists of a single header file licensed under the MIT licen
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Standards compliance
|
|
||||||
|
|
||||||
The library targets strict conformance with [RFC 8259](https://tools.ietf.org/html/rfc8259.html). Both the original [JSONTestSuite](https://github.com/nst/JSONTestSuite) and its updated revision are exercised in CI; their test data is downloaded from [`nlohmann/json_test_data`](https://github.com/nlohmann/json_test_data) at configure time rather than committed to this repository (see [`tests/src/unit-testsuites.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-testsuites.cpp)):
|
|
||||||
|
|
||||||
- The updated revision runs all mandatory `y_` (must-accept) and `n_` (must-reject) cases through the strict [`parse()`](https://json.nlohmann.me/api/basic_json/parse/) entry point; the original suite runs its `n_` cases through `parse()` and its `y_` cases through [`operator>>`](https://json.nlohmann.me/api/operator_gtgt/).
|
|
||||||
- The `i_` (implementation-defined) cases are, by RFC 8259, free to be accepted *or* rejected, so "passing all `i_` cases" is not a meaningful conformance metric. The library makes deliberate, documented choices there: nesting depth is not artificially limited, a leading UTF-8 byte order mark is silently ignored, [Unicode noncharacters](https://www.unicode.org/faq/private_use.html#nonchar1) are forwarded unchanged, invalid UTF-8 and lone/unpaired UTF-16 surrogates are rejected (stricter than required), and a number that cannot be stored without becoming `NaN`/`INF` raises [`out_of_range.406`](https://json.nlohmann.me/home/exceptions/#jsonexceptionout_of_range406).
|
|
||||||
|
|
||||||
One behavioral nuance is worth calling out, because a superficial test often misreads it as non-compliance: [`parse()`](https://json.nlohmann.me/api/basic_json/parse/) is strict and rejects trailing data after a value, whereas [`operator>>`](https://json.nlohmann.me/api/operator_gtgt/) follows relaxed iostream semantics — it parses a single value and leaves the stream positioned right after it. Feeding "a valid document followed by trailing bytes" through `operator>>` reports success; the same input through `parse()` is rejected. This is a documented two-API design, not a conformance gap. See [**parsing**](https://json.nlohmann.me/features/parsing/) for details.
|
|
||||||
|
|
||||||
### Character encoding
|
### Character encoding
|
||||||
|
|
||||||
The library supports **Unicode input** as follows:
|
The library supports **Unicode input** as follows:
|
||||||
|
|||||||
+111
-242
@@ -8,24 +8,24 @@ set(N 10)
|
|||||||
include(FindPython3)
|
include(FindPython3)
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
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++)
|
find_program(CLANG_TOOL NAMES clang++-HEAD clang++ 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-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)
|
find_program(CLANG_TIDY_TOOL NAMES 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})")
|
||||||
|
|
||||||
message(STATUS "🔖 CMake ${CMAKE_VERSION} (${CMAKE_COMMAND})")
|
message(STATUS "🔖 CMake ${CMAKE_VERSION} (${CMAKE_COMMAND})")
|
||||||
|
|
||||||
find_program(GCC_TOOL NAMES g++-latest g++-HEAD g++ g++-16 g++-15 g++-14 g++-13 g++-12 g++-11 g++-10)
|
find_program(GCC_TOOL NAMES g++-latest g++-HEAD g++ g++-15 g++-14 g++-13 g++-12 g++-11 g++-10)
|
||||||
execute_process(COMMAND ${GCC_TOOL} --version OUTPUT_VARIABLE GCC_TOOL_VERSION ERROR_VARIABLE GCC_TOOL_VERSION)
|
execute_process(COMMAND ${GCC_TOOL} --version OUTPUT_VARIABLE GCC_TOOL_VERSION ERROR_VARIABLE GCC_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" GCC_TOOL_VERSION "${GCC_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" GCC_TOOL_VERSION "${GCC_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 GCC ${GCC_TOOL_VERSION} (${GCC_TOOL})")
|
message(STATUS "🔖 GCC ${GCC_TOOL_VERSION} (${GCC_TOOL})")
|
||||||
|
|
||||||
find_program(GCOV_TOOL NAMES gcov-HEAD gcov gcov-16 gcov-15 gcov-14 gcov-13 gcov-12 gcov-11 gcov-10)
|
find_program(GCOV_TOOL NAMES gcov-HEAD gcov gcov-15 gcov-14 gcov-13 gcov-12 gcov-11 gcov-10)
|
||||||
execute_process(COMMAND ${GCOV_TOOL} --version OUTPUT_VARIABLE GCOV_TOOL_VERSION ERROR_VARIABLE GCOV_TOOL_VERSION)
|
execute_process(COMMAND ${GCOV_TOOL} --version OUTPUT_VARIABLE GCOV_TOOL_VERSION ERROR_VARIABLE GCOV_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" GCOV_TOOL_VERSION "${GCOV_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" GCOV_TOOL_VERSION "${GCOV_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 GCOV ${GCOV_TOOL_VERSION} (${GCOV_TOOL})")
|
message(STATUS "🔖 GCOV ${GCOV_TOOL_VERSION} (${GCOV_TOOL})")
|
||||||
@@ -40,14 +40,6 @@ execute_process(COMMAND ${IWYU_TOOL} --version OUTPUT_VARIABLE IWYU_TOOL_VERSION
|
|||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" IWYU_TOOL_VERSION "${IWYU_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" IWYU_TOOL_VERSION "${IWYU_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 include-what-you-use ${IWYU_TOOL_VERSION} (${IWYU_TOOL})")
|
message(STATUS "🔖 include-what-you-use ${IWYU_TOOL_VERSION} (${IWYU_TOOL})")
|
||||||
|
|
||||||
# CMake's CXX_INCLUDE_WHAT_YOU_USE launcher runs IWYU during the normal compile step (useful to see
|
|
||||||
# diagnostics inline), but CMake's own __run_co_compile wrapper does not propagate the launched
|
|
||||||
# tool's exit code to the build, so IWYU's own "-Xiwyu --error" cannot fail that step (verified: a
|
|
||||||
# deliberately-unused #include in a header still lets `cmake --build` finish with exit code 0).
|
|
||||||
# iwyu_tool.py, which ships with IWYU, reads compile_commands.json and does return a non-zero exit
|
|
||||||
# code for any analyzed file with findings; ci_single_binaries uses it to actually fail on findings.
|
|
||||||
find_program(IWYU_TOOL_PY NAMES iwyu_tool iwyu_tool.py iwyu-tool)
|
|
||||||
|
|
||||||
find_program(INFER_TOOL NAMES infer)
|
find_program(INFER_TOOL NAMES infer)
|
||||||
execute_process(COMMAND ${INFER_TOOL} --version OUTPUT_VARIABLE INFER_TOOL_VERSION ERROR_VARIABLE INFER_TOOL_VERSION)
|
execute_process(COMMAND ${INFER_TOOL} --version OUTPUT_VARIABLE INFER_TOOL_VERSION ERROR_VARIABLE INFER_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" INFER_TOOL_VERSION "${INFER_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" INFER_TOOL_VERSION "${INFER_TOOL_VERSION}")
|
||||||
@@ -63,6 +55,12 @@ execute_process(COMMAND ${NINJA_TOOL} --version OUTPUT_VARIABLE NINJA_TOOL_VERSI
|
|||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" NINJA_TOOL_VERSION "${NINJA_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" NINJA_TOOL_VERSION "${NINJA_TOOL_VERSION}")
|
||||||
message(STATUS "🔖 Ninja ${NINJA_TOOL_VERSION} (${NINJA_TOOL})")
|
message(STATUS "🔖 Ninja ${NINJA_TOOL_VERSION} (${NINJA_TOOL})")
|
||||||
|
|
||||||
|
find_program(OCLINT_TOOL NAMES oclint-json-compilation-database)
|
||||||
|
find_program(OCLINT_VERSION_TOOL NAMES oclint)
|
||||||
|
execute_process(COMMAND ${OCLINT_VERSION_TOOL} --version OUTPUT_VARIABLE OCLINT_TOOL_VERSION ERROR_VARIABLE OCLINT_TOOL_VERSION)
|
||||||
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" OCLINT_TOOL_VERSION "${OCLINT_TOOL_VERSION}")
|
||||||
|
message(STATUS "🔖 OCLint ${OCLINT_TOOL_VERSION} (${OCLINT_TOOL})")
|
||||||
|
|
||||||
find_program(VALGRIND_TOOL NAMES valgrind)
|
find_program(VALGRIND_TOOL NAMES valgrind)
|
||||||
execute_process(COMMAND ${VALGRIND_TOOL} --version OUTPUT_VARIABLE VALGRIND_TOOL_VERSION ERROR_VARIABLE VALGRIND_TOOL_VERSION)
|
execute_process(COMMAND ${VALGRIND_TOOL} --version OUTPUT_VARIABLE VALGRIND_TOOL_VERSION ERROR_VARIABLE VALGRIND_TOOL_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" VALGRIND_TOOL_VERSION "${VALGRIND_TOOL_VERSION}")
|
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" VALGRIND_TOOL_VERSION "${VALGRIND_TOOL_VERSION}")
|
||||||
@@ -130,16 +128,16 @@ foreach(CXX_STANDARD 11 14 17 20 23 26)
|
|||||||
COMMENT "Compile and test with Clang for C++${CXX_STANDARD}"
|
COMMENT "Compile and test with Clang for C++${CXX_STANDARD}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# pass -stdlib=libc++ through CXXFLAGS: an explicit -DCMAKE_CXX_FLAGS would make CMake ignore CXXFLAGS
|
|
||||||
add_custom_target(ci_test_clang_libcxx_cxx${CXX_STANDARD}
|
add_custom_target(ci_test_clang_libcxx_cxx${CXX_STANDARD}
|
||||||
COMMAND CXX=${CLANG_TOOL} CXXFLAGS="${CLANG_CXXFLAGS};-stdlib=libc++" ${CMAKE_COMMAND}
|
COMMAND CXX=${CLANG_TOOL} CXXFLAGS="${CLANG_CXXFLAGS}" ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
-DJSON_TestStandards=${CXX_STANDARD}
|
-DJSON_TestStandards=${CXX_STANDARD}
|
||||||
|
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
|
-DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang_libcxx_cxx${CXX_STANDARD}
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang_cxx${CXX_STANDARD}
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_clang_libcxx_cxx${CXX_STANDARD}
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_clang_cxx${CXX_STANDARD}
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_clang_libcxx_cxx${CXX_STANDARD} && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_clang_cxx${CXX_STANDARD} && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||||
COMMENT "Compile and test with Clang for C++${CXX_STANDARD} (libc++)"
|
COMMENT "Compile and test with Clang for C++${CXX_STANDARD} (libc++)"
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
@@ -215,38 +213,18 @@ add_custom_target(ci_test_legacycomparison
|
|||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Validate UTF-8 with simdutf.
|
# Enable brace-init copy semantics.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_simdutf
|
add_custom_target(ci_test_brace_init_copy_semantics
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_TestSimdutf=ON
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
# simdutf needs C++17, so the library falls back to its scalar validator
|
-DCMAKE_CXX_FLAGS=-DJSON_BRACE_INIT_COPY_SEMANTICS=1
|
||||||
# below that: build the suite at C++11 to cover the fallback with the macro
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_brace_init_copy_semantics
|
||||||
# defined, and at C++17 to run every test against simdutf itself
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_brace_init_copy_semantics
|
||||||
"-DJSON_TestStandards=11\;17"
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_brace_init_copy_semantics && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_simdutf
|
COMMENT "Compile and test with brace-init copy semantics enabled"
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_simdutf
|
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_simdutf && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
|
||||||
COMMENT "Compile and test with simdutf UTF-8 validation enabled"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Enable strict NUL-byte handling.
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
add_custom_target(ci_test_strict_nul_handling
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_StrictNulHandling=ON
|
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_strict_nul_handling
|
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_strict_nul_handling
|
|
||||||
# unit-testsuites contains a fixture (a "1e308" test value) that relies on the
|
|
||||||
# legacy NUL-as-end-of-input behavior this macro disables; exclude it here, as
|
|
||||||
# it is expected to fail under strict NUL handling and is out of scope for it
|
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_strict_nul_handling && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure -E "test-testsuites"
|
|
||||||
COMMENT "Compile and test with strict NUL-byte handling enabled"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -264,73 +242,6 @@ add_custom_target(ci_test_noglobaludls
|
|||||||
COMMENT "Compile and test with global UDLs disabled"
|
COMMENT "Compile and test with global UDLs disabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Disable enum serialization.
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
add_custom_target(ci_test_disableenumserialization
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_DisableEnumSerialization=ON
|
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_disableenumserialization
|
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_disableenumserialization
|
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_disableenumserialization && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
|
||||||
COMMENT "Compile and test with enum serialization disabled"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Disable conversion from a one-element tuple of a JSON reference.
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
add_custom_target(ci_test_disabletuplereferenceconversion
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_DisableTupleReferenceConversion=ON
|
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_disabletuplereferenceconversion
|
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_disabletuplereferenceconversion
|
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_disabletuplereferenceconversion && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
|
||||||
COMMENT "Compile and test with tuple reference conversion disabled"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Skip the multiple-inclusion library version check.
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# tests/src/skip_library_version_check.cpp deliberately simulates a scenario
|
|
||||||
# (mixing two differently-versioned inclusions of the library in one
|
|
||||||
# translation unit) that unavoidably triggers the compiler's own "macro
|
|
||||||
# redefined" warning, so -- unlike the ci_test_* targets above -- it is
|
|
||||||
# compiled directly here, with a modest warning set, instead of being folded
|
|
||||||
# into the library's own -Weverything/-Werror unit test matrix.
|
|
||||||
add_custom_target(ci_test_skiplibraryversioncheck
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/skip_library_version_check
|
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -std=c++11 -Wall -Wextra
|
|
||||||
-I${PROJECT_SOURCE_DIR}/include
|
|
||||||
${PROJECT_SOURCE_DIR}/tests/src/skip_library_version_check.cpp
|
|
||||||
-o ${PROJECT_BINARY_DIR}/skip_library_version_check/skip_library_version_check
|
|
||||||
COMMAND ${PROJECT_BINARY_DIR}/skip_library_version_check/skip_library_version_check
|
|
||||||
COMMENT "Compile and run a translation unit simulating a mismatched library version, with JSON_SKIP_LIBRARY_VERSION_CHECK defined"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Disable thread-local storage.
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Without thread-local storage, copying and comparing cannot bound their
|
|
||||||
# descent and handle every object and array without the call stack. Those paths
|
|
||||||
# are otherwise only reached by values nested deeper than the bound, so this
|
|
||||||
# target is what runs the whole test suite through them.
|
|
||||||
add_custom_target(ci_test_no_thread_local
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
|
||||||
-DJSON_BuildTests=ON
|
|
||||||
-DCMAKE_CXX_FLAGS=-DJSON_NO_THREAD_LOCAL
|
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_no_thread_local
|
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_no_thread_local
|
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_no_thread_local && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
|
||||||
COMMENT "Compile and test without thread-local storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Coverage.
|
# Coverage.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -378,29 +289,20 @@ 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 a direct push 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}/include/nlohmann/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cpp
|
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
|
||||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cu
|
${PROJECT_SOURCE_DIR}/tests/src/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/include/*.hpp
|
${PROJECT_SOURCE_DIR}/tests/benchmarks/src/benchmarks.cpp
|
||||||
${PROJECT_SOURCE_DIR}/include/*.cpp
|
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
||||||
${PROJECT_SOURCE_DIR}/include/*.cu
|
|
||||||
${PROJECT_SOURCE_DIR}/tests/*.hpp
|
|
||||||
${PROJECT_SOURCE_DIR}/tests/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/tests/*.cu
|
|
||||||
)
|
)
|
||||||
list(FILTER INDENT_FILES EXCLUDE REGEX "/tests/thirdparty/|/tests/abi/include/nlohmann/")
|
|
||||||
|
|
||||||
set(include_dir ${PROJECT_SOURCE_DIR}/single_include/nlohmann)
|
set(include_dir ${PROJECT_SOURCE_DIR}/single_include/nlohmann)
|
||||||
set(tool_dir ${PROJECT_SOURCE_DIR}/tools/amalgamate)
|
set(tool_dir ${PROJECT_SOURCE_DIR}/tools/amalgamate)
|
||||||
add_custom_target(ci_test_amalgamation
|
add_custom_target(ci_test_amalgamation
|
||||||
COMMAND rm -fr ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~ ${include_dir}/json_literals.hpp~
|
COMMAND rm -fr ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
||||||
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND cp ${include_dir}/json_literals.hpp ${include_dir}/json_literals.hpp~
|
|
||||||
COMMAND cp ${PROJECT_SOURCE_DIR}/BUILD.bazel ${PROJECT_SOURCE_DIR}/BUILD.bazel~
|
|
||||||
|
|
||||||
COMMAND ${Python3_EXECUTABLE} -mvenv venv_astyle
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv_astyle
|
||||||
COMMAND venv_astyle/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/tools/astyle/requirements.txt
|
COMMAND venv_astyle/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/tools/astyle/requirements.txt
|
||||||
@@ -408,20 +310,16 @@ 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 venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.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 diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||||
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
||||||
COMMAND diff ${include_dir}/json_literals.hpp~ ${include_dir}/json_literals.hpp
|
|
||||||
COMMAND diff ${PROJECT_SOURCE_DIR}/BUILD.bazel~ ${PROJECT_SOURCE_DIR}/BUILD.bazel
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
COMMENT "Check amalgamation, formatting, and BUILD.bazel"
|
COMMENT "Check amalgamation and indentation"
|
||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -456,14 +354,14 @@ add_custom_target(ci_test_valgrind
|
|||||||
# Check code with Clang Static Analyzer.
|
# Check code with Clang Static Analyzer.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
set(CLANG_ANALYZER_CHECKS "nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,optin.cplusplus.UninitializedObject,optin.cplusplus.VirtualCall,optin.performance.Padding,optin.portability.UnixAPI,security.FloatLoopCounter,security.insecureAPI.DeprecatedOrUnsafeBufferHandling,security.insecureAPI.bcmp,security.insecureAPI.bcopy,security.insecureAPI.bzero,security.insecureAPI.rand,security.insecureAPI.strcpy,valist.CopyToSelf,valist.Uninitialized,valist.Unterminated,core.CallAndMessage,core.DivideZero,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.VLASize,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.PlacementNew,cplusplus.PureVirtualCall,deadcode.DeadStores,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,security.insecureAPI.UncheckedReturn,security.insecureAPI.decodeValueOfObjCType,security.insecureAPI.getpw,security.insecureAPI.gets,security.insecureAPI.mkstemp,security.insecureAPI.mktemp,security.insecureAPI.vfork,unix.API,unix.Malloc,unix.MallocSizeof,unix.MismatchedDeallocator,unix.Vfork,unix.cstring.BadSizeArg,unix.cstring.NullArg")
|
set(CLANG_ANALYZER_CHECKS "fuchsia.HandleChecker,nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,optin.cplusplus.UninitializedObject,optin.cplusplus.VirtualCall,optin.mpi.MPI-Checker,optin.osx.OSObjectCStyleCast,optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,optin.osx.cocoa.localizability.NonLocalizedStringChecker,optin.performance.GCDAntipattern,optin.performance.Padding,optin.portability.UnixAPI,security.FloatLoopCounter,security.insecureAPI.DeprecatedOrUnsafeBufferHandling,security.insecureAPI.bcmp,security.insecureAPI.bcopy,security.insecureAPI.bzero,security.insecureAPI.rand,security.insecureAPI.strcpy,valist.CopyToSelf,valist.Uninitialized,valist.Unterminated,webkit.NoUncountedMemberChecker,webkit.RefCntblBaseVirtualDtor,core.CallAndMessage,core.DivideZero,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.VLASize,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.PlacementNew,cplusplus.PureVirtualCall,deadcode.DeadStores,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,osx.API,osx.MIG,osx.NumberObjectConversion,osx.OSObjectRetainCount,osx.ObjCProperty,osx.SecKeychainAPI,osx.cocoa.AtSync,osx.cocoa.AutoreleaseWrite,osx.cocoa.ClassRelease,osx.cocoa.Dealloc,osx.cocoa.IncompatibleMethodTypes,osx.cocoa.Loops,osx.cocoa.MissingSuperCall,osx.cocoa.NSAutoreleasePool,osx.cocoa.NSError,osx.cocoa.NilArg,osx.cocoa.NonNilReturnValue,osx.cocoa.ObjCGenerics,osx.cocoa.RetainCount,osx.cocoa.RunLoopAutoreleaseLeak,osx.cocoa.SelfInit,osx.cocoa.SuperDealloc,osx.cocoa.UnusedIvars,osx.cocoa.VariadicMethodTypes,osx.coreFoundation.CFError,osx.coreFoundation.CFNumber,osx.coreFoundation.CFRetainRelease,osx.coreFoundation.containers.OutOfBounds,osx.coreFoundation.containers.PointerSizedValues,security.insecureAPI.UncheckedReturn,security.insecureAPI.decodeValueOfObjCType,security.insecureAPI.getpw,security.insecureAPI.gets,security.insecureAPI.mkstemp,security.insecureAPI.mktemp,security.insecureAPI.vfork,unix.API,unix.Malloc,unix.MallocSizeof,unix.MismatchedDeallocator,unix.Vfork,unix.cstring.BadSizeArg,unix.cstring.NullArg")
|
||||||
|
|
||||||
add_custom_target(ci_clang_analyze
|
add_custom_target(ci_clang_analyze
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON
|
-DJSON_BuildTests=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang_analyze
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang_analyze
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_clang_analyze && ${SCAN_BUILD_TOOL} -enable-checker ${CLANG_ANALYZER_CHECKS} --use-c++=${CLANG_TOOL} --use-analyzer=${CLANG_TOOL} -analyze-headers --status-bugs -o ${PROJECT_BINARY_DIR}/report ninja
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_clang_analyze && ${SCAN_BUILD_TOOL} -enable-checker ${CLANG_ANALYZER_CHECKS} --use-c++=${CLANG_TOOL} -analyze-headers -o ${PROJECT_BINARY_DIR}/report ninja
|
||||||
COMMENT "Check code with Clang Analyzer"
|
COMMENT "Check code with Clang Analyzer"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -479,7 +377,7 @@ add_custom_target(ci_cppcheck
|
|||||||
COMMAND venv_cppcheck/bin/cppcheck --enable=warning --check-level=exhaustive --inline-suppr --inconclusive --force
|
COMMAND venv_cppcheck/bin/cppcheck --enable=warning --check-level=exhaustive --inline-suppr --inconclusive --force
|
||||||
--std=c++11 ${PROJECT_SOURCE_DIR}/include/nlohmann/json.hpp -I ${CMAKE_SOURCE_DIR}/include
|
--std=c++11 ${PROJECT_SOURCE_DIR}/include/nlohmann/json.hpp -I ${CMAKE_SOURCE_DIR}/include
|
||||||
--error-exitcode=1 --relative-paths=${PROJECT_SOURCE_DIR} -j ${N} --include=default_defines.hpp
|
--error-exitcode=1 --relative-paths=${PROJECT_SOURCE_DIR} -j ${N} --include=default_defines.hpp
|
||||||
--cppcheck-build-dir=cppcheck
|
--cppcheck-build-dir=cppcheck --check-level=exhaustive
|
||||||
-UJSON_CATCH_USER -UJSON_TRY_USER -UJSON_ASSERT -UJSON_INTERNAL_CATCH -UJSON_THROW
|
-UJSON_CATCH_USER -UJSON_TRY_USER -UJSON_ASSERT -UJSON_INTERNAL_CATCH -UJSON_THROW
|
||||||
-DJSON_HAS_CPP_11 -UJSON_HAS_CPP_14 -UJSON_HAS_CPP_17 -UJSON_HAS_CPP_20 -UJSON_HAS_THREE_WAY_COMPARISON
|
-DJSON_HAS_CPP_11 -UJSON_HAS_CPP_14 -UJSON_HAS_CPP_17 -UJSON_HAS_CPP_20 -UJSON_HAS_THREE_WAY_COMPARISON
|
||||||
COMMENT "Check code with Cppcheck"
|
COMMENT "Check code with Cppcheck"
|
||||||
@@ -497,6 +395,34 @@ add_custom_target(ci_cpplint
|
|||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Check code with OCLint.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
file(COPY ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp DESTINATION ${PROJECT_BINARY_DIR}/src_single)
|
||||||
|
file(RENAME ${PROJECT_BINARY_DIR}/src_single/json.hpp ${PROJECT_BINARY_DIR}/src_single/all.cpp)
|
||||||
|
file(APPEND "${PROJECT_BINARY_DIR}/src_single/all.cpp" "\n\nint main()\n{}\n")
|
||||||
|
|
||||||
|
add_executable(single_all ${PROJECT_BINARY_DIR}/src_single/all.cpp)
|
||||||
|
target_compile_features(single_all PRIVATE cxx_std_11)
|
||||||
|
|
||||||
|
add_custom_target(ci_oclint
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
-DJSON_BuildTests=OFF -DJSON_CI=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_oclint
|
||||||
|
COMMAND ${OCLINT_TOOL} -i ${PROJECT_BINARY_DIR}/build_oclint/src_single/all.cpp -p ${PROJECT_BINARY_DIR}/build_oclint --
|
||||||
|
-report-type html -enable-global-analysis --max-priority-1=0 --max-priority-2=1000 --max-priority-3=2000
|
||||||
|
--disable-rule=MultipleUnaryOperator
|
||||||
|
--disable-rule=DoubleNegative
|
||||||
|
--disable-rule=ShortVariableName
|
||||||
|
--disable-rule=GotoStatement
|
||||||
|
--disable-rule=LongLine
|
||||||
|
-o ${PROJECT_BINARY_DIR}/build_oclint/oclint_report.html
|
||||||
|
COMMENT "Check code with OCLint"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Check code with Clang-Tidy.
|
# Check code with Clang-Tidy.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -511,16 +437,29 @@ add_custom_target(ci_clang_tidy
|
|||||||
COMMENT "Check code with Clang-Tidy"
|
COMMENT "Check code with Clang-Tidy"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Check code with PVS-Studio Analyzer <https://www.viva64.com/en/pvs-studio/>.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
add_custom_target(ci_pvs_studio
|
||||||
|
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
-DJSON_BuildTests=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_pvs_studio
|
||||||
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_pvs_studio && ${PVS_STUDIO_ANALYZER_TOOL} analyze -j 10
|
||||||
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_pvs_studio && ${PLOG_CONVERTER_TOOL} -a'GA:1,2;64:1;CS' -t fullhtml PVS-Studio.log -o pvs
|
||||||
|
COMMENT "Check code with PVS Studio"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Check code with Infer <https://fbinfer.com> static analyzer.
|
# Check code with Infer <https://fbinfer.com> static analyzer.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# .inferconfig (repository root) pins --fail-on-issue and the currently-triaged issue types that
|
|
||||||
# are disabled until they are addressed separately; see #5715 item 4b.
|
|
||||||
add_custom_target(ci_infer
|
add_custom_target(ci_infer
|
||||||
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_infer
|
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_infer
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_infer && ${INFER_TOOL} compile -- ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${PROJECT_SOURCE_DIR} -DJSON_BuildTests=ON
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_infer && ${INFER_TOOL} compile -- ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${PROJECT_SOURCE_DIR} -DJSON_BuildTests=ON
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_infer && ${INFER_TOOL} run --project-root ${PROJECT_SOURCE_DIR} -- make
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_infer && ${INFER_TOOL} run -- make
|
||||||
COMMENT "Check code with Infer"
|
COMMENT "Check code with Infer"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -530,7 +469,7 @@ add_custom_target(ci_infer
|
|||||||
|
|
||||||
add_custom_target(ci_offline_testdata
|
add_custom_target(ci_offline_testdata
|
||||||
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data
|
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data && ${GIT_TOOL} clone -c advice.detachedHead=false --branch v3.2.0 https://github.com/nlohmann/json_test_data.git --quiet --depth 1
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data && ${GIT_TOOL} clone -c advice.detachedHead=false --branch v3.1.0 https://github.com/nlohmann/json_test_data.git --quiet --depth 1
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_TestDataDirectory=${PROJECT_BINARY_DIR}/build_offline_testdata/test_data/json_test_data
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_TestDataDirectory=${PROJECT_BINARY_DIR}/build_offline_testdata/test_data/json_test_data
|
||||||
@@ -576,13 +515,7 @@ add_custom_target(ci_reproducible_tests
|
|||||||
# be compiled individually.
|
# be compiled individually.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
set(iwyu_options -Xiwyu --error -Xiwyu --max_line_length=300)
|
set(iwyu_path_and_options ${IWYU_TOOL} -Xiwyu --max_line_length=300)
|
||||||
set(iwyu_path_and_options ${IWYU_TOOL} ${iwyu_options})
|
|
||||||
|
|
||||||
# CMake needs to know the exact flags used to compile each src_single/*.cpp below to hand them to
|
|
||||||
# iwyu_tool.py; JSON_CI already implies a from-scratch configure, so enabling this project-wide has
|
|
||||||
# no downside here.
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
foreach(SRC_FILE ${SRC_FILES})
|
foreach(SRC_FILE ${SRC_FILES})
|
||||||
# get relative path of the header file
|
# get relative path of the header file
|
||||||
@@ -596,40 +529,15 @@ 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")
|
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}")
|
||||||
# see below: report json.hpp's diagnostics without --error, so they do not fail the build
|
# remember binary for ci_single_binaries target
|
||||||
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${IWYU_TOOL} -Xiwyu --max_line_length=300)
|
|
||||||
else()
|
|
||||||
set_property(TARGET single_${RELATIVE_SRC_FILE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}")
|
|
||||||
endif()
|
|
||||||
# remember binary for ci_single_binaries
|
|
||||||
list(APPEND single_binaries single_${RELATIVE_SRC_FILE})
|
list(APPEND single_binaries single_${RELATIVE_SRC_FILE})
|
||||||
# json.hpp pulls together the whole library behind heavily templated, SFINAE-based code, and
|
|
||||||
# IWYU's suggestion for its one truly ambiguous symbol (a container-comparison "swap,
|
|
||||||
# operator!=") is not deterministic between runs (observed <set>, <unordered_map>, and <map>
|
|
||||||
# for the exact same source across otherwise-identical local and containerized builds). Keep
|
|
||||||
# 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
|
|
||||||
# nondeterministic suggestion for a header that already re-exports everything on purpose.
|
|
||||||
if(NOT RELATIVE_SRC_FILE STREQUAL "json")
|
|
||||||
list(APPEND single_binaries_tus src_single/${RELATIVE_SRC_FILE}.cpp)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(IWYU_TOOL_PY)
|
add_custom_target(ci_single_binaries
|
||||||
add_custom_target(ci_single_binaries
|
DEPENDS ${single_binaries}
|
||||||
DEPENDS ${single_binaries}
|
COMMENT "Check if headers are self-contained"
|
||||||
COMMAND ${IWYU_TOOL_PY} -p ${PROJECT_BINARY_DIR} ${single_binaries_tus} -- ${iwyu_options}
|
)
|
||||||
COMMENT "Check if headers are self-contained"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
# iwyu_tool.py (ships with IWYU, e.g. as /usr/bin/iwyu_tool on Debian/Ubuntu) was not found;
|
|
||||||
# fall back to building the self-containment check without enforcing the IWYU findings.
|
|
||||||
add_custom_target(ci_single_binaries
|
|
||||||
DEPENDS ${single_binaries}
|
|
||||||
COMMENT "Check if headers are self-contained"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Benchmarks
|
# Benchmarks
|
||||||
@@ -638,7 +546,7 @@ endif()
|
|||||||
add_custom_target(ci_benchmarks
|
add_custom_target(ci_benchmarks
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Release -GNinja
|
-DCMAKE_BUILD_TYPE=Release -GNinja
|
||||||
-S${PROJECT_SOURCE_DIR}/tests/benchmarks -B${PROJECT_BINARY_DIR}/build_benchmarks
|
-S${PROJECT_SOURCE_DIR}/benchmarks -B${PROJECT_BINARY_DIR}/build_benchmarks
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_benchmarks --target json_benchmarks
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_benchmarks --target json_benchmarks
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_benchmarks && ./json_benchmarks
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_benchmarks && ./json_benchmarks
|
||||||
COMMENT "Run benchmarks"
|
COMMENT "Run benchmarks"
|
||||||
@@ -651,46 +559,21 @@ add_custom_target(ci_benchmarks
|
|||||||
# we test the project with different CMake versions:
|
# we test the project with different CMake versions:
|
||||||
# - CMake 3.5 (the earliest supported)
|
# - CMake 3.5 (the earliest supported)
|
||||||
# - CMake 3.31.6 (the latest 3.x release)
|
# - CMake 3.31.6 (the latest 3.x release)
|
||||||
# - CMake 4.0.0 (the first 4.x release)
|
# - CMake 4.0.0 (the latest release)
|
||||||
# - the CMake version running this build (usually the latest release)
|
|
||||||
|
|
||||||
function(ci_get_cmake version var)
|
function(ci_get_cmake version var)
|
||||||
set(${var} ${PROJECT_BINARY_DIR}/cmake-${version}/bin/cmake)
|
set(${var} ${PROJECT_BINARY_DIR}/cmake-${version}/bin/cmake)
|
||||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
|
add_custom_command(
|
||||||
# Kitware publishes a prebuilt Linux x86_64 archive for every release; unpacking it is far
|
OUTPUT ${${var}}
|
||||||
# cheaper than compiling all of CMake (including its own test helpers) from source.
|
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}.tar.gz
|
||||||
add_custom_command(
|
COMMAND tar xfz cmake-${version}.tar.gz
|
||||||
OUTPUT ${${var}}
|
COMMAND rm cmake-${version}.tar.gz
|
||||||
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-linux-x86_64.tar.gz
|
# -DCMAKE_POLICY_VERSION_MINIMUM=3.5 required to compile older CMake versions with CMake 4.0.0
|
||||||
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-SHA-256.txt
|
COMMAND cmake -S cmake-${version} -B cmake-${version} -DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||||
# verify the archive against Kitware's published SHA-256 sums before unpacking it; old
|
COMMAND cmake --build cmake-${version} --parallel 10
|
||||||
# releases list the archive as "Linux-x86_64", so match case-insensitively and rewrite
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
# the name to the lowercase one the download was saved under
|
COMMENT "Download CMake ${version}"
|
||||||
COMMAND sh -c "grep -i ' cmake-${version}-linux-x86_64[.]tar[.]gz$' cmake-${version}-SHA-256.txt | tr L l | sha256sum -c -"
|
)
|
||||||
# unpack into cmake-${version} directly, as the archive's top-level directory is spelled
|
|
||||||
# "Linux" in old releases and "linux" in newer ones
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E rm -rf cmake-${version}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory cmake-${version}
|
|
||||||
COMMAND tar xfz cmake-${version}-linux-x86_64.tar.gz -C cmake-${version} --strip-components=1
|
|
||||||
COMMAND rm cmake-${version}-linux-x86_64.tar.gz cmake-${version}-SHA-256.txt
|
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
|
||||||
COMMENT "Download prebuilt CMake ${version}"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
# no prebuilt archive for this platform (e.g. macOS or Linux aarch64): build from source
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${${var}}
|
|
||||||
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}.tar.gz
|
|
||||||
COMMAND tar xfz cmake-${version}.tar.gz
|
|
||||||
COMMAND rm cmake-${version}.tar.gz
|
|
||||||
# -DCMAKE_POLICY_VERSION_MINIMUM=3.5 required to compile older CMake versions with CMake 4.0.0
|
|
||||||
COMMAND cmake -S cmake-${version} -B cmake-${version} -DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
|
||||||
COMMAND cmake --build cmake-${version} --parallel 10
|
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
|
||||||
COMMENT "Download and build CMake ${version} from source"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set(${var} ${${var}} PARENT_SCOPE)
|
set(${var} ${${var}} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@@ -700,24 +583,30 @@ 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_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind
|
JSON_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind)
|
||||||
JSON_StrictNulHandling)
|
set(JSON_CMAKE_FLAGS_3_31_6 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_31_6})
|
||||||
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})
|
||||||
|
|
||||||
function(ci_add_cmake_flags_targets flag min_version)
|
function(ci_add_cmake_flags_targets flag min_version)
|
||||||
string(TOLOWER "ci_cmake_flag_${flag}" flag_target)
|
string(TOLOWER "ci_cmake_flag_${flag}" flag_target)
|
||||||
string(REPLACE . _ min_version_var ${min_version})
|
string(REPLACE . _ min_version_var ${min_version})
|
||||||
set(cmake_binary ${CMAKE_${min_version_var}_BINARY})
|
set(cmake_binary ${CMAKE_${min_version_var}_BINARY})
|
||||||
|
add_custom_target(${flag_target}_${min_version}_2
|
||||||
|
COMMENT "Check CMake flag ${flag} (CMake ${CMAKE_VERSION})"
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-Werror=dev
|
||||||
|
-D${flag}=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_${flag_target}
|
||||||
|
)
|
||||||
add_custom_target(${flag_target}_${min_version_var}
|
add_custom_target(${flag_target}_${min_version_var}
|
||||||
COMMENT "Check CMake flag ${flag} (CMake ${min_version})"
|
COMMENT "Check CMake flag ${JSON_CMAKE_FLAG} (CMake ${min_version})"
|
||||||
COMMAND mkdir -pv ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var}
|
COMMAND mkdir -pv ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var}
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var}
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var}
|
||||||
&& ${cmake_binary} -Werror=dev ${PROJECT_SOURCE_DIR} -D${flag}=ON
|
&& ${cmake_binary} -Werror=dev ${PROJECT_SOURCE_DIR} -D${flag}=ON
|
||||||
DEPENDS ${cmake_binary}
|
DEPENDS ${cmake_binary}
|
||||||
)
|
)
|
||||||
list(APPEND JSON_CMAKE_FLAG_TARGETS ${flag_target}_${min_version_var})
|
list(APPEND JSON_CMAKE_FLAG_TARGETS ${JSON_CMAKE_FLAG_TARGET} ${flag_target}_${min_version_var})
|
||||||
list(APPEND JSON_CMAKE_FLAG_BUILD_DIRS ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var})
|
list(APPEND JSON_CMAKE_FLAG_BUILD_DIRS ${PROJECT_BINARY_DIR}/build_${flag_target} ${PROJECT_BINARY_DIR}/build_${flag_target}_${min_version_var})
|
||||||
set(JSON_CMAKE_FLAG_TARGETS ${JSON_CMAKE_FLAG_TARGETS} PARENT_SCOPE)
|
set(JSON_CMAKE_FLAG_TARGETS ${JSON_CMAKE_FLAG_TARGETS} PARENT_SCOPE)
|
||||||
set(JSON_CMAKE_FLAG_BUILD_DIRS ${JSON_CMAKE_FLAG_BUILD_DIRS} PARENT_SCOPE)
|
set(JSON_CMAKE_FLAG_BUILD_DIRS ${JSON_CMAKE_FLAG_BUILD_DIRS} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
@@ -734,20 +623,6 @@ foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_4_0_0})
|
|||||||
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 4.0.0)
|
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 4.0.0)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# check the same flags with the CMake version running this build
|
|
||||||
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_4_0_0})
|
|
||||||
string(TOLOWER "ci_cmake_flag_${JSON_CMAKE_FLAG}" flag_target)
|
|
||||||
add_custom_target(${flag_target}
|
|
||||||
COMMENT "Check CMake flag ${JSON_CMAKE_FLAG} (CMake ${CMAKE_VERSION})"
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-Werror=dev
|
|
||||||
-D${JSON_CMAKE_FLAG}=ON
|
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_${flag_target}
|
|
||||||
)
|
|
||||||
list(APPEND JSON_CMAKE_FLAG_TARGETS ${flag_target})
|
|
||||||
list(APPEND JSON_CMAKE_FLAG_BUILD_DIRS ${PROJECT_BINARY_DIR}/build_${flag_target})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_custom_target(ci_cmake_flags
|
add_custom_target(ci_cmake_flags
|
||||||
DEPENDS ${JSON_CMAKE_FLAG_TARGETS}
|
DEPENDS ${JSON_CMAKE_FLAG_TARGETS}
|
||||||
COMMENT "Check CMake flags"
|
COMMENT "Check CMake flags"
|
||||||
@@ -901,17 +776,11 @@ add_custom_target(ci_test_build_documentation
|
|||||||
COMMENT "Build the documentation"
|
COMMENT "Build the documentation"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(ci_test_documentation_mermaid
|
|
||||||
COMMAND make check_mermaid
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs/mkdocs
|
|
||||||
COMMENT "Check the Mermaid diagrams of the documentation"
|
|
||||||
)
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Clean up all generated files.
|
# Clean up all generated files.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_clean
|
add_custom_target(ci_clean
|
||||||
COMMAND rm -fr ${PROJECT_BINARY_DIR}/build_* ${PROJECT_BINARY_DIR}/cmake-3.5.0 ${PROJECT_BINARY_DIR}/cmake-3.31.6 ${PROJECT_BINARY_DIR}/cmake-4.0.0 ${JSON_CMAKE_FLAG_BUILD_DIRS} ${single_binaries}
|
COMMAND rm -fr ${PROJECT_BINARY_DIR}/build_* cmake-3.5.0-Darwin64 ${JSON_CMAKE_FLAG_BUILD_DIRS} ${single_binaries}
|
||||||
COMMENT "Clean generated directories"
|
COMMENT "Clean generated directories"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
# -Wno-c++98-compat The library targets C++11.
|
# -Wno-c++98-compat The library targets C++11.
|
||||||
# -Wno-c++98-compat-pedantic The library targets C++11.
|
# -Wno-c++98-compat-pedantic The library targets C++11.
|
||||||
# -Wno-deprecated-declarations The library contains annotations for deprecated functions.
|
# -Wno-deprecated-declarations The library contains annotations for deprecated functions.
|
||||||
|
# -Wno-extra-semi-stmt The library uses assert which triggers this warning.
|
||||||
# -Wno-padded We do not care about padding warnings.
|
# -Wno-padded We do not care about padding warnings.
|
||||||
# -Wno-covered-switch-default All switches list all cases and a default case.
|
# -Wno-covered-switch-default All switches list all cases and a default case.
|
||||||
# -Wno-c2y-extensions Clang 22.1 diagnoses __COUNTER__ as a C2y extension, also in
|
|
||||||
# C++ mode. The library does not use __COUNTER__; the warnings
|
|
||||||
# all come from vendored Doctest (SECTION/TEST_CASE macros).
|
|
||||||
# -Wno-unsafe-buffer-usage Pervasive: the library's own low-level numeric/buffer code
|
# -Wno-unsafe-buffer-usage Pervasive: the library's own low-level numeric/buffer code
|
||||||
# (to_chars, serializer, lexer, binary reader/writer, input
|
# (to_chars, serializer, lexer, binary reader/writer, input
|
||||||
# adapters, json_pointer) plus vendored Doctest itself (~208
|
# adapters, json_pointer) plus vendored Doctest itself (~208
|
||||||
@@ -19,8 +17,8 @@ set(CLANG_CXXFLAGS
|
|||||||
-Wno-c++98-compat
|
-Wno-c++98-compat
|
||||||
-Wno-c++98-compat-pedantic
|
-Wno-c++98-compat-pedantic
|
||||||
-Wno-deprecated-declarations
|
-Wno-deprecated-declarations
|
||||||
|
-Wno-extra-semi-stmt
|
||||||
-Wno-padded
|
-Wno-padded
|
||||||
-Wno-covered-switch-default
|
-Wno-covered-switch-default
|
||||||
-Wno-c2y-extensions
|
|
||||||
-Wno-unsafe-buffer-usage
|
-Wno-unsafe-buffer-usage
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
|
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
|
||||||
set(JSON_TEST_DATA_VERSION 3.2.0)
|
set(JSON_TEST_DATA_VERSION 3.1.0)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ if(CMAKE_CROSSCOMPILING)
|
|||||||
endif()
|
endif()
|
||||||
if(NOT DEFINED LIBCPP_VERSION_OUTPUT_CACHED)
|
if(NOT DEFINED LIBCPP_VERSION_OUTPUT_CACHED)
|
||||||
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||||
"${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_CURRENT_LIST_DIR}/detect_libcpp_version.cpp"
|
"${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/cmake/detect_libcpp_version.cpp"
|
||||||
RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT
|
RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT
|
||||||
COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT
|
COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT
|
||||||
)
|
)
|
||||||
|
|||||||
+13
-23
@@ -1,4 +1,4 @@
|
|||||||
# Warning flags determined for GCC 16.2.0 with https://github.com/nlohmann/gcc_flags:
|
# Warning flags determined for GCC 15.1.0 with https://github.com/nlohmann/gcc_flags:
|
||||||
# Ignored GCC warnings:
|
# Ignored GCC warnings:
|
||||||
# -Wno-abi-tag We do not care about ABI tags.
|
# -Wno-abi-tag We do not care about ABI tags.
|
||||||
# -Wno-aggregate-return The library uses aggregate returns.
|
# -Wno-aggregate-return The library uses aggregate returns.
|
||||||
@@ -16,8 +16,6 @@ set(GCC_CXXFLAGS
|
|||||||
--extra-warnings
|
--extra-warnings
|
||||||
-W
|
-W
|
||||||
-WNSObject-attribute
|
-WNSObject-attribute
|
||||||
-Wabbreviated-auto-in-template-arg
|
|
||||||
-Wabi
|
|
||||||
-Wno-abi-tag
|
-Wno-abi-tag
|
||||||
-Waddress
|
-Waddress
|
||||||
-Waddress-of-packed-member
|
-Waddress-of-packed-member
|
||||||
@@ -66,7 +64,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wanalyzer-tainted-divisor
|
-Wanalyzer-tainted-divisor
|
||||||
-Wanalyzer-tainted-offset
|
-Wanalyzer-tainted-offset
|
||||||
-Wanalyzer-tainted-size
|
-Wanalyzer-tainted-size
|
||||||
-Wanalyzer-throw-of-unexpected-type
|
|
||||||
-Wanalyzer-too-complex
|
-Wanalyzer-too-complex
|
||||||
-Wanalyzer-undefined-behavior-ptrdiff
|
-Wanalyzer-undefined-behavior-ptrdiff
|
||||||
-Wanalyzer-undefined-behavior-strtok
|
-Wanalyzer-undefined-behavior-strtok
|
||||||
@@ -83,13 +80,10 @@ set(GCC_CXXFLAGS
|
|||||||
-Warith-conversion
|
-Warith-conversion
|
||||||
-Warray-bounds=2
|
-Warray-bounds=2
|
||||||
-Warray-compare
|
-Warray-compare
|
||||||
-Warray-parameter
|
|
||||||
-Warray-parameter=2
|
-Warray-parameter=2
|
||||||
-Wattribute-alias=2
|
-Wattribute-alias=2
|
||||||
-Wattribute-warning
|
-Wattribute-warning
|
||||||
-Wattributes
|
-Wattributes
|
||||||
-Wauto-profile
|
|
||||||
-Wbidi-chars=any
|
|
||||||
-Wbool-compare
|
-Wbool-compare
|
||||||
-Wbool-operation
|
-Wbool-operation
|
||||||
-Wbuiltin-declaration-mismatch
|
-Wbuiltin-declaration-mismatch
|
||||||
@@ -105,7 +99,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wc++20-compat
|
-Wc++20-compat
|
||||||
-Wc++20-extensions
|
-Wc++20-extensions
|
||||||
-Wc++23-extensions
|
-Wc++23-extensions
|
||||||
-Wc++26-compat
|
|
||||||
-Wc++26-extensions
|
-Wc++26-extensions
|
||||||
-Wc++2a-compat
|
-Wc++2a-compat
|
||||||
-Wcalloc-transposed-args
|
-Wcalloc-transposed-args
|
||||||
@@ -149,7 +142,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wdeprecated-enum-enum-conversion
|
-Wdeprecated-enum-enum-conversion
|
||||||
-Wdeprecated-enum-float-conversion
|
-Wdeprecated-enum-float-conversion
|
||||||
-Wdeprecated-literal-operator
|
-Wdeprecated-literal-operator
|
||||||
-Wdeprecated-openmp
|
|
||||||
-Wdeprecated-variadic-comma-omission
|
-Wdeprecated-variadic-comma-omission
|
||||||
-Wdisabled-optimization
|
-Wdisabled-optimization
|
||||||
-Wdiv-by-zero
|
-Wdiv-by-zero
|
||||||
@@ -164,17 +156,21 @@ set(GCC_CXXFLAGS
|
|||||||
-Wenum-conversion
|
-Wenum-conversion
|
||||||
-Wexceptions
|
-Wexceptions
|
||||||
-Wexpansion-to-defined
|
-Wexpansion-to-defined
|
||||||
-Wexpose-global-module-tu-local
|
|
||||||
-Wexternal-tu-local
|
|
||||||
-Wextra
|
-Wextra
|
||||||
-Wextra-semi
|
-Wextra-semi
|
||||||
-Wflex-array-member-not-at-end
|
-Wflex-array-member-not-at-end
|
||||||
-Wfloat-conversion
|
-Wfloat-conversion
|
||||||
-Wfloat-equal
|
-Wfloat-equal
|
||||||
-Wformat-diag
|
-Wformat -Wformat-contains-nul
|
||||||
-Wformat-overflow=2
|
-Wformat -Wformat-diag
|
||||||
-Wformat-signedness
|
-Wformat -Wformat-extra-args
|
||||||
-Wformat-truncation=2
|
-Wformat -Wformat-nonliteral
|
||||||
|
-Wformat -Wformat-overflow=2
|
||||||
|
-Wformat -Wformat-security
|
||||||
|
-Wformat -Wformat-signedness
|
||||||
|
-Wformat -Wformat-truncation=2
|
||||||
|
-Wformat -Wformat-y2k
|
||||||
|
-Wformat -Wformat-zero-length
|
||||||
-Wformat=2
|
-Wformat=2
|
||||||
-Wframe-address
|
-Wframe-address
|
||||||
-Wfree-nonheap-object
|
-Wfree-nonheap-object
|
||||||
@@ -201,8 +197,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Winvalid-offsetof
|
-Winvalid-offsetof
|
||||||
-Winvalid-pch
|
-Winvalid-pch
|
||||||
-Winvalid-utf8
|
-Winvalid-utf8
|
||||||
-Wkeyword-macro
|
|
||||||
-Wleading-whitespace=spaces
|
|
||||||
-Wliteral-suffix
|
-Wliteral-suffix
|
||||||
-Wlogical-not-parentheses
|
-Wlogical-not-parentheses
|
||||||
-Wlogical-op
|
-Wlogical-op
|
||||||
@@ -233,7 +227,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wnarrowing
|
-Wnarrowing
|
||||||
-Wnoexcept
|
-Wnoexcept
|
||||||
-Wnoexcept-type
|
-Wnoexcept-type
|
||||||
-Wnon-c-typedef-for-linkage
|
|
||||||
-Wnon-template-friend
|
-Wnon-template-friend
|
||||||
-Wnon-virtual-dtor
|
-Wnon-virtual-dtor
|
||||||
-Wnonnull
|
-Wnonnull
|
||||||
@@ -276,8 +269,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wscalar-storage-order
|
-Wscalar-storage-order
|
||||||
-Wself-move
|
-Wself-move
|
||||||
-Wsequence-point
|
-Wsequence-point
|
||||||
-Wsfinae-incomplete
|
|
||||||
-Wsfinae-incomplete=2
|
|
||||||
-Wshadow=compatible-local
|
-Wshadow=compatible-local
|
||||||
-Wshadow=global
|
-Wshadow=global
|
||||||
-Wshadow=local
|
-Wshadow=local
|
||||||
@@ -298,7 +289,6 @@ set(GCC_CXXFLAGS
|
|||||||
-Wstrict-aliasing=3
|
-Wstrict-aliasing=3
|
||||||
-Wstrict-null-sentinel
|
-Wstrict-null-sentinel
|
||||||
-Wstrict-overflow
|
-Wstrict-overflow
|
||||||
-Wstrict-overflow=5
|
|
||||||
-Wstring-compare
|
-Wstring-compare
|
||||||
-Wstringop-overflow
|
-Wstringop-overflow
|
||||||
-Wstringop-overflow=4
|
-Wstringop-overflow=4
|
||||||
@@ -343,8 +333,8 @@ set(GCC_CXXFLAGS
|
|||||||
-Wunreachable-code
|
-Wunreachable-code
|
||||||
-Wunsafe-loop-optimizations
|
-Wunsafe-loop-optimizations
|
||||||
-Wunused
|
-Wunused
|
||||||
-Wunused-but-set-parameter=3
|
-Wunused-but-set-parameter
|
||||||
-Wunused-but-set-variable=3
|
-Wunused-but-set-variable
|
||||||
-Wunused-const-variable=2
|
-Wunused-const-variable=2
|
||||||
-Wunused-function
|
-Wunused-function
|
||||||
-Wunused-label
|
-Wunused-label
|
||||||
|
|||||||
@@ -1,57 +1,24 @@
|
|||||||
# generate Bazel BUILD file
|
# generate Bazel BUILD file
|
||||||
#
|
|
||||||
# usage: cmake -P cmake/scripts/gen_bazel_build_file.cmake (or: make BUILD.bazel)
|
|
||||||
#
|
|
||||||
# The header list of the "json" target is derived from the files in include/. Everything else is fixed text below,
|
|
||||||
# so edit this script rather than BUILD.bazel.
|
|
||||||
|
|
||||||
get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
|
set(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")
|
||||||
set(BUILD_FILE "${PROJECT_ROOT}/BUILD.bazel")
|
set(BUILD_FILE "${PROJECT_ROOT}/BUILD.bazel")
|
||||||
|
|
||||||
file(GLOB_RECURSE HEADERS LIST_DIRECTORIES false RELATIVE "${PROJECT_ROOT}" "${PROJECT_ROOT}/include/*.hpp")
|
file(GLOB_RECURSE HEADERS LIST_DIRECTORIES false RELATIVE "${PROJECT_ROOT}" "include/*.hpp")
|
||||||
list(SORT HEADERS)
|
|
||||||
|
|
||||||
set(CONTENT [=[
|
|
||||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
|
||||||
load("@rules_license//rules:license.bzl", "license")
|
|
||||||
|
|
||||||
package(
|
|
||||||
default_applicable_licenses = [":license"],
|
|
||||||
)
|
|
||||||
|
|
||||||
exports_files([
|
|
||||||
"LICENSE.MIT",
|
|
||||||
])
|
|
||||||
|
|
||||||
license(
|
|
||||||
name = "license",
|
|
||||||
license_kinds = ["@rules_license//licenses/spdx:MIT"],
|
|
||||||
license_text = "LICENSE.MIT",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
file(WRITE "${BUILD_FILE}" [=[
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "json",
|
name = "json",
|
||||||
hdrs = [
|
hdrs = [
|
||||||
]=])
|
]=])
|
||||||
|
|
||||||
foreach(header ${HEADERS})
|
foreach(header ${HEADERS})
|
||||||
string(APPEND CONTENT " \"${header}\",\n")
|
file(APPEND "${BUILD_FILE}" " \"${header}\",\n")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
string(APPEND CONTENT [=[
|
file(APPEND "${BUILD_FILE}" [=[
|
||||||
],
|
],
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
alwayslink = True,
|
||||||
|
|
||||||
cc_library(
|
|
||||||
name = "singleheader-json",
|
|
||||||
hdrs = [
|
|
||||||
"single_include/nlohmann/json.hpp",
|
|
||||||
],
|
|
||||||
includes = ["single_include"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
)
|
||||||
]=])
|
]=])
|
||||||
|
|
||||||
file(WRITE "${BUILD_FILE}" "${CONTENT}")
|
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
# Shared extractor for the JSON_HEDLEY_* macro names defined in hedley.hpp.
|
|
||||||
#
|
|
||||||
# Every macro that hedley.hpp #defines must be #undef-ed again once json.hpp
|
|
||||||
# has been fully processed (see include/nlohmann/detail/macro_unscope.hpp
|
|
||||||
# and https://github.com/nlohmann/json/issues/5408). Deriving the macro list
|
|
||||||
# straight from hedley.hpp here -- instead of hand-maintaining it in two
|
|
||||||
# places -- means hedley_undef.hpp and the regression test that checks for
|
|
||||||
# leaked macros can never drift apart, even after a future `make
|
|
||||||
# update_hedley` pulls in new macros from upstream Hedley.
|
|
||||||
#
|
|
||||||
# MODE=undef (default): write hedley_undef.hpp (SPDX header, #pragma once,
|
|
||||||
# one #undef per macro name) -- used by `make update_hedley_undef`
|
|
||||||
# MODE=checks: write one #ifdef/FAIL_CHECK/#endif per macro name,
|
|
||||||
# meant to be #include-d inside a TEST_CASE -- used by
|
|
||||||
# tests/CMakeLists.txt to (re)generate the include for
|
|
||||||
# tests/src/unit-no-macro-leak.cpp
|
|
||||||
#
|
|
||||||
# Required variables:
|
|
||||||
# HEDLEY_HPP path to include/nlohmann/thirdparty/hedley/hedley.hpp
|
|
||||||
# OUTPUT path of the file to (over)write
|
|
||||||
# Optional:
|
|
||||||
# MODE "undef" (default) or "checks"
|
|
||||||
|
|
||||||
if(NOT DEFINED HEDLEY_HPP OR NOT DEFINED OUTPUT)
|
|
||||||
message(FATAL_ERROR "HEDLEY_HPP and OUTPUT must be set")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS "${HEDLEY_HPP}")
|
|
||||||
message(FATAL_ERROR "Hedley header not found: ${HEDLEY_HPP}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED MODE)
|
|
||||||
set(MODE undef)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT MODE STREQUAL "undef" AND NOT MODE STREQUAL "checks")
|
|
||||||
message(FATAL_ERROR "MODE must be undef or checks, got: ${MODE}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Line-anchored, like `grep -oE "^[[:blank:]]*#[[:blank:]]*define[[:blank:]]+JSON_HEDLEY_[A-Za-z0-9_]+"`.
|
|
||||||
# Unanchored matching would also pick up JSON_HEDLEY_* mentions inside
|
|
||||||
# comments or string literals elsewhere in the file, which must not turn
|
|
||||||
# into #undef lines.
|
|
||||||
file(STRINGS "${HEDLEY_HPP}" hedley_lines)
|
|
||||||
set(macro_names)
|
|
||||||
foreach(line IN LISTS hedley_lines)
|
|
||||||
if("${line}" MATCHES "^[ \t]*#[ \t]*define[ \t]+(JSON_HEDLEY_[A-Za-z0-9_]+)")
|
|
||||||
list(APPEND macro_names "${CMAKE_MATCH_1}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if(NOT macro_names)
|
|
||||||
message(FATAL_ERROR "No JSON_HEDLEY_* macros found in ${HEDLEY_HPP}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES macro_names)
|
|
||||||
# Lexicographic, locale-independent (ASCII-only names) -- matches `LC_ALL=C sort`.
|
|
||||||
list(SORT macro_names COMPARE STRING)
|
|
||||||
list(LENGTH macro_names macro_count)
|
|
||||||
|
|
||||||
set(generated "")
|
|
||||||
if(MODE STREQUAL "undef")
|
|
||||||
# Same banner `make update_hedley_undef` would stamp by hand, so the
|
|
||||||
# recipe is self-contained and its output is byte-stable across reruns.
|
|
||||||
# The embedded SPDX tags below are part of the *generated* file's
|
|
||||||
# content, not a REUSE header for this .cmake script itself (which is
|
|
||||||
# already covered by the blanket "Files: *" rule in .reuse/dep5) -- keep
|
|
||||||
# them wrapped in REUSE-IgnoreStart/End so `reuse lint` does not try to
|
|
||||||
# parse "MIT\n")" as this file's own SPDX-License-Identifier value.
|
|
||||||
# REUSE-IgnoreStart
|
|
||||||
string(APPEND generated "// __ _____ _____ _____\n")
|
|
||||||
string(APPEND generated "// __| | __| | | | JSON for Modern C++\n")
|
|
||||||
string(APPEND generated "// | | |__ | | | | | | version 3.12.0\n")
|
|
||||||
string(APPEND generated "// |_____|_____|_____|_|___| https://github.com/nlohmann/json\n")
|
|
||||||
string(APPEND generated "//\n")
|
|
||||||
string(APPEND generated "// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann <https://nlohmann.me>\n")
|
|
||||||
string(APPEND generated "// SPDX-License-Identifier: MIT\n")
|
|
||||||
# REUSE-IgnoreEnd
|
|
||||||
string(APPEND generated "\n")
|
|
||||||
string(APPEND generated "#pragma once\n")
|
|
||||||
string(APPEND generated "\n")
|
|
||||||
foreach(name IN LISTS macro_names)
|
|
||||||
string(APPEND generated "#undef ${name}\n")
|
|
||||||
endforeach()
|
|
||||||
else()
|
|
||||||
string(APPEND generated "// This file is generated by cmake/scripts/gen_hedley_undef_check.cmake\n")
|
|
||||||
string(APPEND generated "// from include/nlohmann/thirdparty/hedley/hedley.hpp. Do not edit it by\n")
|
|
||||||
string(APPEND generated "// hand -- it is regenerated on every build. ${macro_count} macros checked.\n\n")
|
|
||||||
foreach(name IN LISTS macro_names)
|
|
||||||
string(APPEND generated "#ifdef ${name}\n")
|
|
||||||
string(APPEND generated " FAIL_CHECK(\"${name} leaked after including nlohmann/json.hpp\");\n")
|
|
||||||
string(APPEND generated "#endif\n")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_filename_component(output_dir "${OUTPUT}" DIRECTORY)
|
|
||||||
if(output_dir)
|
|
||||||
file(MAKE_DIRECTORY "${output_dir}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Avoid rewriting the file (and busting downstream incremental rebuilds)
|
|
||||||
# when the content has not actually changed.
|
|
||||||
set(write_output TRUE)
|
|
||||||
if(EXISTS "${OUTPUT}")
|
|
||||||
file(READ "${OUTPUT}" existing_content)
|
|
||||||
if(existing_content STREQUAL generated)
|
|
||||||
set(write_output FALSE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(write_output)
|
|
||||||
file(WRITE "${OUTPUT}" "${generated}")
|
|
||||||
endif()
|
|
||||||
+7
-19
@@ -11,31 +11,20 @@ EXAMPLES = $(wildcard mkdocs/docs/examples/*.cpp)
|
|||||||
|
|
||||||
cxx_standard = $(lastword c++11 $(filter c++%, $(subst ., ,$1)))
|
cxx_standard = $(lastword c++11 $(filter c++%, $(subst ., ,$1)))
|
||||||
|
|
||||||
# common compile flags for the stand-alone example files
|
|
||||||
EXAMPLE_CPPFLAGS = -I $(SRCDIR) -DJSON_USE_GLOBAL_UDLS=0
|
|
||||||
EXAMPLE_WARNFLAGS = -Werror=deprecated-declarations
|
|
||||||
|
|
||||||
# examples that document deprecated API and are allowed to use it
|
|
||||||
DEPRECATED_EXAMPLES = $(addprefix mkdocs/docs/examples/, \
|
|
||||||
json_pointer__operator__equal_stringtype \
|
|
||||||
json_pointer__operator__notequal_stringtype \
|
|
||||||
json_pointer__operator_string_t)
|
|
||||||
$(DEPRECATED_EXAMPLES:=.output) $(DEPRECATED_EXAMPLES:=.test): EXAMPLE_WARNFLAGS = -Wno-deprecated-declarations
|
|
||||||
|
|
||||||
# create output from a stand-alone example file
|
# create output from a stand-alone example file
|
||||||
%.output: %.cpp
|
%.output: %.cpp
|
||||||
@echo "standard $(call cxx_standard,$(<:.cpp=))"
|
@echo "standard $(call cxx_standard $(<:.cpp=))"
|
||||||
$(MAKE) $(<:.cpp=) \
|
$(MAKE) $(<:.cpp=) \
|
||||||
CPPFLAGS="$(EXAMPLE_CPPFLAGS)" \
|
CPPFLAGS="-I $(SRCDIR) -DJSON_USE_GLOBAL_UDLS=0" \
|
||||||
CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) $(EXAMPLE_WARNFLAGS)"
|
CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) -Wno-deprecated-declarations"
|
||||||
./$(<:.cpp=) > $@
|
./$(<:.cpp=) > $@
|
||||||
rm $(<:.cpp=)
|
rm $(<:.cpp=)
|
||||||
|
|
||||||
# compare created output with current output of the example files
|
# compare created output with current output of the example files
|
||||||
%.test: %.cpp
|
%.test: %.cpp
|
||||||
$(MAKE) $(<:.cpp=) \
|
$(MAKE) $(<:.cpp=) \
|
||||||
CPPFLAGS="$(EXAMPLE_CPPFLAGS)" \
|
CPPFLAGS="-I $(SRCDIR) -DJSON_USE_GLOBAL_UDLS=0" \
|
||||||
CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) $(EXAMPLE_WARNFLAGS)"
|
CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) -Wno-deprecated-declarations"
|
||||||
./$(<:.cpp=) > $@
|
./$(<:.cpp=) > $@
|
||||||
diff $@ $(<:.cpp=.output)
|
diff $@ $(<:.cpp=.output)
|
||||||
rm $(<:.cpp=) $@
|
rm $(<:.cpp=) $@
|
||||||
@@ -46,10 +35,9 @@ create_output: $(EXAMPLES:.cpp=.output)
|
|||||||
# check output of all stand-alone example files
|
# check output of all stand-alone example files
|
||||||
check_output: $(EXAMPLES:.cpp=.test)
|
check_output: $(EXAMPLES:.cpp=.test)
|
||||||
|
|
||||||
# check output of all stand-alone example files (exclude files whose output depends on the platform by nature:
|
# check output of all stand-alone example files (exclude files with platform-dependent output.)
|
||||||
# library and compiler information, container size limits, and hash values)
|
|
||||||
# This target is used in the CI (ci_test_documentation).
|
# This target is used in the CI (ci_test_documentation).
|
||||||
check_output_portable: $(filter-out mkdocs/docs/examples/meta.test mkdocs/docs/examples/max_size.test mkdocs/docs/examples/std_hash.test,$(EXAMPLES:.cpp=.test))
|
check_output_portable: $(filter-out mkdocs/docs/examples/meta.test mkdocs/docs/examples/max_size.test mkdocs/docs/examples/std_hash.test mkdocs/docs/examples/basic_json__CompatibleType.test,$(EXAMPLES:.cpp=.test))
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fr $(EXAMPLES:.cpp=)
|
rm -fr $(EXAMPLES:.cpp=)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<key>dashIndexFilePath</key>
|
<key>dashIndexFilePath</key>
|
||||||
<string>index.html</string>
|
<string>index.html</string>
|
||||||
<key>DashDocSetFallbackURL</key>
|
<key>DashDocSetFallbackURL</key>
|
||||||
<string>https://json.nlohmann.me/</string>
|
<string>https://nlohmann.github.io/json/</string>
|
||||||
<key>isJavaScriptEnabled</key>
|
<key>isJavaScriptEnabled</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
+22
-12
@@ -52,25 +52,35 @@ 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
|
# list mkdocs pages missing from the docset index
|
||||||
.PHONY: list_missing_pages
|
.PHONY: list_missing_pages
|
||||||
list_missing_pages: docSet.dsidx
|
list_missing_pages: docSet.dsidx
|
||||||
@comm -23 <(echo '$(DOCSET_PAGE_PATHS)' | tr ' ' '\n') <(echo '$(DOCSET_INDEX_PATHS)' | tr ' ' '\n')
|
@for page in $(MKDOCS_PAGES); do \
|
||||||
|
case "$$page" in \
|
||||||
|
*/index.md) path=$${page/\/index.md/} ;; \
|
||||||
|
*) path=$${page/.md/} ;; \
|
||||||
|
esac; \
|
||||||
|
if [ "x$$page" != "xindex.md" -a "x$$(sqlite3 docSet.dsidx "SELECT COUNT(*) FROM searchIndex WHERE path='$$path/index.html'")" = "x0" ]; then \
|
||||||
|
echo $$page; \
|
||||||
|
fi \
|
||||||
|
done
|
||||||
|
|
||||||
# list paths in the docset index without a corresponding mkdocs page
|
# list paths in the docset index without a corresponding mkdocs page
|
||||||
.PHONY: list_removed_paths
|
.PHONY: list_removed_paths
|
||||||
list_removed_paths: docSet.dsidx
|
list_removed_paths: docSet.dsidx
|
||||||
@comm -13 <(echo '$(DOCSET_PAGE_PATHS)' | tr ' ' '\n') <(echo '$(DOCSET_INDEX_PATHS)' | tr ' ' '\n')
|
@for path in $$(sqlite3 docSet.dsidx "SELECT path FROM searchIndex"); do \
|
||||||
|
page=$${path/\/index.html/.md}; \
|
||||||
|
page_index=$${path/index.html/index.md}; \
|
||||||
|
page_found=0; \
|
||||||
|
for p in $(MKDOCS_PAGES); do \
|
||||||
|
if [ "x$$p" = "x$$page" -o "x$$p" = "x$$page_index" ]; then \
|
||||||
|
page_found=1; \
|
||||||
|
fi \
|
||||||
|
done; \
|
||||||
|
if [ "x$$page_found" = "x0" ]; then \
|
||||||
|
echo $$path; \
|
||||||
|
fi \
|
||||||
|
done
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -7,11 +7,10 @@ documentation browsers like [Dash](https://kapeli.com/dash), [Velocity](https://
|
|||||||
The docset can be created with
|
The docset can be created with
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make JSON_for_Modern_C++.docset
|
make nlohmann_json.docset
|
||||||
```
|
```
|
||||||
|
|
||||||
The generated folder `JSON_for_Modern_C++.docset` can then be opened in the documentation browser. `make all` builds a
|
The generated folder `nlohmann_json.docset` can then be opened in the documentation browser.
|
||||||
`JSON_for_Modern_C++.tgz` archive instead, and `make install_docset_zeal` installs the docset for Zeal directly.
|
|
||||||
|
|
||||||
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).
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,9 @@ INSERT INTO searchIndex(name, type, path) VALUES ('byte_container_with_subtype',
|
|||||||
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::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::clear_subtype', 'Method', 'api/byte_container_with_subtype/clear_subtype/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::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::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', 'Method', 'api/byte_container_with_subtype/subtype/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json', 'Class', 'api/basic_json/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::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', '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::array_t', 'Type', 'api/basic_json/array_t/index.html');
|
||||||
@@ -51,7 +48,6 @@ INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::from_bjdata', 'Fu
|
|||||||
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_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_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_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::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::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', 'Method', 'api/basic_json/get/index.html');
|
||||||
@@ -125,7 +121,6 @@ INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::to_bjdata', 'Func
|
|||||||
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_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_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_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_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::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', 'Method', 'api/basic_json/value/index.html');
|
||||||
@@ -135,19 +130,15 @@ INSERT INTO searchIndex(name, type, path) VALUES ('json', 'Class', 'api/json/ind
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer', 'Class', 'api/json_pointer/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::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::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::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_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_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_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/=', '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 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::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_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_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::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_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', 'Class', 'api/json_sax/index.html');
|
||||||
@@ -170,7 +161,6 @@ INSERT INTO searchIndex(name, type, path) VALUES ('operator<<', 'Operator', 'api
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('operator>>', 'Operator', 'api/operator_gtgt/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_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', 'Class', 'api/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::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');
|
INSERT INTO searchIndex(name, type, path) VALUES ('std::swap<basic_json>', 'Function', 'api/basic_json/std_swap/index.html');
|
||||||
|
|
||||||
@@ -181,7 +171,6 @@ INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats: BJData', 'Gui
|
|||||||
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: 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: 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: 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 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 ('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 ('Comments', 'Guide', 'features/comments/index.html');
|
||||||
@@ -203,82 +192,53 @@ INSERT INTO searchIndex(name, type, path) VALUES ('nlohmann Namespace', 'Guide',
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/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 ('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 ('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', '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: 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: 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: 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: 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 ('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 ('Specializing enum conversion', 'Guide', 'features/enum_conversion/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Supported Macros', 'Guide', 'features/macros/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Supported Macros', 'Guide', 'features/macros/index.html');
|
||||||
|
|
||||||
-- Macros
|
-- 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_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_CATCH_USER', 'Macro', 'api/macros/json_throw_user/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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_SKIP_UNSUPPORTED_COMPILER_CHECK', 'Macro', 'api/macros/json_skip_unsupported_compiler_check/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_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_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_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_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_LEGACY_DISCARDED_VALUE_COMPARISON', 'Macro', 'api/macros/json_use_legacy_discarded_value_comparison/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 ('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', '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', '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', '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', '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', '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', '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', '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', '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', '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_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_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_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', '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_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_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');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_PATCH', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
|
|||||||
+1
-12
@@ -1,8 +1,3 @@
|
|||||||
# The MkDocs 2.0 banners of Material for MkDocs and ProperDocs (via mkdocs-redirects) are printed to stderr, not
|
|
||||||
# logged, so they do not affect --strict; silence them anyway.
|
|
||||||
export NO_MKDOCS_2_WARNING := true
|
|
||||||
export DISABLE_MKDOCS_2_WARNING := true
|
|
||||||
|
|
||||||
# serve the site locally
|
# serve the site locally
|
||||||
serve: style_check
|
serve: style_check
|
||||||
venv/bin/mkdocs serve
|
venv/bin/mkdocs serve
|
||||||
@@ -13,17 +8,11 @@ serve_dirty: style_check
|
|||||||
# This target is used in the CI (ci_test_build_documentation).
|
# This target is used in the CI (ci_test_build_documentation).
|
||||||
# This target is used by the docset Makefile.
|
# This target is used by the docset Makefile.
|
||||||
build: style_check
|
build: style_check
|
||||||
venv/bin/mkdocs build --strict
|
venv/bin/mkdocs build
|
||||||
|
|
||||||
style_check:
|
style_check:
|
||||||
@cd docs ; ../venv/bin/python3 ../scripts/check_structure.py
|
@cd docs ; ../venv/bin/python3 ../scripts/check_structure.py
|
||||||
|
|
||||||
# check that all Mermaid diagrams parse (needs Node.js)
|
|
||||||
# This target is used in the CI (ci_test_documentation_mermaid).
|
|
||||||
check_mermaid:
|
|
||||||
npm ci --prefix scripts/mermaid --ignore-scripts --no-audit --no-fund
|
|
||||||
node scripts/mermaid/check_mermaid.mjs docs
|
|
||||||
|
|
||||||
# check the links in the documentation files in docs/mkdocs
|
# check the links in the documentation files in docs/mkdocs
|
||||||
link_check:
|
link_check:
|
||||||
ENABLED_HTMLPROOFER=true venv/bin/mkdocs build
|
ENABLED_HTMLPROOFER=true venv/bin/mkdocs build
|
||||||
|
|||||||
@@ -90,13 +90,9 @@ Linear in the length of the input. The parser is a predictive LL(1) parser.
|
|||||||
|
|
||||||
A UTF-8 byte order mark is silently ignored.
|
A UTF-8 byte order mark is silently ignored.
|
||||||
|
|
||||||
By default, a `'\0'` (NUL) byte anywhere in the input is treated as end of input, rather than as an ordinary (and,
|
|
||||||
outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-bytes-in-the-input) for details and the
|
|
||||||
[`JSON_STRICT_NUL_HANDLING`](../macros/json_strict_nul_handling.md) macro to opt into rejecting it instead.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) reading from a string"
|
??? example
|
||||||
|
|
||||||
The example below demonstrates the `accept()` function reading from a string.
|
The example below demonstrates the `accept()` function reading from a string.
|
||||||
|
|
||||||
@@ -110,28 +106,11 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
|
|||||||
--8<-- "examples/accept__string.output"
|
--8<-- "examples/accept__string.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (2) reading from an iterator pair"
|
|
||||||
|
|
||||||
The example below demonstrates the `accept()` function reading from an iterator pair. Only the first call covers
|
|
||||||
exactly the JSON text; the second one also covers the trailing bytes and is therefore rejected.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/accept__iterator_pair.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/accept__iterator_pair.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [parse](parse.md) - deserialize from a compatible input
|
- [parse](parse.md) - deserialize from a compatible input
|
||||||
- [sax_parse](sax_parse.md) - parse input using the SAX interface
|
- [sax_parse](sax_parse.md) - parse input using the SAX interface
|
||||||
- [operator>>](../operator_gtgt.md) - deserialize from stream
|
- [operator>>](../operator_gtgt.md) - deserialize from stream
|
||||||
- [`JSON_STRICT_NUL_HANDLING`](../macros/json_strict_nul_handling.md) - opt in to rejecting a NUL byte in the input
|
|
||||||
instead of treating it as end of input
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
@@ -141,8 +120,6 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
|
|||||||
- Added `ignore_trailing_commas` in version 3.13.0.
|
- Added `ignore_trailing_commas` in version 3.13.0.
|
||||||
- Extended container support (1) to include types with lvalue-only ADL `begin`/`end` (matching `std::begin`/`std::end` semantics) in version 3.13.0.
|
- Extended container support (1) to include types with lvalue-only ADL `begin`/`end` (matching `std::begin`/`std::end` semantics) in version 3.13.0.
|
||||||
- Extended overload (2) to accept heterogeneous iterator+sentinel pairs (C++20 ranges support) in version 3.13.0.
|
- Extended overload (2) to accept heterogeneous iterator+sentinel pairs (C++20 ranges support) in version 3.13.0.
|
||||||
- `JSON_STRICT_NUL_HANDLING` added in version 3.13.0 to optionally reject a NUL byte in the input instead of treating
|
|
||||||
it as end of input; planned to become the default in version 4.0.0.
|
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
@@ -152,5 +129,3 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#parsing) for how to update existing code.
|
|
||||||
|
|||||||
@@ -14,18 +14,14 @@ To store objects in C++, a type is defined by the template parameters explained
|
|||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
`ArrayType`
|
`ArrayType`
|
||||||
: container type to store arrays. It must be a vector-like container: the library uses `operator[]`, `at()`, and
|
: container type to store arrays (e.g., `std::vector` or `std::list`)
|
||||||
`resize()`, and requires random-access iterators. `#!cpp std::vector` and `#!cpp std::deque` qualify;
|
|
||||||
`#!cpp std::list` does not. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#arraytype) for the full list of
|
|
||||||
requirements.
|
|
||||||
|
|
||||||
`AllocatorType`
|
`AllocatorType`
|
||||||
: the allocator to use for objects (e.g., `std::allocator`)
|
: the allocator to use for objects (e.g., `std::allocator`)
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default value for
|
With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default value for
|
||||||
`array_t` is:
|
`array_t` is:
|
||||||
@@ -37,7 +33,7 @@ std::vector<
|
|||||||
>
|
>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Limits
|
#### Limits
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
||||||
> An implementation may set limits on the maximum depth of nesting.
|
> An implementation may set limits on the maximum depth of nesting.
|
||||||
@@ -46,7 +42,7 @@ In this class, the array's limit of nesting is not explicitly constrained. Howev
|
|||||||
introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the
|
introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the
|
||||||
[`max_size`](max_size.md) function of a JSON array.
|
[`max_size`](max_size.md) function of a JSON array.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of type
|
Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of type
|
||||||
`#!cpp array_t*` must be dereferenced.
|
`#!cpp array_t*` must be dereferenced.
|
||||||
@@ -67,14 +63,6 @@ Arrays are stored as pointers in a `basic_json` type. That is, for any access to
|
|||||||
--8<-- "examples/array_t.output"
|
--8<-- "examples/array_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [object_t](object_t.md) the type used to store JSON objects
|
|
||||||
- [binary_t](binary_t.md) the type used to store binary values
|
|
||||||
- [is_array](is_array.md) checks whether the JSON value is an array
|
|
||||||
- [max_size](max_size.md) returns the maximum possible number of elements
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
- Made `capacity()` optional, so that array types such as `#!cpp std::deque` can be used, in version 3.13.0.
|
|
||||||
|
|||||||
@@ -92,20 +92,6 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
3. Logarithmic in the size of the container.
|
3. Logarithmic in the size of the container.
|
||||||
4. Logarithmic in the size of the container.
|
4. Logarithmic in the size of the container.
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
|
||||||
|
|
||||||
Overload (4) also accepts a [`json_pointer`](../json_pointer/index.md) whose template argument is a `basic_json`
|
|
||||||
specialization (e.g., `nlohmann::json_pointer<nlohmann::json>`) instead of a string type. This is deprecated since
|
|
||||||
version 3.11.0 and will be removed in a future major version; use `basic_json::json_pointer` (for `json`,
|
|
||||||
`nlohmann::json_pointer<std::string>`) instead.
|
|
||||||
|
|
||||||
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
|
||||||
function.
|
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#json-pointers) for how to update existing code.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) access specified array element with bounds checking"
|
??? example "Example: (1) access specified array element with bounds checking"
|
||||||
|
|||||||
@@ -99,25 +99,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
elements of the pairs are treated as keys and the second elements are as values.
|
elements of the pairs are treated as keys and the second elements are as values.
|
||||||
3. In all other cases, an array is created.
|
3. In all other cases, an array is created.
|
||||||
|
|
||||||
The following flowchart also takes into account what happens when `type_deduction` is `#!cpp false`, in which case
|
|
||||||
`manual_type` decides between object and array, and an object can only be forced if `init` actually matches rule 2
|
|
||||||
(or is empty):
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
A(["initializer_list init"]) --> B{"empty, or every element is a 2-element<br/>array whose first element is a string?"}
|
|
||||||
B -->|"yes"| C{"type_deduction"}
|
|
||||||
B -->|"no"| D{"type_deduction"}
|
|
||||||
C -->|"true"| OBJ["create object"]
|
|
||||||
C -->|"false"| E{"manual_type"}
|
|
||||||
E -->|"object"| OBJ
|
|
||||||
E -->|"array"| ARR["create array"]
|
|
||||||
D -->|"true"| ARR
|
|
||||||
D -->|"false"| F{"manual_type"}
|
|
||||||
F -->|"array"| ARR
|
|
||||||
F -->|"object"| ERR["throw type_error.301"]
|
|
||||||
```
|
|
||||||
|
|
||||||
The rules aim to create the best fit between a C++ initializer list and JSON values. The rationale is as follows:
|
The rules aim to create the best fit between a C++ initializer list and JSON values. The rationale is as follows:
|
||||||
|
|
||||||
1. The empty initializer list is written as `#!cpp {}` which is exactly an empty JSON object.
|
1. The empty initializer list is written as `#!cpp {}` which is exactly an empty JSON object.
|
||||||
@@ -158,8 +139,8 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
|
|
||||||
- In case of a `#!json null` type, [invalid_iterator.206](../../home/exceptions.md#jsonexceptioninvalid_iterator206)
|
- In case of a `#!json null` type, [invalid_iterator.206](../../home/exceptions.md#jsonexceptioninvalid_iterator206)
|
||||||
is thrown.
|
is thrown.
|
||||||
- In case of other primitive types (number, boolean, string, or binary), `first` must be `begin()` and `last`
|
- In case of other primitive types (number, boolean, or string), `first` must be `begin()` and `last` must be
|
||||||
must be `end()`. In this case, the value is copied. Otherwise,
|
`end()`. In this case, the value is copied. Otherwise,
|
||||||
[`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) is thrown.
|
[`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) is thrown.
|
||||||
- In case of structured types (array, object), the constructor behaves as similar versions for `std::vector` or
|
- In case of structured types (array, object), the constructor behaves as similar versions for `std::vector` or
|
||||||
`std::map`; that is, a JSON array or object is constructed from the values in the range.
|
`std::map`; that is, a JSON array or object is constructed from the values in the range.
|
||||||
@@ -178,8 +159,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
- `CompatibleType` is not `basic_json` (to avoid hijacking copy/move constructors),
|
- `CompatibleType` is not `basic_json` (to avoid hijacking copy/move constructors),
|
||||||
- `CompatibleType` is not a different `basic_json` type (i.e. with different template arguments)
|
- `CompatibleType` is not a different `basic_json` type (i.e. with different template arguments)
|
||||||
- `CompatibleType` is not a `basic_json` nested type (e.g., `json_pointer`, `iterator`, etc.)
|
- `CompatibleType` is not a `basic_json` nested type (e.g., `json_pointer`, `iterator`, etc.)
|
||||||
- if [`JSON_DISABLE_TUPLE_REFERENCE_CONVERSION`](../macros/json_disable_tuple_reference_conversion.md) is defined
|
|
||||||
to `1`: `CompatibleType` is not a one-element `std::tuple` holding a reference to `basic_json`
|
|
||||||
- `json_serializer<U>` (with `U = uncvref_t<CompatibleType>`) has a `to_json(basic_json_t&, CompatibleType&&)`
|
- `json_serializer<U>` (with `U = uncvref_t<CompatibleType>`) has a `to_json(basic_json_t&, CompatibleType&&)`
|
||||||
method
|
method
|
||||||
|
|
||||||
@@ -190,8 +169,8 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
- `BasicJsonType` has different template arguments than `basic_json_t`.
|
- `BasicJsonType` has different template arguments than `basic_json_t`.
|
||||||
|
|
||||||
**Note:** For cross-`basic_json` conversions to produce correct results, the target `basic_json`'s
|
**Note:** For cross-`basic_json` conversions to produce correct results, the target `basic_json`'s
|
||||||
[`object_t`](object_t.md)`::key_type` and [`string_t`](string_t.md) must be directly constructible from the source
|
`object_t::key_type` and `string_t` must be directly constructible from the source `basic_json`'s
|
||||||
`basic_json`'s corresponding types. See the description of overload (4) above for details on what happens when
|
corresponding types. See the description of overload (4) above for details on what happens when
|
||||||
this requirement is not met.
|
this requirement is not met.
|
||||||
|
|
||||||
`U`:
|
`U`:
|
||||||
@@ -263,8 +242,8 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
and `last` are not compatible (i.e., do not belong to the same JSON value). In this case, the range
|
and `last` are not compatible (i.e., do not belong to the same JSON value). In this case, the range
|
||||||
`[first, last)` is undefined.
|
`[first, last)` is undefined.
|
||||||
- Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if iterators `first`
|
- Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if iterators `first`
|
||||||
and `last` belong to a primitive type (number, boolean, string, or binary), but `first` does not point to the
|
and `last` belong to a primitive type (number, boolean, or string), but `first` does not point to the first
|
||||||
first element anymore. In this case, the range `[first, last)` is undefined. See the example code below.
|
element anymore. In this case, the range `[first, last)` is undefined. See the example code below.
|
||||||
- Throws [`invalid_iterator.206`](../../home/exceptions.md#jsonexceptioninvalid_iterator206) if iterators `first`
|
- Throws [`invalid_iterator.206`](../../home/exceptions.md#jsonexceptioninvalid_iterator206) if iterators `first`
|
||||||
and `last` belong to a `#!json null` value. In this case, the range `[first, last)` is undefined.
|
and `last` belong to a `#!json null` value. In this case, the range `[first, last)` is undefined.
|
||||||
8. (none)
|
8. (none)
|
||||||
@@ -366,22 +345,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
|
|
||||||
Note the output is platform-dependent.
|
Note the output is platform-dependent.
|
||||||
|
|
||||||
??? example "Example: (4) create a JSON value from another `basic_json` specialization"
|
|
||||||
|
|
||||||
The example below shows how a `json` value is converted to an `ordered_json` value and back using the converting
|
|
||||||
constructor. Note how the original insertion order of `oj` is not restored, because it was already given up when
|
|
||||||
converting to `json`, whose `object_t` sorts by key.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/basic_json__BasicJsonType.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/basic_json__BasicJsonType.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
??? example "Example: (5) create a container (array or object) from an initializer list"
|
??? example "Example: (5) create a container (array or object) from an initializer list"
|
||||||
|
|
||||||
The example below shows how JSON values are created from initializer lists.
|
The example below shows how JSON values are created from initializer lists.
|
||||||
@@ -452,15 +415,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
--8<-- "examples/basic_json__moveconstructor.output"
|
--8<-- "examples/basic_json__moveconstructor.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [array](array.md) create a JSON array value, forcing array creation from an initializer list even when it looks like
|
|
||||||
an object
|
|
||||||
- [object](object.md) create a JSON object value, forcing object creation from an initializer list
|
|
||||||
- [binary](binary.md) create a JSON binary array value
|
|
||||||
- [operator=](operator=.md) copy assignment operator
|
|
||||||
- [Creating JSON values](../../features/creating_values.md) - the article on creating JSON values
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
1. Since version 1.0.0.
|
1. Since version 1.0.0.
|
||||||
@@ -469,8 +423,6 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
4. Since version 3.2.0.
|
4. Since version 3.2.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.
|
||||||
that did not cover the whole value (such as `(end(), end())`) was accepted and the whole binary value was copied,
|
|
||||||
unlike the other primitive types.
|
|
||||||
8. Since version 1.0.0.
|
8. Since version 1.0.0.
|
||||||
9. Since version 1.0.0.
|
9. Since version 1.0.0.
|
||||||
|
|||||||
@@ -37,14 +37,6 @@ Constant.
|
|||||||
--8<-- "examples/begin.output"
|
--8<-- "examples/begin.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [end](end.md) returns an iterator to one past the last element
|
|
||||||
- [cbegin](cbegin.md) returns a const iterator to the first element
|
|
||||||
- [rbegin](rbegin.md) returns a reverse iterator to the last element
|
|
||||||
- [items](items.md) returns an iteration proxy to access keys and values during range-based for loops
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ static basic_json binary(typename binary_t::container_type&& init);
|
|||||||
|
|
||||||
// (2)
|
// (2)
|
||||||
static basic_json binary(const typename binary_t::container_type& init,
|
static basic_json binary(const typename binary_t::container_type& init,
|
||||||
typename binary_t::subtype_type subtype);
|
std::uint8_t subtype);
|
||||||
static basic_json binary(typename binary_t::container_type&& init,
|
static basic_json binary(typename binary_t::container_type&& init,
|
||||||
typename binary_t::subtype_type subtype);
|
std::uint8_t subtype);
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Creates a JSON binary array value from a given binary container.
|
1. Creates a JSON binary array value from a given binary container.
|
||||||
@@ -61,15 +61,6 @@ initialization of a binary array type, for backwards compatibility and so it doe
|
|||||||
--8<-- "examples/binary.output"
|
--8<-- "examples/binary.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [binary_t](binary_t.md) type for binary values
|
|
||||||
- [get_binary](get_binary.md) get a reference to the stored binary value
|
|
||||||
- [is_binary](is_binary.md) return whether the value is binary
|
|
||||||
- [byte_container_with_subtype](../byte_container_with_subtype/index.md) container for binary values with subtype
|
|
||||||
- [Binary Values](../../features/binary_values.md) - the article on binary values
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.8.0.
|
- Added in version 3.8.0.
|
||||||
- Changed the type of `subtype` from `std::uint8_t` to `binary_t::subtype_type` (`std::uint64_t`) in version 3.10.0.
|
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ is compatible with both of the binary data formats that use binary subtyping, (t
|
|||||||
incompatible with each other, and it is up to the user to translate between them). The subtype is added to `BinaryType`
|
incompatible with each other, and it is up to the user to translate between them). The subtype is added to `BinaryType`
|
||||||
via the helper type [byte_container_with_subtype](../byte_container_with_subtype/index.md).
|
via the helper type [byte_container_with_subtype](../byte_container_with_subtype/index.md).
|
||||||
|
|
||||||
[CBOR's RFC 8949](https://www.rfc-editor.org/rfc/rfc8949.html#section-3.1) describes this type as:
|
[CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type as:
|
||||||
> Major type 2: A byte string. The number of bytes in the string is equal to the argument.
|
> Major type 2: a byte string. The string's length in bytes is represented following the rules for positive integers
|
||||||
|
> (major type 0).
|
||||||
|
|
||||||
[MessagePack's documentation on the bin type
|
[MessagePack's documentation on the bin type
|
||||||
family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) describes this type as:
|
family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) describes this type as:
|
||||||
@@ -42,22 +43,15 @@ represent a byte array in modern C++.
|
|||||||
`value_type` must additionally be exactly one byte wide (e.g., `std::uint8_t`/`char`/`std::byte`): the binary
|
`value_type` must additionally be exactly one byte wide (e.g., `std::uint8_t`/`char`/`std::byte`): the binary
|
||||||
serializers (CBOR, MessagePack, BSON, UBJSON) read and write the container's raw bytes via
|
serializers (CBOR, MessagePack, BSON, UBJSON) read and write the container's raw bytes via
|
||||||
`reinterpret_cast`, which is only correct for byte-sized elements -- a container like
|
`reinterpret_cast`, which is only correct for byte-sized elements -- a container like
|
||||||
`#!cpp std::vector<std::intptr_t>` will not work as `BinaryType`. The elements must be stored contiguously, and
|
`#!cpp std::vector<std::intptr_t>` will not work as `BinaryType`.
|
||||||
the binary readers additionally require `resize()` and `operator[]`. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#binarytype) for the full list.
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
The default values for `BinaryType` is `#!cpp std::vector<std::uint8_t>`.
|
The default values for `BinaryType` is `#!cpp std::vector<std::uint8_t>`.
|
||||||
|
|
||||||
### Supported byte types
|
#### Custom BinaryType behavior
|
||||||
|
|
||||||
`#!cpp std::vector<std::uint8_t>`, `#!cpp std::vector<char>`, and `#!cpp std::vector<std::byte>` are supported.
|
|
||||||
Regardless of which of them is configured, [`dump`](dump.md) writes the bytes as the numbers 0..255.
|
|
||||||
|
|
||||||
### Custom BinaryType behavior
|
|
||||||
|
|
||||||
When a custom `BinaryType` is configured (other than the default `#!cpp std::vector<std::uint8_t>`), you can assign
|
When a custom `BinaryType` is configured (other than the default `#!cpp std::vector<std::uint8_t>`), you can assign
|
||||||
values of that type directly to a `basic_json` instance, and they will automatically be recognized as binary values
|
values of that type directly to a `basic_json` instance, and they will automatically be recognized as binary values
|
||||||
@@ -89,12 +83,12 @@ assert(extracted == data);
|
|||||||
This automatic type detection is a convenience feature that only applies to custom (non-default) `BinaryType` configurations.
|
This automatic type detection is a convenience feature that only applies to custom (non-default) `BinaryType` configurations.
|
||||||
The default `nlohmann::json` continues to treat `#!cpp std::vector<std::uint8_t>` as arrays for backward compatibility.
|
The default `nlohmann::json` continues to treat `#!cpp std::vector<std::uint8_t>` as arrays for backward compatibility.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Binary Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of the
|
Binary Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of the
|
||||||
type `#!cpp binary_t*` must be dereferenced.
|
type `#!cpp binary_t*` must be dereferenced.
|
||||||
|
|
||||||
### Notes on subtypes
|
#### Notes on subtypes
|
||||||
|
|
||||||
- CBOR
|
- CBOR
|
||||||
- Binary values are represented as byte strings. Subtypes are written as tags.
|
- Binary values are represented as byte strings. Subtypes are written as tags.
|
||||||
@@ -133,6 +127,3 @@ type `#!cpp binary_t*` must be dereferenced.
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.8.0. Changed the type of subtype to `std::uint64_t` in version 3.10.0.
|
- Added in version 3.8.0. Changed the type of subtype to `std::uint64_t` in version 3.10.0.
|
||||||
- Fixed [`dump`](dump.md), [`std::hash`](std_hash.md), and [`to_ubjson`](to_ubjson.md) for byte types that are not
|
|
||||||
integers (e.g., `#!cpp std::byte`) in version 3.13.0. `dump` now writes the bytes of a signed byte type (e.g.,
|
|
||||||
`#!cpp char`) as 0..255 rather than as negative numbers.
|
|
||||||
|
|||||||
@@ -11,21 +11,13 @@ literals `#!json true` and `#!json false`.
|
|||||||
|
|
||||||
To store boolean values in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
To store boolean values in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
||||||
|
|
||||||
## Template parameters
|
|
||||||
|
|
||||||
`BooleanType`
|
|
||||||
: the type to store booleans. As it is stored directly inside a `basic_json` value (in a union), it must be a
|
|
||||||
trivially default-constructible, trivially copyable, and trivially destructible type that is convertible to and
|
|
||||||
from `#!cpp bool`. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#booleantype).
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
With the default values for `BooleanType` (`#!cpp bool`), the default value 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
|
||||||
|
|
||||||
Boolean values are stored directly inside a `basic_json` type.
|
Boolean values are stored directly inside a `basic_json` type.
|
||||||
|
|
||||||
@@ -45,10 +37,6 @@ Boolean values are stored directly inside a `basic_json` type.
|
|||||||
--8<-- "examples/boolean_t.output"
|
--8<-- "examples/boolean_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_boolean](is_boolean.md) checks whether the JSON value is a boolean
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ Constant.
|
|||||||
--8<-- "examples/cbegin.output"
|
--8<-- "examples/cbegin.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [begin](begin.md) returns an iterator to the first element
|
|
||||||
- [cend](cend.md) returns a const iterator to one past the last element
|
|
||||||
- [crbegin](crbegin.md) returns a const reverse iterator to the last element
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ ignore
|
|||||||
: ignore tags
|
: ignore tags
|
||||||
|
|
||||||
store
|
store
|
||||||
: store tagged byte strings (for bytes 0xd8..0xdb) as binary values with the tag as subtype; other tagged values are
|
: store tagged values as binary container with subtype (for bytes 0xd8..0xdb)
|
||||||
read as if the tag were ignored. If several tags precede a byte string, only the innermost one is stored.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -38,12 +37,6 @@ store
|
|||||||
--8<-- "examples/cbor_tag_handler_t.output"
|
--8<-- "examples/cbor_tag_handler_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [from_cbor](from_cbor.md) deserializes a JSON value from CBOR
|
|
||||||
- [input_format_t](input_format_t.md) the enumeration of supported input formats
|
|
||||||
- [CBOR](../../features/binary_formats/cbor.md) - the article on the CBOR format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.9.0. Added value `store` in 3.10.0.
|
- Added in version 3.9.0. Added value `store` in 3.10.0.
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ Constant.
|
|||||||
--8<-- "examples/cend.output"
|
--8<-- "examples/cend.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [end](end.md) returns an iterator to one past the last element
|
|
||||||
- [cbegin](cbegin.md) returns a const iterator to the first element
|
|
||||||
- [crend](crend.md) returns a const reverse iterator to one before the first element
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ void clear() noexcept;
|
|||||||
Clears the content of a JSON value and resets it to the default value as if [`basic_json(value_t)`](basic_json.md) would
|
Clears the content of a JSON value and resets it to the default value as if [`basic_json(value_t)`](basic_json.md) would
|
||||||
have been called with the current value type from [`type()`](type.md):
|
have been called with the current value type from [`type()`](type.md):
|
||||||
|
|
||||||
| Value type | initial value |
|
| Value type | initial value |
|
||||||
|------------|-----------------------------------------|
|
|------------|----------------------|
|
||||||
| null | `null` |
|
| null | `null` |
|
||||||
| boolean | `false` |
|
| boolean | `false` |
|
||||||
| string | `""` |
|
| string | `""` |
|
||||||
| number | `0` |
|
| number | `0` |
|
||||||
| binary | An empty byte vector with no subtype |
|
| binary | An empty byte vector |
|
||||||
| object | `{}` |
|
| object | `{}` |
|
||||||
| array | `[]` |
|
| array | `[]` |
|
||||||
|
|
||||||
Has the same effect as calling
|
Has the same effect as calling
|
||||||
|
|
||||||
@@ -52,13 +52,7 @@ All iterators, pointers, and references related to this container are invalidate
|
|||||||
--8<-- "examples/clear.output"
|
--8<-- "examples/clear.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [erase](erase.md) removes elements from a JSON value
|
|
||||||
- [empty](empty.md) checks whether the JSON value has no elements
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
- Added support for binary types in version 3.8.0.
|
- Added support for binary types in version 3.8.0.
|
||||||
- Fixed in version 3.13.0 to also clear the subtype of a binary value; before, the subtype was left unchanged.
|
|
||||||
|
|||||||
@@ -58,27 +58,11 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
- This method always returns `#!cpp false` when executed on a JSON type that is not an object.
|
- This method always returns `#!cpp false` when executed on a JSON type that is not an object.
|
||||||
- This method can be executed on any JSON value type.
|
- This method can be executed on any JSON value type.
|
||||||
- Calling this function with an integer argument (for example, `#!cpp contains(0)`) does not compile: such an argument
|
|
||||||
would otherwise implicitly convert to a null `#!cpp const char*` and, from there, cause undefined behavior when
|
|
||||||
constructing a `#!cpp std::string` for the object key. To check for an array element instead, use [`at`](at.md),
|
|
||||||
[`operator[]`](operator%5B%5D.md), or compare against [`size`](size.md).
|
|
||||||
|
|
||||||
!!! info "Postconditions"
|
!!! info "Postconditions"
|
||||||
|
|
||||||
If `#!cpp j.contains(x)` returns `#!c true` for a key or JSON pointer `x`, then it is safe to call `j[x]`.
|
If `#!cpp j.contains(x)` returns `#!c true` for a key or JSON pointer `x`, then it is safe to call `j[x]`.
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
|
||||||
|
|
||||||
Overload (3) also accepts a [`json_pointer`](../json_pointer/index.md) whose template argument is a `basic_json`
|
|
||||||
specialization (e.g., `nlohmann::json_pointer<nlohmann::json>`) instead of a string type. This is deprecated since
|
|
||||||
version 3.11.0 and will be removed in a future major version; use `basic_json::json_pointer` (for `json`,
|
|
||||||
`nlohmann::json_pointer<std::string>`) instead.
|
|
||||||
|
|
||||||
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
|
||||||
function.
|
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#json-pointers) for how to update existing code.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) check with key"
|
??? example "Example: (1) check with key"
|
||||||
@@ -133,5 +117,3 @@ Logarithmic in the size of the JSON object.
|
|||||||
1. Added in version 3.11.0.
|
1. Added in version 3.11.0.
|
||||||
2. Added in version 3.6.0. Extended template `KeyType` to support comparable types in version 3.11.0.
|
2. Added in version 3.6.0. Extended template `KeyType` to support comparable types in version 3.11.0.
|
||||||
3. Added in version 3.7.0.
|
3. Added in version 3.7.0.
|
||||||
4. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of
|
|
||||||
causing undefined behavior at runtime.
|
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- This method always returns `0` when executed on a JSON type that is not an object.
|
This method always returns `0` when executed on a JSON type that is not an object.
|
||||||
- Calling this function with an integer argument (for example, `#!cpp count(0)`) does not compile: such an argument
|
|
||||||
would otherwise implicitly convert to a null `#!cpp const char*` and, from there, cause undefined behavior when
|
|
||||||
constructing a `#!cpp std::string` for the object key. To check for an array element instead, use [`at`](at.md),
|
|
||||||
[`operator[]`](operator%5B%5D.md), or compare against [`size`](size.md).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -85,5 +81,3 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
1. Added in version 3.11.0.
|
1. Added in version 3.11.0.
|
||||||
2. Added in version 1.0.0. Changed parameter `key` type to `KeyType&&` in version 3.11.0.
|
2. Added in version 1.0.0. Changed parameter `key` type to `KeyType&&` in version 3.11.0.
|
||||||
3. Deleted overload for integral key types added in version 3.13.0 to reject such calls at compile time instead of
|
|
||||||
causing undefined behavior at runtime.
|
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ Constant.
|
|||||||
--8<-- "examples/crbegin.output"
|
--8<-- "examples/crbegin.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [crend](crend.md) returns a const reverse iterator to one before the first element
|
|
||||||
- [rbegin](rbegin.md) returns a reverse iterator to the last element
|
|
||||||
- [cbegin](cbegin.md) returns a const iterator to the first element
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -37,13 +37,6 @@ Constant.
|
|||||||
--8<-- "examples/crend.output"
|
--8<-- "examples/crend.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [crbegin](crbegin.md) returns a const reverse iterator to the last element
|
|
||||||
- [rend](rend.md) returns a reverse iterator to one before the first element
|
|
||||||
- [cend](cend.md) returns a const iterator to one past the last element
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ The actual comparator used depends on [`object_t`](object_t.md) and can be obtai
|
|||||||
--8<-- "examples/default_object_comparator_t.output"
|
--8<-- "examples/default_object_comparator_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [object_comparator_t](object_comparator_t.md) the comparator actually used by `object_t`
|
|
||||||
- [object_t](object_t.md) the type used to store JSON objects
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.0.
|
- Added in version 3.11.0.
|
||||||
|
|||||||
@@ -43,17 +43,6 @@ Strong guarantee: if an exception is thrown, there are no changes to any JSON va
|
|||||||
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
||||||
is not UTF-8 encoded and `error_handler` is set to `strict`
|
is not UTF-8 encoded and `error_handler` is set to `strict`
|
||||||
|
|
||||||
!!! warning "Serializing untrusted input"
|
|
||||||
|
|
||||||
When serializing values that may contain invalid or untrusted UTF-8 (e.g., bytes taken directly from network
|
|
||||||
input), `dump()` throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) in the default
|
|
||||||
`strict` mode. To serialize such data without throwing, pass
|
|
||||||
[`error_handler_t::replace`](error_handler_t.md) (substitutes U+FFFD) or
|
|
||||||
[`error_handler_t::ignore`](error_handler_t.md). Callers that serialize untrusted input on a crash-sensitive path
|
|
||||||
should either choose a non-strict error handler or wrap `dump()` in a `#!cpp try`/`#!cpp catch`.
|
|
||||||
|
|
||||||
See the [FAQ](../../home/faq.md#serializing-untrusted-or-invalid-utf-8) for details.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ a `#!cpp bool` denoting whether the insertion took place.
|
|||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value. As an exception, a `#!json null`
|
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
value is converted to an empty object before the element is added and keeps that type if adding the element throws.
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ iterator is invalidated.
|
|||||||
|
|
||||||
reference to the inserted element
|
reference to the inserted element
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value. As an exception, a `#!json null`
|
|
||||||
value is converted to an empty array before the element is added and keeps that type if adding the element throws.
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Throws [`type_error.311`](../../home/exceptions.md#jsonexceptiontype_error311) when called on a type other than JSON
|
Throws [`type_error.311`](../../home/exceptions.md#jsonexceptiontype_error311) when called on a type other than JSON
|
||||||
|
|||||||
@@ -60,11 +60,6 @@ itself is empty which is `#!cpp false` in the case of a string.
|
|||||||
--8<-- "examples/empty.output"
|
--8<-- "examples/empty.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [size](size.md) returns the number of elements
|
|
||||||
- [clear](clear.md) clears the content and resets the value to the default value
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -37,13 +37,6 @@ Constant.
|
|||||||
--8<-- "examples/end.output"
|
--8<-- "examples/end.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [begin](begin.md) returns an iterator to the first element
|
|
||||||
- [cend](cend.md) returns a const iterator to one past the last element
|
|
||||||
- [rend](rend.md) returns a reverse iterator to one before the first element
|
|
||||||
- [Iterators](../../features/iterators.md) - the article on iterators
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -37,11 +37,6 @@ ignore
|
|||||||
--8<-- "examples/error_handler_t.output"
|
--8<-- "examples/error_handler_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [dump](dump.md) serializes a JSON value, with an `error_handler_t` parameter to configure invalid UTF-8 handling
|
|
||||||
- [Handling invalid UTF-8](../../features/serialization.md#handling-invalid-utf-8) - the article on handling invalid UTF-8
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.4.0.
|
- Added in version 3.4.0.
|
||||||
|
|||||||
@@ -44,11 +44,7 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- This method always returns `end()` when executed on a JSON type that is not an object.
|
This method always returns `end()` when executed on a JSON type that is not an object.
|
||||||
- Calling this function with an integer argument (for example, `#!cpp find(0)`) does not compile: such an argument
|
|
||||||
would otherwise implicitly convert to a null `#!cpp const char*` and, from there, cause undefined behavior when
|
|
||||||
constructing a `#!cpp std::string` for the object key. To access an array element instead, use [`at`](at.md),
|
|
||||||
[`operator[]`](operator%5B%5D.md), or compare against [`size`](size.md).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -89,5 +85,3 @@ Logarithmic in the size of the JSON object.
|
|||||||
|
|
||||||
1. Added in version 3.11.0.
|
1. Added in version 3.11.0.
|
||||||
2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0.
|
2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0.
|
||||||
3. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of
|
|
||||||
causing undefined behavior at runtime.
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Empty objects and arrays are flattened to `#!json null` and will not be reconstr
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: flatten a JSON object"
|
??? example
|
||||||
|
|
||||||
The following code shows how a JSON object is flattened to an object whose keys consist of JSON pointers.
|
The following code shows how a JSON object is flattened to an object whose keys consist of JSON pointers.
|
||||||
|
|
||||||
@@ -41,21 +41,6 @@ Empty objects and arrays are flattened to `#!json null` and will not be reconstr
|
|||||||
--8<-- "examples/flatten.output"
|
--8<-- "examples/flatten.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: empty objects and arrays are flattened to `#!json null`"
|
|
||||||
|
|
||||||
The following code shows that an empty object and an empty array are both flattened to `#!json null`, and that
|
|
||||||
`unflatten()` restores them as `#!json null` rather than as empty containers.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/flatten__empty.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/flatten__empty.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [unflatten](unflatten.md) the reverse function
|
- [unflatten](unflatten.md) the reverse function
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ Linear in the size of the input.
|
|||||||
- [from_msgpack](from_msgpack.md) create a JSON value from an input in MessagePack format
|
- [from_msgpack](from_msgpack.md) create a JSON value from an input in MessagePack format
|
||||||
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
||||||
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
||||||
- [from_bon8](from_bon8.md) create a JSON value from an input in BON8 format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
|||||||
@@ -1,108 +0,0 @@
|
|||||||
# <small>nlohmann::basic_json::</small>from_bon8
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
// (1)
|
|
||||||
template<typename InputType>
|
|
||||||
static basic_json from_bon8(InputType&& i,
|
|
||||||
const bool strict = true,
|
|
||||||
const bool allow_exceptions = true);
|
|
||||||
// (2)
|
|
||||||
template<typename IteratorType, typename SentinelType = IteratorType>
|
|
||||||
static basic_json from_bon8(IteratorType first, SentinelType last,
|
|
||||||
const bool strict = true,
|
|
||||||
const bool allow_exceptions = true);
|
|
||||||
```
|
|
||||||
|
|
||||||
Deserializes a given input to a JSON value using the BON8 (Binary Object Notation 8) serialization format.
|
|
||||||
|
|
||||||
1. Reads from a compatible input.
|
|
||||||
2. Reads from an iterator range, or an iterator and a sentinel of a different type (C++20 ranges support).
|
|
||||||
|
|
||||||
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bon8.md).
|
|
||||||
|
|
||||||
## Template parameters
|
|
||||||
|
|
||||||
`InputType`
|
|
||||||
: A compatible input, for instance:
|
|
||||||
|
|
||||||
- an `std::istream` object
|
|
||||||
- a `FILE` pointer
|
|
||||||
- a C-style array of characters
|
|
||||||
- a pointer to a null-terminated string of single byte characters
|
|
||||||
- a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators
|
|
||||||
(as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`)
|
|
||||||
|
|
||||||
`IteratorType`
|
|
||||||
: a compatible iterator type
|
|
||||||
|
|
||||||
`SentinelType`
|
|
||||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
|
||||||
|
|
||||||
- a custom sentinel type for C++20 ranges
|
|
||||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
`i` (in)
|
|
||||||
: an input in BON8 format convertible to an input adapter
|
|
||||||
|
|
||||||
`first` (in)
|
|
||||||
: iterator to the start of the input
|
|
||||||
|
|
||||||
`last` (in)
|
|
||||||
: iterator to the end of the input, or a sentinel value that compares equal to the end iterator with `operator!=`
|
|
||||||
|
|
||||||
`strict` (in)
|
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
|
||||||
|
|
||||||
`allow_exceptions` (in)
|
|
||||||
: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default)
|
|
||||||
|
|
||||||
## Return value
|
|
||||||
|
|
||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
|
||||||
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
|
||||||
|
|
||||||
## Exceptions
|
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
|
||||||
the end of the file was not reached when `strict` was set to true
|
|
||||||
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs, for instance
|
|
||||||
an invalid byte, a string that is not valid UTF-8, or an object key that is not a string
|
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Linear in the size of the input.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
??? example
|
|
||||||
|
|
||||||
The example shows the deserialization of a byte vector in BON8 format to a JSON value.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/from_bon8.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/from_bon8.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [to_bon8](to_bon8.md) create a BON8 serialization of a JSON value
|
|
||||||
- [from_cbor](from_cbor.md) create a JSON value from an input in CBOR format
|
|
||||||
- [from_msgpack](from_msgpack.md) create a JSON value from an input in MessagePack format
|
|
||||||
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
|
||||||
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
|
||||||
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
|
||||||
|
|
||||||
## Version history
|
|
||||||
|
|
||||||
- Added in version 3.13.0.
|
|
||||||
@@ -104,7 +104,6 @@ Linear in the size of the input.
|
|||||||
- [from_msgpack](from_msgpack.md) for the related MessagePack format
|
- [from_msgpack](from_msgpack.md) for the related MessagePack format
|
||||||
- [from_ubjson](from_ubjson.md) for the related UBJSON format
|
- [from_ubjson](from_ubjson.md) for the related UBJSON format
|
||||||
- [from_bjdata](from_bjdata.md) for the related BJData format
|
- [from_bjdata](from_bjdata.md) for the related BJData format
|
||||||
- [from_bon8](from_bon8.md) for the related BON8 format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
@@ -123,5 +122,3 @@ Linear in the size of the input.
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#parsing) for how to update existing code.
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
the end of the file was not reached when `strict` was set to true
|
the end of the file was not reached when `strict` was set to true
|
||||||
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from CBOR were
|
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from CBOR were
|
||||||
used in the given input or if the input is not valid CBOR
|
used in the given input or if the input is not valid CBOR
|
||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a map key is not a string (keys of other
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key,
|
||||||
types are not supported, as JSON object keys are always strings) or a string is malformed
|
but not found
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
@@ -110,7 +110,6 @@ Linear in the size of the input.
|
|||||||
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
||||||
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
||||||
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
||||||
- [from_bon8](from_bon8.md) create a JSON value from an input in BON8 format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
@@ -133,5 +132,3 @@ Linear in the size of the input.
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#parsing) for how to update existing code.
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
the end of the file was not reached when `strict` was set to true
|
the end of the file was not reached when `strict` was set to true
|
||||||
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from
|
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from
|
||||||
MessagePack were used in the given input or if the input is not valid MessagePack
|
MessagePack were used in the given input or if the input is not valid MessagePack
|
||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a map key is not a string (keys of other
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key,
|
||||||
types are not supported, as JSON object keys are always strings) or a string is malformed
|
but not found
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
@@ -103,7 +103,6 @@ Linear in the size of the input.
|
|||||||
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
||||||
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
- [from_ubjson](from_ubjson.md) create a JSON value from an input in UBJSON format
|
||||||
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
||||||
- [from_bon8](from_bon8.md) create a JSON value from an input in BON8 format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
@@ -125,5 +124,3 @@ Linear in the size of the input.
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#parsing) for how to update existing code.
|
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ Linear in the size of the input.
|
|||||||
- [from_msgpack](from_msgpack.md) create a JSON value from an input in MessagePack format
|
- [from_msgpack](from_msgpack.md) create a JSON value from an input in MessagePack format
|
||||||
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
- [from_bson](from_bson.md) create a JSON value from an input in BSON format
|
||||||
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
- [from_bjdata](from_bjdata.md) create a JSON value from an input in BJData format
|
||||||
- [from_bon8](from_bon8.md) create a JSON value from an input in BON8 format
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
@@ -124,5 +123,3 @@ Linear in the size of the input.
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#parsing) for how to update existing code.
|
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ BasicJsonType get() const;
|
|||||||
|
|
||||||
// (3)
|
// (3)
|
||||||
template<typename PointerType>
|
template<typename PointerType>
|
||||||
PointerType get() noexcept;
|
PointerType get_ptr();
|
||||||
|
|
||||||
template<typename PointerType>
|
template<typename PointerType>
|
||||||
const PointerType get() const noexcept; // constexpr since C++14
|
constexpr const PointerType get_ptr() const noexcept;
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Explicit type conversion between the JSON value and a compatible value which is
|
1. Explicit type conversion between the JSON value and a compatible value which is
|
||||||
[CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) and
|
[CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) and
|
||||||
[DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). The value is converted by
|
[DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). The value is converted by
|
||||||
calling the [`json_serializer<ValueType>`](json_serializer.md) `from_json()` method.
|
calling the `json_serializer<ValueType>` `from_json()` method.
|
||||||
|
|
||||||
The function is equivalent to executing
|
The function is equivalent to executing
|
||||||
```cpp
|
```cpp
|
||||||
@@ -84,12 +84,6 @@ const PointerType get() const noexcept; // constexpr since C++14
|
|||||||
3. pointer to the internally stored JSON value if the requested pointer type fits to the JSON value; `#!cpp nullptr`
|
3. pointer to the internally stored JSON value if the requested pointer type fits to the JSON value; `#!cpp nullptr`
|
||||||
otherwise
|
otherwise
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws for overloads (1) and (2); the JSON value
|
|
||||||
itself is never modified, since `get()` is a `#!cpp const` member function. No-throw guarantee for overload (3): this
|
|
||||||
function never throws exceptions.
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
||||||
@@ -129,13 +123,13 @@ overload (3).
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) explicit conversion to compatible types"
|
??? example
|
||||||
|
|
||||||
The example below shows several conversions from JSON values
|
The example below shows several conversions from JSON values
|
||||||
to other types. There a few things to note: (1) Floating-point numbers can
|
to other types. There a few things to note: (1) Floating-point numbers can
|
||||||
be converted to integers, (2) A JSON array can be converted to a standard
|
be converted to integers, (2) A JSON array can be converted to a standard
|
||||||
`std::vector<short>`, (3) A JSON object can be converted to C++
|
`std::vector<short>`, (3) A JSON object can be converted to C++
|
||||||
associative containers such as `std::map<std::string, json>`.
|
associative containers such as `std::unordered_map<std::string, json>`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/get__ValueType_const.cpp"
|
--8<-- "examples/get__ValueType_const.cpp"
|
||||||
@@ -147,21 +141,7 @@ overload (3).
|
|||||||
--8<-- "examples/get__ValueType_const.output"
|
--8<-- "examples/get__ValueType_const.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (2) explicit conversion to another `basic_json` specialization"
|
??? example
|
||||||
|
|
||||||
The example below shows how a `json` value is converted to an `ordered_json` value using `get<BasicJsonType>()`.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/get__BasicJsonType.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/get__BasicJsonType.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
??? example "Example: (3) explicit pointer access to the stored value"
|
|
||||||
|
|
||||||
The example below shows how pointers to internal values of a JSON value can be requested. Note that no type
|
The example below shows how pointers to internal values of a JSON value can be requested. Note that no type
|
||||||
conversions are made and a `#cpp nullptr` is returned if the value and the requested pointer type does not match.
|
conversions are made and a `#cpp nullptr` is returned if the value and the requested pointer type does not match.
|
||||||
|
|||||||
@@ -10,14 +10,6 @@ Returns the allocator associated with the container.
|
|||||||
|
|
||||||
associated allocator
|
associated allocator
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
|
||||||
|
|
||||||
## Complexity
|
|
||||||
|
|
||||||
Constant.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
@@ -34,11 +26,6 @@ Constant.
|
|||||||
--8<-- "examples/get_allocator.output"
|
--8<-- "examples/get_allocator.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [basic_json](index.md#template-parameters) the class template, with `AllocatorType` as one of its template parameters
|
|
||||||
- [Template Parameter Requirements](../../features/types/template_parameters.md#allocatortype) - the requirements for `AllocatorType`
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ ValueType& get_to(ValueType& v) const noexcept(
|
|||||||
```
|
```
|
||||||
|
|
||||||
Explicit type conversion between the JSON value and a compatible value. The value is filled into the input parameter by
|
Explicit type conversion between the JSON value and a compatible value. The value is filled into the input parameter by
|
||||||
calling the [`json_serializer<ValueType>`](json_serializer.md) `from_json()` method.
|
calling the `json_serializer<ValueType>` `from_json()` method.
|
||||||
|
|
||||||
The function is equivalent to executing
|
The function is equivalent to executing
|
||||||
```cpp
|
```cpp
|
||||||
@@ -21,10 +21,6 @@ This overload is chosen if:
|
|||||||
- `ValueType` is not `basic_json`,
|
- `ValueType` is not `basic_json`,
|
||||||
- `json_serializer<ValueType>` has a `from_json()` method of the form `void from_json(const basic_json&, ValueType&)`
|
- `json_serializer<ValueType>` has a `from_json()` method of the form `void from_json(const basic_json&, ValueType&)`
|
||||||
|
|
||||||
`v` must not be `const`. Passing a `const` object is a compile-time error. For types such as arithmetic types, enums,
|
|
||||||
and C arrays, the error is a `static_assert` that names the problem. For other types, the overload is not viable, and
|
|
||||||
the compiler reports that no matching `get_to` was found.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
`ValueType`
|
`ValueType`
|
||||||
@@ -34,11 +30,6 @@ the compiler reports that no matching `get_to` was found.
|
|||||||
|
|
||||||
the input parameter, allowing chaining calls
|
the input parameter, allowing chaining calls
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws; the JSON value itself is never modified,
|
|
||||||
since `get_to()` is a `#!cpp const` member function.
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
||||||
@@ -54,7 +45,7 @@ Depends on the `json_serializer<ValueType>::from_json()` implementation.
|
|||||||
The example below shows several conversions from JSON values to other types. There a few things to note: (1)
|
The example below shows several conversions from JSON values to other types. There a few things to note: (1)
|
||||||
Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard
|
Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard
|
||||||
`#!cpp std::vector<short>`, (3) A JSON object can be converted to C++ associative containers such as
|
`#!cpp std::vector<short>`, (3) A JSON object can be converted to C++ associative containers such as
|
||||||
`#!cpp std::map<std::string, json>`.
|
`#cpp std::unordered_map<std::string, json>`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/get_to.cpp"
|
--8<-- "examples/get_to.cpp"
|
||||||
@@ -76,4 +67,3 @@ Depends on the `json_serializer<ValueType>::from_json()` implementation.
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Since version 3.3.0.
|
- Since version 3.3.0.
|
||||||
- Added a `static_assert` with a clear message for `const` arguments in version 3.13.0.
|
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ class basic_json;
|
|||||||
| `BinaryType` | type for binary arrays | [`binary_t`](binary_t.md) |
|
| `BinaryType` | type for binary arrays | [`binary_t`](binary_t.md) |
|
||||||
| `CustomBaseClass` | extension point for user code | [`json_base_class_t`](json_base_class_t.md) |
|
| `CustomBaseClass` | extension point for user code | [`json_base_class_t`](json_base_class_t.md) |
|
||||||
|
|
||||||
The library imposes a number of requirements on these types that are not expressed as C++ concepts, such as the
|
|
||||||
container operations `object_t` and `array_t` must provide, or the fact that `StringType` must be `char`-based. They
|
|
||||||
are collected in [Template Parameter Requirements](../../features/types/template_parameters.md).
|
|
||||||
|
|
||||||
## Specializations
|
## Specializations
|
||||||
|
|
||||||
- [**json**](../json.md) - default specialization
|
- [**json**](../json.md) - default specialization
|
||||||
@@ -290,13 +286,11 @@ Access to the JSON value
|
|||||||
### Binary formats
|
### Binary formats
|
||||||
|
|
||||||
- [**from_bjdata**](from_bjdata.md) (_static_) - create a JSON value from an input in BJData format
|
- [**from_bjdata**](from_bjdata.md) (_static_) - create a JSON value from an input in BJData format
|
||||||
- [**from_bon8**](from_bon8.md) (_static_) - create a JSON value from an input in BON8 format
|
|
||||||
- [**from_bson**](from_bson.md) (_static_) - create a JSON value from an input in BSON format
|
- [**from_bson**](from_bson.md) (_static_) - create a JSON value from an input in BSON format
|
||||||
- [**from_cbor**](from_cbor.md) (_static_) - create a JSON value from an input in CBOR format
|
- [**from_cbor**](from_cbor.md) (_static_) - create a JSON value from an input in CBOR format
|
||||||
- [**from_msgpack**](from_msgpack.md) (_static_) - create a JSON value from an input in MessagePack format
|
- [**from_msgpack**](from_msgpack.md) (_static_) - create a JSON value from an input in MessagePack format
|
||||||
- [**from_ubjson**](from_ubjson.md) (_static_) - create a JSON value from an input in UBJSON format
|
- [**from_ubjson**](from_ubjson.md) (_static_) - create a JSON value from an input in UBJSON format
|
||||||
- [**to_bjdata**](to_bjdata.md) (_static_) - create a BJData serialization of a given JSON value
|
- [**to_bjdata**](to_bjdata.md) (_static_) - create a BJData serialization of a given JSON value
|
||||||
- [**to_bon8**](to_bon8.md) (_static_) - create a BON8 serialization of a given JSON value
|
|
||||||
- [**to_bson**](to_bson.md) (_static_) - create a BSON serialization of a given JSON value
|
- [**to_bson**](to_bson.md) (_static_) - create a BSON serialization of a given JSON value
|
||||||
- [**to_cbor**](to_cbor.md) (_static_) - create a CBOR serialization of a given JSON value
|
- [**to_cbor**](to_cbor.md) (_static_) - create a CBOR serialization of a given JSON value
|
||||||
- [**to_msgpack**](to_msgpack.md) (_static_) - create a MessagePack serialization of a given JSON value
|
- [**to_msgpack**](to_msgpack.md) (_static_) - create a MessagePack serialization of a given JSON value
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ enum class input_format_t {
|
|||||||
msgpack,
|
msgpack,
|
||||||
ubjson,
|
ubjson,
|
||||||
bson,
|
bson,
|
||||||
bjdata,
|
bjdata
|
||||||
bon8
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,9 +31,6 @@ bson
|
|||||||
bjdata
|
bjdata
|
||||||
: BJData (Binary JData)
|
: BJData (Binary JData)
|
||||||
|
|
||||||
bon8
|
|
||||||
: BON8 (Binary Object Notation 8)
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
@@ -51,11 +47,6 @@ bon8
|
|||||||
--8<-- "examples/sax_parse__binary.output"
|
--8<-- "examples/sax_parse__binary.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [sax_parse](sax_parse.md) generic SAX parse interface, taking an `input_format_t` to select the input format
|
|
||||||
- [cbor_tag_handler_t](cbor_tag_handler_t.md) configures how CBOR tags are treated while parsing
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.2.0.
|
- Added in version 3.2.0.
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
do not belong to the same JSON value; example: `"iterators do not fit"`
|
do not belong to the same JSON value; example: `"iterators do not fit"`
|
||||||
- Throws [`invalid_iterator.211`](../../home/exceptions.md#jsonexceptioninvalid_iterator211) if `first` or `last`
|
- Throws [`invalid_iterator.211`](../../home/exceptions.md#jsonexceptioninvalid_iterator211) if `first` or `last`
|
||||||
are iterators into container for which insert is called; example: `"passed iterators may not belong to container"`
|
are iterators into container for which insert is called; example: `"passed iterators may not belong to container"`
|
||||||
- Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if `first` or `last`
|
|
||||||
do not point to an array; example: `"iterators first and last must point to arrays"`
|
|
||||||
4. The function can throw the following exceptions:
|
4. The function can throw the following exceptions:
|
||||||
- Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than
|
- Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than
|
||||||
arrays; example: `"cannot use insert() with string"`
|
arrays; example: `"cannot use insert() with string"`
|
||||||
@@ -109,11 +107,11 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
2. Linear in `cnt` plus linear in the distance between `pos` and end of the container.
|
2. Linear in `cnt` plus linear in the distance between `pos` and end of the container.
|
||||||
3. Linear in `#!cpp std::distance(first, last)` plus linear in the distance between `pos` and end of the container.
|
3. Linear in `#!cpp std::distance(first, last)` plus linear in the distance between `pos` and end of the container.
|
||||||
4. Linear in `ilist.size()` plus linear in the distance between `pos` and end of the container.
|
4. Linear in `ilist.size()` plus linear in the distance between `pos` and end of the container.
|
||||||
5. `O(N*log(size() + N))`, where `N` is the number of elements to insert.
|
5. Logarithmic: `O(N*log(size() + N))`, where `N` is the number of elements to insert.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) insert element into array"
|
??? example "Example (1): insert element into array"
|
||||||
|
|
||||||
The example shows how `insert()` is used.
|
The example shows how `insert()` is used.
|
||||||
|
|
||||||
@@ -127,7 +125,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
--8<-- "examples/insert.output"
|
--8<-- "examples/insert.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (2) insert copies of element into array"
|
??? example "Example (2): insert copies of element into array"
|
||||||
|
|
||||||
The example shows how `insert()` is used.
|
The example shows how `insert()` is used.
|
||||||
|
|
||||||
@@ -141,7 +139,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
--8<-- "examples/insert__count.output"
|
--8<-- "examples/insert__count.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (3) insert a range of elements into an array"
|
??? example "Example (3): insert a range of elements into an array"
|
||||||
|
|
||||||
The example shows how `insert()` is used.
|
The example shows how `insert()` is used.
|
||||||
|
|
||||||
@@ -155,7 +153,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
--8<-- "examples/insert__range.output"
|
--8<-- "examples/insert__range.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (4) insert elements from an initializer list into an array"
|
??? example "Example (4): insert elements from an initializer list into an array"
|
||||||
|
|
||||||
The example shows how `insert()` is used.
|
The example shows how `insert()` is used.
|
||||||
|
|
||||||
@@ -169,7 +167,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
--8<-- "examples/insert__ilist.output"
|
--8<-- "examples/insert__ilist.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (5) insert a range of elements into an object"
|
??? example "Example (5): insert a range of elements into an object"
|
||||||
|
|
||||||
The example shows how `insert()` is used.
|
The example shows how `insert()` is used.
|
||||||
|
|
||||||
@@ -195,7 +193,5 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
1. Added in version 1.0.0.
|
1. Added in version 1.0.0.
|
||||||
2. Added in version 1.0.0.
|
2. Added in version 1.0.0.
|
||||||
3. Added in version 1.0.0.
|
3. Added in version 1.0.0.
|
||||||
4. Added in version 1.0.0. Fixed in version 3.13.0 to copy the values before inserting; before, an `ilist` that
|
4. Added in version 1.0.0.
|
||||||
referred to elements of the array being inserted into could insert wrong values, because the range insert could
|
|
||||||
move from or shift an element before it was copied.
|
|
||||||
5. Added in version 3.0.0.
|
5. Added in version 3.0.0.
|
||||||
|
|||||||
@@ -34,13 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_array.output"
|
--8<-- "examples/is_array.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_object](is_object.md) checks whether the JSON value is an object
|
|
||||||
- [is_structured](is_structured.md) checks whether the JSON value is structured (array or object)
|
|
||||||
- [type](type.md) returns the type of the JSON value
|
|
||||||
- [array_t](array_t.md) the type used to store JSON arrays
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_binary.output"
|
--8<-- "examples/is_binary.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_primitive](is_primitive.md) checks whether the JSON value is primitive
|
|
||||||
- [binary_t](binary_t.md) the type used to store binary values
|
|
||||||
- [get_binary](get_binary.md) returns a reference to the stored binary value
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.8.0.
|
- Added in version 3.8.0.
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_boolean.output"
|
--8<-- "examples/is_boolean.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [boolean_t](boolean_t.md) the type used to store JSON booleans
|
|
||||||
- [is_primitive](is_primitive.md) checks whether the JSON value is primitive
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ with `allow_exceptions` set to `#!cpp false`: a parse error then yields a discar
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: `is_discarded()` for ordinary JSON values"
|
??? example
|
||||||
|
|
||||||
The following code exemplifies `is_discarded()` for all JSON types.
|
The following code exemplifies `is_discarded()` for all JSON types.
|
||||||
|
|
||||||
@@ -69,22 +69,6 @@ with `allow_exceptions` set to `#!cpp false`: a parse error then yields a discar
|
|||||||
--8<-- "examples/is_discarded.output"
|
--8<-- "examples/is_discarded.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: discarded values from parsing"
|
|
||||||
|
|
||||||
The following code shows the two situations in which a discarded value can be observed: parsing invalid JSON with
|
|
||||||
`allow_exceptions` set to `#!cpp false`, and a parser callback that discards the top-level value (which is replaced
|
|
||||||
by `#!json null` and therefore does *not* remain discarded).
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
--8<-- "examples/is_discarded__parse.cpp"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
|
|
||||||
```json
|
|
||||||
--8<-- "examples/is_discarded__parse.output"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -34,13 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_null.output"
|
--8<-- "examples/is_null.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_array](is_array.md) checks whether the JSON value is an array
|
|
||||||
- [is_object](is_object.md) checks whether the JSON value is an object
|
|
||||||
- [type](type.md) returns the type of the JSON value
|
|
||||||
- [value_t](value_t.md) the enumeration of JSON types
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -34,13 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_object.output"
|
--8<-- "examples/is_object.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_array](is_array.md) checks whether the JSON value is an array
|
|
||||||
- [is_structured](is_structured.md) checks whether the JSON value is structured (array or object)
|
|
||||||
- [type](type.md) returns the type of the JSON value
|
|
||||||
- [object_t](object_t.md) the type used to store JSON objects
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ Constant.
|
|||||||
--8<-- "examples/is_string.output"
|
--8<-- "examples/is_string.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [is_primitive](is_primitive.md) checks whether the JSON value is primitive
|
|
||||||
- [type](type.md) returns the type of the JSON value
|
|
||||||
- [string_t](string_t.md) the type used to store JSON strings
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -114,5 +114,3 @@ When iterating over an array, `key()` will return the index of the element as st
|
|||||||
|
|
||||||
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
|
||||||
function.
|
function.
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#miscellaneous-functions) for how to update existing code.
|
|
||||||
|
|||||||
@@ -14,18 +14,15 @@ Examples of such functionality might be metadata, additional member functions (e
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
The default value for `CustomBaseClass` is `void`. In this case, an
|
The default value for `CustomBaseClass` is `void`. In this case, an
|
||||||
[empty base class](https://en.cppreference.com/w/cpp/language/ebo) is used and no additional functionality is injected.
|
[empty base class](https://en.cppreference.com/w/cpp/language/ebo) is used and no additional functionality is injected.
|
||||||
|
|
||||||
### Limitations
|
#### Limitations
|
||||||
|
|
||||||
The type `CustomBaseClass` has to be a default-constructible, non-`final` class.
|
The type `CustomBaseClass` has to be a default-constructible class.
|
||||||
`basic_json` only supports copy/move construction/assignment if `CustomBaseClass` does so as well.
|
`basic_json` only supports copy/move construction/assignment if `CustomBaseClass` does so as well.
|
||||||
A `CustomBaseClass` with non-static data members forfeits `basic_json`'s
|
|
||||||
[standard layout](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType) guarantee. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#custombaseclass).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -43,10 +40,6 @@ A `CustomBaseClass` with non-static data members forfeits `basic_json`'s
|
|||||||
--8<-- "examples/json_base_class_t.output"
|
--8<-- "examples/json_base_class_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [Template Parameter Requirements](../../features/types/template_parameters.md#custombaseclass) - the requirements for `CustomBaseClass`
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.12.0.
|
- Added in version 3.12.0.
|
||||||
|
|||||||
@@ -15,16 +15,10 @@ using json_serializer = JSONSerializer<T, SFINAE>;
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
The default values for `json_serializer` is [`adl_serializer`](../adl_serializer/index.md).
|
The default values for `json_serializer` is [`adl_serializer`](../adl_serializer/index.md).
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
A custom serializer must provide `#!cpp static void to_json(basic_json&, T)` for every type it serializes, and either
|
|
||||||
`#!cpp static void from_json(const basic_json&, T&)` or `#!cpp static T from_json(const basic_json&)` for every type it
|
|
||||||
deserializes. See [Template Parameter Requirements](../../features/types/template_parameters.md#jsonserializer).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
@@ -42,13 +36,6 @@ deserializes. See [Template Parameter Requirements](../../features/types/templat
|
|||||||
--8<-- "examples/from_json__non_default_constructible.output"
|
--8<-- "examples/from_json__non_default_constructible.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [adl_serializer](../adl_serializer/index.md) the default `json_serializer`
|
|
||||||
- [get](get.md) explicit type conversion using the `json_serializer`'s `from_json()` method
|
|
||||||
- [get_to](get_to.md) explicit type conversion into a variable using the `json_serializer`'s `from_json()` method
|
|
||||||
- [Arbitrary Type Conversions](../../features/arbitrary_types.md) - the article on converting between JSON values and arbitrary types
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Since version 2.0.0.
|
- Since version 2.0.0.
|
||||||
|
|||||||
@@ -54,12 +54,6 @@ string elements the JSON value can store which is `1`.
|
|||||||
|
|
||||||
Note the output is platform-dependent.
|
Note the output is platform-dependent.
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [size](size.md) returns the number of elements
|
|
||||||
- [array_t](array_t.md) the type used to store JSON arrays
|
|
||||||
- [object_t](object_t.md) the type used to store JSON objects
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -33,20 +33,10 @@ Thereby, `Target` is the current object; that is, the patch is applied to the cu
|
|||||||
`apply_patch` (in)
|
`apply_patch` (in)
|
||||||
: the patch to apply
|
: the patch to apply
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Basic guarantee: if an exception is thrown during the operation, the JSON value may be partially modified.
|
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the lengths of `apply_patch`.
|
Linear in the lengths of `apply_patch`.
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
`apply_patch` may be `#!cpp *this` itself or refer to a value contained in `#!cpp *this` (for example, a subobject
|
|
||||||
returned by `#!cpp (*this)[key]`); it is read as it was when `merge_patch()` was called, before any modification of
|
|
||||||
`#!cpp *this`.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
@@ -71,5 +61,3 @@ returned by `#!cpp (*this)[key]`); it is read as it was when `merge_patch()` was
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.0.0.
|
- Added in version 3.0.0.
|
||||||
- Fixed use of freed or relocated memory when `apply_patch` is `#!cpp *this` or refers to a value contained in
|
|
||||||
`#!cpp *this`, in version 3.13.0.
|
|
||||||
|
|||||||
@@ -20,30 +20,20 @@ used.
|
|||||||
To store floating-point numbers in C++, a type is defined by the template parameter `NumberFloatType` which chooses the
|
To store floating-point numbers in C++, a type is defined by the template parameter `NumberFloatType` which chooses the
|
||||||
type to use.
|
type to use.
|
||||||
|
|
||||||
## Template parameters
|
|
||||||
|
|
||||||
`NumberFloatType`
|
|
||||||
: the type to store floating-point numbers. Parsing and serialization are implemented in terms of
|
|
||||||
`#!cpp std::strtof`/`#!cpp std::strtod`/`#!cpp std::strtold` and `#!cpp std::snprintf`, so the type must be
|
|
||||||
`#!cpp float`, `#!cpp double`, or `#!cpp long double`. The
|
|
||||||
[binary formats](../../features/binary_formats/index.md) additionally require `#!cpp float` or `#!cpp double`,
|
|
||||||
because they have no encoding for `#!cpp long double`. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#numberfloattype).
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
With the default values for `NumberFloatType` (`double`), the default value 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
|
||||||
|
|
||||||
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in floating-point literals will
|
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in floating-point literals will
|
||||||
be ignored. Internally, the value will be stored as a decimal number. For instance, the C++ floating-point literal
|
be ignored. Internally, the value will be stored as a decimal number. For instance, the C++ floating-point literal
|
||||||
`01.2` will be serialized to `1.2`. During deserialization, leading zeros yield an error.
|
`01.2` will be serialized to `1.2`. During deserialization, leading zeros yield an error.
|
||||||
- Not-a-number (NaN) values will be serialized to `null`.
|
- Not-a-number (NaN) values will be serialized to `null`.
|
||||||
|
|
||||||
### Limits
|
#### Limits
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) states:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) states:
|
||||||
> This specification allows implementations to set limits on the range and precision of numbers accepted. Since software
|
> This specification allows implementations to set limits on the range and precision of numbers accepted. Since software
|
||||||
@@ -55,7 +45,7 @@ This implementation does exactly follow this approach, as it uses double precisi
|
|||||||
smaller than `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` will be stored as NaN internally
|
smaller than `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` will be stored as NaN internally
|
||||||
and be serialized to `null`.
|
and be serialized to `null`.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Floating-point number values are stored directly inside a `basic_json` type.
|
Floating-point number values are stored directly inside a `basic_json` type.
|
||||||
|
|
||||||
@@ -75,13 +65,6 @@ Floating-point number values are stored directly inside a `basic_json` type.
|
|||||||
--8<-- "examples/number_float_t.output"
|
--8<-- "examples/number_float_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [number_integer_t](number_integer_t.md) the type used to store JSON integer numbers
|
|
||||||
- [number_unsigned_t](number_unsigned_t.md) the type used to store JSON unsigned integer numbers
|
|
||||||
- [is_number_float](is_number_float.md) checks whether the JSON value is a floating-point number
|
|
||||||
- [Number Handling](../../features/types/number_handling.md) - the article on number handling
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -20,27 +20,20 @@ used.
|
|||||||
To store integer numbers in C++, a type is defined by the template parameter `NumberIntegerType` which chooses the type
|
To store integer numbers in C++, a type is defined by the template parameter `NumberIntegerType` which chooses the type
|
||||||
to use.
|
to use.
|
||||||
|
|
||||||
## Template parameters
|
|
||||||
|
|
||||||
`NumberIntegerType`
|
|
||||||
: the type to store signed integers. It must be a **signed integral** type (`#!cpp std::is_integral`) with a
|
|
||||||
`#!cpp std::numeric_limits` specialization, and it is stored directly inside a `basic_json` value. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#numberintegertype-and-numberunsignedtype).
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
With the default values for `NumberIntegerType` (`std::int64_t`), the default value 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
|
||||||
|
|
||||||
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an
|
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an
|
||||||
interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++
|
interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++
|
||||||
integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error.
|
integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error.
|
||||||
|
|
||||||
### Limits
|
#### Limits
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
||||||
> An implementation may set limits on the range and precision of numbers.
|
> An implementation may set limits on the range and precision of numbers.
|
||||||
@@ -51,13 +44,13 @@ range will yield over/underflow when used in a constructor. During deserializati
|
|||||||
will automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md).
|
will automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md).
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) further states:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) further states:
|
||||||
> Note that when such software is used, numbers that are integers and are in the range [-2<sup>53</sup>+1, 2<sup>53</sup>-1] are
|
> Note that when such software is used, numbers that are integers and are in the range $[-2^{53}+1, 2^{53}-1]$ are
|
||||||
> interoperable in the sense that implementations will agree exactly on their numeric values.
|
> interoperable in the sense that implementations will agree exactly on their numeric values.
|
||||||
|
|
||||||
As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is
|
As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is
|
||||||
interoperable.
|
interoperable.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Integer number values are stored directly inside a `basic_json` type.
|
Integer number values are stored directly inside a `basic_json` type.
|
||||||
|
|
||||||
@@ -77,13 +70,6 @@ Integer number values are stored directly inside a `basic_json` type.
|
|||||||
--8<-- "examples/number_integer_t.output"
|
--8<-- "examples/number_integer_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [number_unsigned_t](number_unsigned_t.md) the type used to store JSON unsigned integer numbers
|
|
||||||
- [number_float_t](number_float_t.md) the type used to store JSON floating-point numbers
|
|
||||||
- [is_number_integer](is_number_integer.md) checks whether the JSON value is a signed integer number
|
|
||||||
- [Number Handling](../../features/types/number_handling.md) - the article on number handling
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@@ -20,28 +20,20 @@ used.
|
|||||||
To store unsigned integer numbers in C++, a type is defined by the template parameter `NumberUnsignedType` which chooses
|
To store unsigned integer numbers in C++, a type is defined by the template parameter `NumberUnsignedType` which chooses
|
||||||
the type to use.
|
the type to use.
|
||||||
|
|
||||||
## Template parameters
|
|
||||||
|
|
||||||
`NumberUnsignedType`
|
|
||||||
: the type to store unsigned integers. It must be an **unsigned integral** type (`#!cpp std::is_integral`) with a
|
|
||||||
`#!cpp std::numeric_limits` specialization, and it must be able to represent the absolute value of every
|
|
||||||
[`number_integer_t`](number_integer_t.md) value. See
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#numberintegertype-and-numberunsignedtype).
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Default type
|
#### Default type
|
||||||
|
|
||||||
With the default values for `NumberUnsignedType` (`std::uint64_t`), the default value 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
|
||||||
|
|
||||||
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an
|
- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an
|
||||||
interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++
|
interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++
|
||||||
integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error.
|
integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error.
|
||||||
|
|
||||||
### Limits
|
#### Limits
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
||||||
> An implementation may set limits on the range and precision of numbers.
|
> An implementation may set limits on the range and precision of numbers.
|
||||||
@@ -52,13 +44,13 @@ when used in a constructor. During deserialization, too large or small integer n
|
|||||||
as [`number_integer_t`](number_integer_t.md) or [`number_float_t`](number_float_t.md).
|
as [`number_integer_t`](number_integer_t.md) or [`number_float_t`](number_float_t.md).
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) further states:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) further states:
|
||||||
> Note that when such software is used, numbers that are integers and are in the range [-2<sup>53</sup>+1, 2<sup>53</sup>-1] are
|
> Note that when such software is used, numbers that are integers and are in the range $[-2^{53}+1, 2^{53}-1]$ are
|
||||||
> interoperable in the sense that implementations will agree exactly on their numeric values.
|
> interoperable in the sense that implementations will agree exactly on their numeric values.
|
||||||
|
|
||||||
As this range is a subrange (when considered in conjunction with the `number_integer_t` type) of the exactly supported
|
As this range is a subrange (when considered in conjunction with the `number_integer_t` type) of the exactly supported
|
||||||
range [0, UINT64_MAX], this class's integer type is interoperable.
|
range [0, UINT64_MAX], this class's integer type is interoperable.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Integer number values are stored directly inside a `basic_json` type.
|
Integer number values are stored directly inside a `basic_json` type.
|
||||||
|
|
||||||
@@ -78,13 +70,6 @@ Integer number values are stored directly inside a `basic_json` type.
|
|||||||
--8<-- "examples/number_unsigned_t.output"
|
--8<-- "examples/number_unsigned_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [number_integer_t](number_integer_t.md) the type used to store JSON integer numbers
|
|
||||||
- [number_float_t](number_float_t.md) the type used to store JSON floating-point numbers
|
|
||||||
- [is_number_unsigned](is_number_unsigned.md) checks whether the JSON value is an unsigned integer number
|
|
||||||
- [Number Handling](../../features/types/number_handling.md) - the article on number handling
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 2.0.0.
|
- Added in version 2.0.0.
|
||||||
|
|||||||
@@ -25,15 +25,8 @@ and [`default_object_comparator_t`](default_object_comparator_t.md) otherwise.
|
|||||||
--8<-- "examples/object_comparator_t.output"
|
--8<-- "examples/object_comparator_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [object_t](object_t.md) the type used to store JSON objects
|
|
||||||
- [default_object_comparator_t](default_object_comparator_t.md) the fallback comparator used when `object_t` has no `key_compare` member type
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.0.0.
|
- Added in version 3.0.0.
|
||||||
- Changed to be conditionally defined as `#!cpp typename object_t::key_compare` or `default_object_comparator_t` in
|
- Changed to be conditionally defined as `#!cpp typename object_t::key_compare` or `default_object_comparator_t` in
|
||||||
version 3.11.0.
|
version 3.11.0.
|
||||||
- Fixed the fallback to `default_object_comparator_t`, which previously failed to compile for object types without a
|
|
||||||
`key_compare` member type, in version 3.13.0.
|
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ To store objects in C++, a type is defined by the template parameters described
|
|||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
`ObjectType`
|
`ObjectType`
|
||||||
: the container to store objects. Its template parameters must have the same order and meaning as those of
|
: the container to store objects (e.g., `std::map` or `std::unordered_map`)
|
||||||
`std::map`; in particular, the third parameter is a comparator. `#!cpp std::unordered_map`, whose third parameter
|
|
||||||
is a hash function, therefore needs an adapter -- see
|
|
||||||
[Template Parameter Requirements](../../features/types/template_parameters.md#objecttype) for the full list of
|
|
||||||
requirements, an adapter example, and the containers that are known to work.
|
|
||||||
|
|
||||||
`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
|
||||||
@@ -33,7 +29,7 @@ To store objects in C++, a type is defined by the template parameters described
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### 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 value for `object_t` is:
|
(`std::allocator`), the default value for `object_t` is:
|
||||||
@@ -58,7 +54,7 @@ std::map<
|
|||||||
|
|
||||||
See [`default_object_comparator_t`](default_object_comparator_t.md) for more information.
|
See [`default_object_comparator_t`](default_object_comparator_t.md) for more information.
|
||||||
|
|
||||||
### Behavior
|
#### Behavior
|
||||||
|
|
||||||
The choice of `object_t` influences the behavior of the JSON class. With the default type, objects have the following
|
The choice of `object_t` influences the behavior of the JSON class. With the default type, objects have the following
|
||||||
behavior:
|
behavior:
|
||||||
@@ -76,7 +72,7 @@ behavior:
|
|||||||
that they will not be affected by these differences. For instance, `#!json {"b": 1, "a": 2}` and
|
that they will not be affected by these differences. For instance, `#!json {"b": 1, "a": 2}` and
|
||||||
`#!json {"a": 2, "b": 1}` will be treated as equal.
|
`#!json {"a": 2, "b": 1}` will be treated as equal.
|
||||||
|
|
||||||
### Limits
|
#### Limits
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
|
||||||
> An implementation may set limits on the maximum depth of nesting.
|
> An implementation may set limits on the maximum depth of nesting.
|
||||||
@@ -85,12 +81,12 @@ In this class, the object's limit of nesting is not explicitly constrained. Howe
|
|||||||
introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the
|
introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the
|
||||||
[`max_size`](max_size.md) function of a JSON object.
|
[`max_size`](max_size.md) function of a JSON object.
|
||||||
|
|
||||||
### Storage
|
#### Storage
|
||||||
|
|
||||||
Objects are stored as pointers in a `basic_json` type. That is, for any access to object values, a pointer of type
|
Objects are stored as pointers in a `basic_json` type. That is, for any access to object values, a pointer of type
|
||||||
`object_t*` must be dereferenced.
|
`object_t*` must be dereferenced.
|
||||||
|
|
||||||
### Object key order
|
#### Object key order
|
||||||
|
|
||||||
The order name/value pairs are added to the object are *not* preserved by the library. Therefore, iterating an object
|
The order name/value pairs are added to the object are *not* preserved by the library. Therefore, iterating an object
|
||||||
may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in
|
may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in
|
||||||
@@ -98,10 +94,10 @@ alphabetical order as `std::map` with `std::less` is used by default. Please not
|
|||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON
|
[RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
### Cross-`basic_json` conversion requirements
|
#### Cross-`basic_json` conversion requirements
|
||||||
|
|
||||||
When converting an object from one `basic_json` specialization to another via the
|
When converting an object from one `basic_json` specialization to another via the
|
||||||
[converting constructor](basic_json.md) (overload 4), the target `object_t`'s `key_type` must be
|
[converting constructor](basic_json.md#overload-4), the target `object_t`'s `key_type` must be
|
||||||
directly constructible from the source `basic_json`'s `string_t` type (or more generally, from the
|
directly constructible from the source `basic_json`'s `string_t` type (or more generally, from the
|
||||||
source object's key type). If this requirement is not met, the conversion does not fail; instead,
|
source object's key type). If this requirement is not met, the conversion does not fail; instead,
|
||||||
the object is silently converted as an array of key-value pairs, which is incorrect. See
|
the object is silently converted as an array of key-value pairs, which is incorrect. See
|
||||||
@@ -123,14 +119,6 @@ the object is silently converted as an array of key-value pairs, which is incorr
|
|||||||
--8<-- "examples/object_t.output"
|
--8<-- "examples/object_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
- [array_t](array_t.md) the type used to store JSON arrays
|
|
||||||
- [string_t](string_t.md) the type used to store JSON strings
|
|
||||||
- [object_comparator_t](object_comparator_t.md) the comparator used to order object keys
|
|
||||||
- [Object Order](../../features/object_order.md) - the article on object key ordering
|
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
- Allowed object types whose `erase(iterator)` returns `#!cpp void` in version 3.13.0.
|
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ invalidates all iterators and all references.
|
|||||||
|
|
||||||
`#!cpp *this`
|
`#!cpp *this`
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes to any JSON value. As an exception, a `#!json null`
|
|
||||||
value is converted to an empty array or object before the element is added and keeps that type if adding the element
|
|
||||||
throws.
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than
|
1. Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
1. The function can throw the following exceptions:
|
1. The function can throw the following exceptions:
|
||||||
- Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an array
|
- Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an array
|
||||||
or null; in that case, using the `[]` operator with an index makes no sense.
|
or null; in that case, using the `[]` operator with an index makes no sense.
|
||||||
- Throws `#!cpp std::length_error` if `idx` equals the maximum value of `size_type`; the array is left unchanged.
|
|
||||||
(This is the one index for which growing the array to hold it cannot be expressed as a `size_type` size, the same
|
|
||||||
way an oversized [`resize`](https://en.cppreference.com/w/cpp/container/vector/resize) throws.)
|
|
||||||
2. The function can throw the following exceptions:
|
2. The function can throw the following exceptions:
|
||||||
- Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an object
|
- Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an object
|
||||||
or null; in that case, using the `[]` operator with a key makes no sense.
|
or null; in that case, using the `[]` operator with a key makes no sense.
|
||||||
@@ -136,18 +133,6 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
while `/foo/one/one/one` creates nested objects. This is not specified by the JSON Pointer RFC; it is
|
while `/foo/one/one/one` creates nested objects. This is not specified by the JSON Pointer RFC; it is
|
||||||
this library's own, intentional disambiguation rule. See also [JSON Pointer](../../features/json_pointer.md).
|
this library's own, intentional disambiguation rule. See also [JSON Pointer](../../features/json_pointer.md).
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
|
||||||
|
|
||||||
Overload (4) also accepts a [`json_pointer`](../json_pointer/index.md) whose template argument is a `basic_json`
|
|
||||||
specialization (e.g., `nlohmann::json_pointer<nlohmann::json>`) instead of a string type. This is deprecated since
|
|
||||||
version 3.11.0 and will be removed in a future major version; use `basic_json::json_pointer` (for `json`,
|
|
||||||
`nlohmann::json_pointer<std::string>`) instead.
|
|
||||||
|
|
||||||
You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated
|
|
||||||
function.
|
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#json-pointers) for how to update existing code.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example "Example: (1) access specified array element"
|
??? example "Example: (1) access specified array element"
|
||||||
@@ -272,8 +257,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
1. Added in version 1.0.0. Fixed in version 3.13.0 to throw `#!cpp std::length_error` instead of emptying the array and
|
1. Added in version 1.0.0.
|
||||||
accessing it out of bounds when `idx` equals the maximum value of `size_type`.
|
|
||||||
2. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. Removed overloads for `T* key` (replaced by 3)
|
2. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. Removed overloads for `T* key` (replaced by 3)
|
||||||
in version 3.11.0.
|
in version 3.11.0.
|
||||||
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
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ Implicit type conversion between the JSON value and a compatible value. The call
|
|||||||
|
|
||||||
copy of the JSON value, converted to `ValueType`
|
copy of the JSON value, converted to `ValueType`
|
||||||
|
|
||||||
## Exception safety
|
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws; the JSON value itself is never modified,
|
|
||||||
since `#!cpp operator ValueType()` is a `#!cpp const` member function that only calls [`get()`](get.md).
|
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
Depends on what `json_serializer<ValueType>` `from_json()` method throws
|
||||||
@@ -61,8 +56,6 @@ Linear in the size of the JSON value.
|
|||||||
[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) to `0` and replace any implicit
|
[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) to `0` and replace any implicit
|
||||||
conversions with calls to [`get`](../basic_json/get.md).
|
conversions with calls to [`get`](../basic_json/get.md).
|
||||||
|
|
||||||
See the [migration guide](../../integration/migration_guide.md#replace-implicit-conversions) for how to update existing code.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
@@ -70,7 +63,7 @@ Linear in the size of the JSON value.
|
|||||||
The example below shows several conversions from JSON values to other types. There are a few things to note: (1)
|
The example below shows several conversions from JSON values to other types. There are a few things to note: (1)
|
||||||
Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard
|
Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard
|
||||||
`std::vector<short>`, (3) A JSON object can be converted to C++ associative containers such as
|
`std::vector<short>`, (3) A JSON object can be converted to C++ associative containers such as
|
||||||
`std::map<std::string, json>`.
|
`std::unordered_map<std::string, json>`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/operator__ValueType.cpp"
|
--8<-- "examples/operator__ValueType.cpp"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user