mirror of
https://github.com/nlohmann/json.git
synced 2025-06-08 04:17:31 +08:00
Compare commits
298 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c633693d3e | ||
![]() |
cf16c5ab9f | ||
![]() |
b19f058465 | ||
![]() |
5f77df4e22 | ||
![]() |
64ebc6d511 | ||
![]() |
82f4f70669 | ||
![]() |
68c25aec60 | ||
![]() |
ac0133ea89 | ||
![]() |
281d1e929b | ||
![]() |
7421ac31a7 | ||
![]() |
4b17f90f65 | ||
![]() |
2d9a251266 | ||
![]() |
3cca3ad210 | ||
![]() |
828c891427 | ||
![]() |
46e7cd3dc2 | ||
![]() |
6f6be39332 | ||
![]() |
e02de2f971 | ||
![]() |
410c96228c | ||
![]() |
4e518d43d7 | ||
![]() |
230bfd15a2 | ||
![]() |
e9391dc5bc | ||
![]() |
697c7e557c | ||
![]() |
9110918cf8 | ||
![]() |
0a8b48ac6a | ||
![]() |
dff2b4756c | ||
![]() |
eef76c200e | ||
![]() |
3b02afb9d9 | ||
![]() |
6b9199382b | ||
![]() |
51a77f1dca | ||
![]() |
756ca22ec5 | ||
![]() |
85df7ed593 | ||
![]() |
2be2c83d5c | ||
![]() |
c67d538274 | ||
![]() |
88c92e605c | ||
![]() |
96c1b52f1c | ||
![]() |
4cca3b9cb2 | ||
![]() |
93e957332b | ||
![]() |
7ddea2686f | ||
![]() |
2b876ee671 | ||
![]() |
1705bfe914 | ||
![]() |
00ecc7ed7a | ||
![]() |
4424a0fcc1 | ||
![]() |
11aa5f944d | ||
![]() |
79587f896e | ||
![]() |
b67f8644ee | ||
![]() |
71884486d1 | ||
![]() |
9ef4967389 | ||
![]() |
9f40a7b454 | ||
![]() |
d41ca94fa8 | ||
![]() |
3a5703931a | ||
![]() |
4d216e0c31 | ||
![]() |
f971dd7707 | ||
![]() |
cd92c09c18 | ||
![]() |
b477d2b95e | ||
![]() |
11a835df85 | ||
![]() |
b592b6f2d8 | ||
![]() |
e2c95baef1 | ||
![]() |
7abcb5e9a7 | ||
![]() |
5474b22277 | ||
![]() |
6e684350ba | ||
![]() |
f506d8acc7 | ||
![]() |
34665ae648 | ||
![]() |
f3dc4684b4 | ||
![]() |
0b938993e1 | ||
![]() |
543d8e4179 | ||
![]() |
f2e4946865 | ||
![]() |
8215dbafbd | ||
![]() |
a3143f5f2f | ||
![]() |
0b6881a95f | ||
![]() |
a43350c4e5 | ||
![]() |
8fb5d6f92d | ||
![]() |
2dc82053dc | ||
![]() |
bf6b1e2f40 | ||
![]() |
606b6347ed | ||
![]() |
c7d949f9f0 | ||
![]() |
e90c860d53 | ||
![]() |
d0789e365d | ||
![]() |
97dd60c22a | ||
![]() |
666d061443 | ||
![]() |
bf8ccc20e9 | ||
![]() |
786c5040e2 | ||
![]() |
bd4fea39ea | ||
![]() |
8c7dcd3b43 | ||
![]() |
b23cdeac2c | ||
![]() |
1b813519c2 | ||
![]() |
f06604fce0 | ||
![]() |
d23291ba26 | ||
![]() |
0f9e6ae098 | ||
![]() |
8a882f32ed | ||
![]() |
bdb8d2b7b3 | ||
![]() |
e72046ef9f | ||
![]() |
4a0081a1cf | ||
![]() |
52b2614217 | ||
![]() |
f74e5c6a57 | ||
![]() |
e25a824616 | ||
![]() |
26cfec34be | ||
![]() |
ad2ee18539 | ||
![]() |
2d42229f4d | ||
![]() |
1809b3d800 | ||
![]() |
48e7b4c23b | ||
![]() |
0cb1241d5e | ||
![]() |
2e50d5b2f3 | ||
![]() |
60c48755e3 | ||
![]() |
a6255cc418 | ||
![]() |
f038ac4c9d | ||
![]() |
4f64d8d0b4 | ||
![]() |
2134cb947a | ||
![]() |
6057b31df7 | ||
![]() |
0fa326a8e8 | ||
![]() |
8314ac2f76 | ||
![]() |
69c8758d51 | ||
![]() |
5ff90d9e02 | ||
![]() |
6be4e85600 | ||
![]() |
663058e7d1 | ||
![]() |
af4ad7915c | ||
![]() |
58f5f25968 | ||
![]() |
733c59588d | ||
![]() |
6cb099e30e | ||
![]() |
094bd2651b | ||
![]() |
30cd44df95 | ||
![]() |
5362012fdd | ||
![]() |
861ec9c3c6 | ||
![]() |
f4910b20ce | ||
![]() |
f2a4ac0673 | ||
![]() |
8e1b800017 | ||
![]() |
677e19e39c | ||
![]() |
9e23b5d61e | ||
![]() |
eb142e33c0 | ||
![]() |
1c8e26dcb4 | ||
![]() |
b6b8378c8c | ||
![]() |
58949c0ad5 | ||
![]() |
7cfbe321be | ||
![]() |
4003f8da02 | ||
![]() |
6a2ae22a5a | ||
![]() |
620034ecec | ||
![]() |
e6cafa573a | ||
![]() |
e0a17f8475 | ||
![]() |
20ae363a71 | ||
![]() |
589641b175 | ||
![]() |
f385fe28f2 | ||
![]() |
981a4c39f4 | ||
![]() |
dd81f878f7 | ||
![]() |
549c79ba7e | ||
![]() |
9f60e85557 | ||
![]() |
a006a7a48b | ||
![]() |
1b9a9d1f21 | ||
![]() |
935c6eeb5a | ||
![]() |
e41905fcb0 | ||
![]() |
d333f08958 | ||
![]() |
3d6c664de2 | ||
![]() |
ee32bfc1c2 | ||
![]() |
a97041a98f | ||
![]() |
f9f8c07792 | ||
![]() |
378e091795 | ||
![]() |
1f218e1074 | ||
![]() |
64f68dc563 | ||
![]() |
1c5923e5d6 | ||
![]() |
e3ac5a64bf | ||
![]() |
e509007df2 | ||
![]() |
060414037e | ||
![]() |
fd20975a94 | ||
![]() |
fde9a86c5a | ||
![]() |
1825117e63 | ||
![]() |
4a602df34e | ||
![]() |
18ff442e63 | ||
![]() |
aff5a31d35 | ||
![]() |
ac8b22180d | ||
![]() |
6325839776 | ||
![]() |
b36f4c477c | ||
![]() |
960b763ecd | ||
![]() |
8c391e04fe | ||
![]() |
01da82eae2 | ||
![]() |
97f0bdaf9a | ||
![]() |
c883fb0f17 | ||
![]() |
377c767aa1 | ||
![]() |
16b3d841d5 | ||
![]() |
199dea11b1 | ||
![]() |
0457de21cf | ||
![]() |
c35d260c2f | ||
![]() |
6a064e026a | ||
![]() |
7efe875495 | ||
![]() |
a259ecc51e | ||
![]() |
3780b41dd0 | ||
![]() |
9cca280a4d | ||
![]() |
1d597743d8 | ||
![]() |
f56c6e2e30 | ||
![]() |
360ce457f4 | ||
![]() |
5d931c59a3 | ||
![]() |
6eab7a2b18 | ||
![]() |
1dfe4073e3 | ||
![]() |
4ffd5bd18e | ||
![]() |
0261bc04d3 | ||
![]() |
59da644db4 | ||
![]() |
cdb29069da | ||
![]() |
58d6aa5831 | ||
![]() |
edffad036d | ||
![]() |
6adae02ddd | ||
![]() |
35c0b3e54c | ||
![]() |
fac07e22c5 | ||
![]() |
6d4b72d3c3 | ||
![]() |
bbd2e1636d | ||
![]() |
6e36c721f0 | ||
![]() |
e75b94b31e | ||
![]() |
aa87ab8b40 | ||
![]() |
1ce29fa22f | ||
![]() |
5fec803493 | ||
![]() |
da92c0e3e7 | ||
![]() |
836b7beca4 | ||
![]() |
788e5468e4 | ||
![]() |
6cc0eaf88f | ||
![]() |
5d2754306d | ||
![]() |
c71ecde505 | ||
![]() |
793878898f | ||
![]() |
254395e5f7 | ||
![]() |
ab06fc9951 | ||
![]() |
a0c1318830 | ||
![]() |
6af826d0bd | ||
![]() |
546370c9e7 | ||
![]() |
bbe337c3a3 | ||
![]() |
fe4b66355c | ||
![]() |
31c00dc729 | ||
![]() |
6cec5aefc9 | ||
![]() |
b504dca35a | ||
![]() |
660d0b5856 | ||
![]() |
b2306145e1 | ||
![]() |
8fa0d7bb7e | ||
![]() |
233d233439 | ||
![]() |
da6b908c4f | ||
![]() |
4c6cde72e5 | ||
![]() |
a2f0593649 | ||
![]() |
80dfb049b3 | ||
![]() |
2ca8dabeb9 | ||
![]() |
885aa0014e | ||
![]() |
7f72eedc2d | ||
![]() |
094a3dc105 | ||
![]() |
ea870ea247 | ||
![]() |
3c616ed688 | ||
![]() |
813c329fbb | ||
![]() |
97f88ce21d | ||
![]() |
44423b4d8f | ||
![]() |
3e990876e1 | ||
![]() |
b6dcf3edf3 | ||
![]() |
07182ebc1d | ||
![]() |
f7d46b8803 | ||
![]() |
84e5a321eb | ||
![]() |
23e69222c5 | ||
![]() |
5fa4e66d37 | ||
![]() |
c700a9ecbb | ||
![]() |
c5a03c2ea0 | ||
![]() |
349e4b310e | ||
![]() |
8f8315368b | ||
![]() |
24ba54e687 | ||
![]() |
a3e6e26dc8 | ||
![]() |
4b2c8ce6bc | ||
![]() |
17d9eacd24 | ||
![]() |
f4658de270 | ||
![]() |
3d1252bbff | ||
![]() |
2d1f9b6a7d | ||
![]() |
9dfa722669 | ||
![]() |
c920f3f4fb | ||
![]() |
15ca78a886 | ||
![]() |
58bd97e2b1 | ||
![]() |
307c053b9b | ||
![]() |
bed648ca55 | ||
![]() |
f7973f46d6 | ||
![]() |
4c8cdd7afc | ||
![]() |
8fcdbf2e77 | ||
![]() |
bc889afb4c | ||
![]() |
9d69186291 | ||
![]() |
32bbd38072 | ||
![]() |
c0dae0f510 | ||
![]() |
0e61ee8b07 | ||
![]() |
93112fbf4d | ||
![]() |
a92ccafd2c | ||
![]() |
e1a3fb74ba | ||
![]() |
d79d12f854 | ||
![]() |
31265dc69c | ||
![]() |
231f3108ff | ||
![]() |
dae5412268 | ||
![]() |
0c7a18374c | ||
![]() |
8eee62d388 | ||
![]() |
f1e34070d2 | ||
![]() |
bfbe774d8f | ||
![]() |
b0422f8013 | ||
![]() |
7b6cf5918b | ||
![]() |
9e1a7c85e3 | ||
![]() |
e839f58a2a | ||
![]() |
01af734d63 | ||
![]() |
b13b8748b6 | ||
![]() |
b6e2942d1c | ||
![]() |
500bdc56bf | ||
![]() |
98d70d4676 | ||
![]() |
22cd1c9eb9 | ||
![]() |
ac20714e2e | ||
![]() |
2ac7d023d4 | ||
![]() |
32242022f7 | ||
![]() |
ac9e668e63 | ||
![]() |
df98ca29f8 |
@ -1,22 +1,17 @@
|
|||||||
kind: pipeline
|
arm_container:
|
||||||
name: test-on-arm64
|
image: gcc:latest
|
||||||
|
|
||||||
platform:
|
check_task:
|
||||||
arch: arm64
|
check_script:
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: gcc
|
|
||||||
commands:
|
|
||||||
- wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
|
- wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
|
||||||
- tar xfz cmake-3.20.2.tar.gz
|
- tar xfz cmake-3.20.2.tar.gz
|
||||||
- cd cmake-3.20.2
|
- cd cmake-3.20.2
|
||||||
- ./configure
|
- ./configure
|
||||||
- make cmake ctest -j10
|
- make cmake ctest -j4
|
||||||
- cd ..
|
- cd ..
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
|
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
|
||||||
- make -j10
|
- make -j4
|
||||||
- cd tests
|
- cd tests
|
||||||
- ../../cmake-3.20.2/bin/ctest -j10
|
- ../../cmake-3.20.2/bin/ctest -j4
|
@ -1,84 +0,0 @@
|
|||||||
#AccessModifierOffset: 2
|
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
AlignConsecutiveAssignments: false
|
|
||||||
#AlignConsecutiveBitFields: false
|
|
||||||
AlignConsecutiveDeclarations: false
|
|
||||||
AlignConsecutiveMacros: false
|
|
||||||
AlignEscapedNewlines: Right
|
|
||||||
#AlignOperands: AlignAfterOperator
|
|
||||||
AlignTrailingComments: true
|
|
||||||
AllowAllArgumentsOnNextLine: false
|
|
||||||
AllowAllConstructorInitializersOnNextLine: false
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
|
||||||
AllowShortBlocksOnASingleLine: Empty
|
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
#AllowShortEnumsOnASingleLine: true
|
|
||||||
AllowShortFunctionsOnASingleLine: Empty
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
AllowShortLambdasOnASingleLine: Empty
|
|
||||||
AllowShortLoopsOnASingleLine: false
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
|
||||||
AlwaysBreakTemplateDeclarations: Yes
|
|
||||||
BinPackArguments: false
|
|
||||||
BinPackParameters: false
|
|
||||||
#BitFieldColonSpacing: Both
|
|
||||||
BreakBeforeBraces: Custom # or Allman
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: true
|
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: Always
|
|
||||||
AfterEnum: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: false
|
|
||||||
AfterStruct: true
|
|
||||||
AfterUnion: true
|
|
||||||
AfterExternBlock: false
|
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
#BeforeLambdaBody: false
|
|
||||||
#BeforeWhile: false
|
|
||||||
SplitEmptyFunction: false
|
|
||||||
SplitEmptyRecord: false
|
|
||||||
SplitEmptyNamespace: false
|
|
||||||
BreakBeforeTernaryOperators: true
|
|
||||||
BreakConstructorInitializers: BeforeComma
|
|
||||||
BreakStringLiterals: false
|
|
||||||
ColumnLimit: 0
|
|
||||||
CompactNamespaces: false
|
|
||||||
ConstructorInitializerIndentWidth: 2
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
PointerAlignment: Left
|
|
||||||
FixNamespaceComments: true
|
|
||||||
IncludeBlocks: Preserve
|
|
||||||
#IndentCaseBlocks: false
|
|
||||||
IndentCaseLabels: true
|
|
||||||
IndentGotoLabels: false
|
|
||||||
IndentPPDirectives: BeforeHash
|
|
||||||
IndentWidth: 4
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: None
|
|
||||||
ReflowComments: false
|
|
||||||
SortIncludes: true
|
|
||||||
SortUsingDeclarations: true
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: false
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
SpaceInEmptyBlock: false
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesBeforeTrailingComments: 2
|
|
||||||
SpacesInAngles: false
|
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInConditionalStatement: false
|
|
||||||
SpacesInContainerLiterals: false
|
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
Standard: c++11
|
|
||||||
TabWidth: 4
|
|
||||||
UseTab: Never
|
|
23
.clang-tidy
23
.clang-tidy
@ -1,11 +1,23 @@
|
|||||||
|
# TODO: The first three checks are only removed to get the CI going. They have to be addressed at some point.
|
||||||
|
# TODO: portability-avoid-pragma-once: should be fixed eventually
|
||||||
|
|
||||||
Checks: '*,
|
Checks: '*,
|
||||||
|
|
||||||
|
-portability-template-virtual-member-function,
|
||||||
|
-bugprone-use-after-move,
|
||||||
|
-hicpp-invalid-access-moved,
|
||||||
|
|
||||||
-altera-id-dependent-backward-branch,
|
-altera-id-dependent-backward-branch,
|
||||||
-altera-struct-pack-align,
|
-altera-struct-pack-align,
|
||||||
-altera-unroll-loops,
|
-altera-unroll-loops,
|
||||||
-android-cloexec-fopen,
|
-android-cloexec-fopen,
|
||||||
|
-boost-use-ranges,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-cert-err58-cpp,
|
-cert-err58-cpp,
|
||||||
|
-clang-analyzer-webkit.NoUncountedMemberChecker,
|
||||||
-concurrency-mt-unsafe,
|
-concurrency-mt-unsafe,
|
||||||
|
-cppcoreguidelines-avoid-const-or-ref-data-members,
|
||||||
|
-cppcoreguidelines-avoid-do-while,
|
||||||
-cppcoreguidelines-avoid-goto,
|
-cppcoreguidelines-avoid-goto,
|
||||||
-cppcoreguidelines-avoid-magic-numbers,
|
-cppcoreguidelines-avoid-magic-numbers,
|
||||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||||
@ -15,6 +27,7 @@ Checks: '*,
|
|||||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||||
-cppcoreguidelines-pro-type-union-access,
|
-cppcoreguidelines-pro-type-union-access,
|
||||||
|
-cppcoreguidelines-rvalue-reference-param-not-moved,
|
||||||
-cppcoreguidelines-virtual-class-destructor,
|
-cppcoreguidelines-virtual-class-destructor,
|
||||||
-fuchsia-default-arguments-calls,
|
-fuchsia-default-arguments-calls,
|
||||||
-fuchsia-default-arguments-declarations,
|
-fuchsia-default-arguments-declarations,
|
||||||
@ -33,11 +46,21 @@ Checks: '*,
|
|||||||
-llvm-header-guard,
|
-llvm-header-guard,
|
||||||
-llvm-include-order,
|
-llvm-include-order,
|
||||||
-llvmlibc-*,
|
-llvmlibc-*,
|
||||||
|
-misc-use-anonymous-namespace,
|
||||||
|
-misc-confusable-identifiers,
|
||||||
|
-misc-include-cleaner,
|
||||||
-misc-no-recursion,
|
-misc-no-recursion,
|
||||||
-misc-non-private-member-variables-in-classes,
|
-misc-non-private-member-variables-in-classes,
|
||||||
-modernize-concat-nested-namespaces,
|
-modernize-concat-nested-namespaces,
|
||||||
|
-modernize-type-traits,
|
||||||
|
-modernize-use-constraints,
|
||||||
|
-modernize-use-designated-initializers,
|
||||||
-modernize-use-nodiscard,
|
-modernize-use-nodiscard,
|
||||||
|
-modernize-use-ranges,
|
||||||
|
-modernize-use-std-numbers,
|
||||||
-modernize-use-trailing-return-type,
|
-modernize-use-trailing-return-type,
|
||||||
|
-performance-enum-size,
|
||||||
|
-portability-avoid-pragma-once,
|
||||||
-readability-function-cognitive-complexity,
|
-readability-function-cognitive-complexity,
|
||||||
-readability-function-size,
|
-readability-function-size,
|
||||||
-readability-identifier-length,
|
-readability-identifier-length,
|
||||||
|
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@ -1,5 +1,5 @@
|
|||||||
# JSON for Modern C++ has been originally written by Niels Lohmann.
|
# JSON for Modern C++ was originally written by Niels Lohmann.
|
||||||
# Since 2013 over 140 contributors have helped to improve the library.
|
# Since 2013, over 250 contributors have helped to improve the library.
|
||||||
# This CODEOWNERS file is only to make sure that @nlohmann is requested
|
# This CODEOWNERS file is only to make sure that @nlohmann is requested
|
||||||
# for a code review in case of a pull request.
|
# for a code review in case of a pull request.
|
||||||
|
|
||||||
|
128
.github/CODE_OF_CONDUCT.md
vendored
128
.github/CODE_OF_CONDUCT.md
vendored
@ -2,45 +2,131 @@
|
|||||||
|
|
||||||
## Our Pledge
|
## Our Pledge
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||||
|
identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
## Our Standards
|
## Our Standards
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment include:
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
* Demonstrating empathy and kindness toward other people
|
||||||
* Being respectful of differing viewpoints and experiences
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
* Gracefully accepting constructive criticism
|
* Giving and gracefully accepting constructive feedback
|
||||||
* Focusing on what is best for the community
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
* Showing empathy towards other community members
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the overall
|
||||||
|
community
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Public or private harassment
|
* Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
* Publishing others' private information, such as a physical or email address,
|
||||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
## Our Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official email address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
[mail@nlohmann.me](mailto:mail@nlohmann.me).
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series of
|
||||||
|
actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or permanent
|
||||||
|
ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||||
|
community.
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.1, available at
|
||||||
|
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
Community Impact Guidelines were inspired by
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||||
|
[https://www.contributor-covenant.org/translations][translations].
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||||
|
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||||
|
[FAQ]: https://www.contributor-covenant.org/faq
|
||||||
|
[translations]: https://www.contributor-covenant.org/translations
|
||||||
|
237
.github/CONTRIBUTING.md
vendored
237
.github/CONTRIBUTING.md
vendored
@ -1,71 +1,222 @@
|
|||||||
[](http://issuestats.com/github/nlohmann/json) [](http://issuestats.com/github/nlohmann/json)
|
# Contribution Guidelines
|
||||||
|
|
||||||
# How to contribute
|
Thank you for your interest in contributing to this project! What began as an exercise to explore the exciting features
|
||||||
|
of C++11 has evolved into a [widely used](https://json.nlohmann.me/home/customers/) JSON library. I truly appreciate all
|
||||||
|
the contributions from the community, whether it's proposing features, identifying bugs, or fixing mistakes! To ensure
|
||||||
|
that our collaboration is efficient and effective, please follow these guidelines.
|
||||||
|
|
||||||
This project started as a little excuse to exercise some of the cool new C++11 features. Over time, people actually started to use the JSON library (yey!) and started to help improve it by proposing features, finding bugs, or even fixing my mistakes. I am really [thankful](https://github.com/nlohmann/json/blob/master/README.md#thanks) for this and try to keep track of all the helpers.
|
Feel free to discuss or suggest improvements to this document
|
||||||
|
[by submitting a pull request](https://github.com/nlohmann/json/edit/develop/.github/CONTRIBUTING.md).
|
||||||
|
|
||||||
To make it as easy as possible for you to contribute and for me to keep an overview, here are a few guidelines which should help us avoid all kinds of unnecessary work or disappointment. And of course, this document is subject to discussion, so please [create an issue](https://github.com/nlohmann/json/issues/new/choose) or a pull request if you find a way to improve it!
|
## Ways to Contribute
|
||||||
|
|
||||||
## Private reports
|
There are multiple ways to contribute.
|
||||||
|
|
||||||
Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <mail@nlohmann.me>.
|
### Reporting an issue
|
||||||
|
|
||||||
## Prerequisites
|
Please [create an issue](https://github.com/nlohmann/json/issues/new/choose), assuming one does not already exist, and
|
||||||
|
describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
|
||||||
Please [create an issue](https://github.com/nlohmann/json/issues/new/choose), assuming one does not already exist, and describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
|
|
||||||
|
|
||||||
## Describe your issue
|
|
||||||
|
|
||||||
Clearly describe the issue:
|
Clearly describe the issue:
|
||||||
|
|
||||||
- If it is a bug, please describe how to **reproduce** it. If possible, attach a complete example which demonstrates the error. Please also state what you **expected** to happen instead of the error.
|
- If it is a bug, please describe how to **reproduce** it. If possible, attach a _complete example_ which demonstrates
|
||||||
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
|
the error. Please also state what you **expected** to happen instead of the error.
|
||||||
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
|
- If you propose a change or addition, try to give an **example** what the improved code could look like or how to use
|
||||||
|
it.
|
||||||
|
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste
|
||||||
|
the (relevant part of) the error messages to the ticket.
|
||||||
|
|
||||||
Please stick to the provided issue templates ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Bug_report.md), [feature request](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Feature_request.md), or [question](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/question.md)) if possible.
|
Please stick to the provided issue template
|
||||||
|
[bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/bug.yaml) if possible.
|
||||||
|
|
||||||
## Files to change
|
### Reporting a security vulnerability
|
||||||
|
|
||||||
:exclamation: Before you make any changes, note the single-header file [`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is **generated** from the source files in the [`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). Please **do not** edit file `single_include/nlohmann/json.hpp` directly, but change the `include/nlohmann` sources and regenerate file `single_include/nlohmann/json.hpp` by executing `make amalgamate`.
|
You can report a security vulnerability according to our
|
||||||
|
[security policy](https://github.com/nlohmann/json/security/policy).
|
||||||
|
|
||||||
To make changes, you need to edit the following files:
|
### Discussing a new feature
|
||||||
|
|
||||||
1. [`include/nlohmann/*`](https://github.com/nlohmann/json/tree/develop/include/nlohmann) - These files are the sources of the library. Before testing or creating a pull request, execute `make amalgamate` to regenerate `single_include/nlohmann/json.hpp`.
|
For questions, feature or support requests, please
|
||||||
|
[open a discussion](https://github.com/nlohmann/json/discussions/new). If you find a proposed answer satisfactory,
|
||||||
|
please use the "Mark as answer" button to make it easier for readers to see what helped and for the community to filter
|
||||||
|
for open questions.
|
||||||
|
|
||||||
2. [`test/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/test/src) - These files contain the [doctest](https://github.com/onqtam/doctest) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
|
### Proposing a fix or an improvement
|
||||||
|
|
||||||
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
|
Join an ongoing discussion or comment on an existing issue before starting to code. This can help to avoid duplicate
|
||||||
|
efforts or other frustration during the later review.
|
||||||
|
|
||||||
```sh
|
Create a [pull request](https://github.com/nlohmann/json/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen) against the
|
||||||
$ mkdir build
|
`develop` branch and follow the pull request template. In particular,
|
||||||
$ cd build
|
|
||||||
$ cmake ..
|
|
||||||
$ cmake --build .
|
|
||||||
$ ctest
|
|
||||||
```
|
|
||||||
|
|
||||||
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
|
- describe the changes in detail, both the what and why,
|
||||||
|
- reference existing issues where applicable,
|
||||||
|
- add tests to maintain 100% test coverage,
|
||||||
|
- update the documentation as needed, and
|
||||||
|
- ensure the source code is amalgamated.
|
||||||
|
|
||||||
|
We describe all points in detail below.
|
||||||
|
|
||||||
## Note
|
All contributions (including pull requests) must agree to the
|
||||||
|
[Developer Certificate of Origin (DCO) version 1.1](https://developercertificate.org). This is exactly the same one
|
||||||
|
created and used by the Linux kernel developers and posted on http://developercertificate.org/. This is a developer's
|
||||||
|
certification that he or she has the right to submit the patch for inclusion into the project.
|
||||||
|
|
||||||
- If you open a pull request, the code will be automatically tested with [Valgrind](http://valgrind.org)'s Memcheck tool to detect memory leaks. Please be aware that the execution with Valgrind _may_ in rare cases yield different behavior than running the code directly. This can result in failing unit tests which run successfully without Valgrind.
|
## How to...
|
||||||
- There is a Makefile target `make pretty` which runs [Artistic Style](http://astyle.sourceforge.net) to fix indentation. If possible, run it before opening the pull request. Otherwise, we shall run it afterward.
|
|
||||||
|
|
||||||
## Please don't
|
### Describe your changes
|
||||||
|
|
||||||
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
|
This library is primarily maintained as a spare-time project. As such, I cannot make any guarantee how quickly changes
|
||||||
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
|
are merged and released. Therefore, it is very important to make the review as smooth as possible by explaining not only
|
||||||
- Please refrain from proposing changes that would **break [JSON](https://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
|
_what_ you changed, but _why_. This rationale can be very valuable down the road when improvements or bugs are discussed
|
||||||
- We shall not extend the library to **support comments**. There is quite some [controversy](https://www.reddit.com/r/programming/comments/4v6chu/why_json_doesnt_support_comments_douglas_crockford/) around this topic, and there were quite some [issues](https://github.com/nlohmann/json/issues/376) on this. We believe that JSON is fine without comments.
|
years later.
|
||||||
- We do not preserve the **insertion order of object elements**. The [JSON standard](https://tools.ietf.org/html/rfc8259.html) defines objects as "an unordered collection of zero or more name/value pairs". To this end, this library does not preserve insertion order of name/value pairs. (In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default.) Note this behavior conforms to the standard, and we shall not change it to any other order. If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map).
|
|
||||||
|
|
||||||
- Please do not open pull requests that address **multiple issues**.
|
### Reference an existing issue
|
||||||
|
|
||||||
|
[Link a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue)
|
||||||
|
to clarify that a fix is forthcoming and which issue can be closed after merging. Only a few cases (e.g., fixing typos)
|
||||||
|
do not require prior discussions.
|
||||||
|
|
||||||
|
### Write tests
|
||||||
|
|
||||||
|
The library has an extensive test suite that currently covers [100 %](https://coveralls.io/github/nlohmann/json) of the
|
||||||
|
library's code. These tests are crucial to maintain API stability and give future contributors confidence that they do
|
||||||
|
not accidentally break things. As Titus Winters aptly put it:
|
||||||
|
|
||||||
|
> If you liked it, you should have put a test on it.
|
||||||
|
|
||||||
|
#### Run the tests
|
||||||
|
|
||||||
|
First, ensure the test suite runs before making any changes:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cmake -S. -B build
|
||||||
|
$ cmake --build build -j 10
|
||||||
|
$ ctest --test-dir build -j 10
|
||||||
|
```
|
||||||
|
|
||||||
|
The test suite should report:
|
||||||
|
|
||||||
|
```
|
||||||
|
100% tests passed, 0 tests failed out of 98
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Add tests
|
||||||
|
|
||||||
|
The tests are located in [`tests/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/tests/src) and contain
|
||||||
|
[doctest assertions](https://github.com/doctest/doctest/blob/master/doc/markdown/assertions.md) like `CHECK`. The tests
|
||||||
|
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.
|
||||||
|
|
||||||
|
When fixing a bug, edit `unit-regression2.cpp` and add a section referencing the fixed issue.
|
||||||
|
|
||||||
|
#### Exceptions
|
||||||
|
|
||||||
|
When you test exceptions, please use `CHECK_THROWS_WITH_AS` which also takes the `what()` argument of the thrown
|
||||||
|
exception into account.
|
||||||
|
|
||||||
|
#### Coverage
|
||||||
|
|
||||||
|
If test coverage decreases, an automatic warning comment will be posted on the pull request. You can access a code
|
||||||
|
coverage report as an artifact to the “Ubuntu” workflow.
|
||||||
|
|
||||||
|
### Update the documentation
|
||||||
|
|
||||||
|
The [main documentation](https://json.nlohmann.me) of the library is generated from the files
|
||||||
|
[`docs/mkdocs/docs`](https://github.com/nlohmann/json/blob/develop/docs/mkdocs/docs). This folder contains dedicated
|
||||||
|
pages for [certain features](https://github.com/nlohmann/json/tree/develop/docs/mkdocs/docs/features), a list of
|
||||||
|
[all exceptions](https://github.com/nlohmann/json/blob/develop/docs/mkdocs/docs/home/exceptions.md), and
|
||||||
|
[extensive API documentation](https://github.com/nlohmann/json/tree/develop/docs/mkdocs/docs/api) with details on every
|
||||||
|
public API function.
|
||||||
|
|
||||||
|
Build the documentation locally using:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make install_venv -C docs/mkdocs
|
||||||
|
make serve -C docs/mkdocs
|
||||||
|
```
|
||||||
|
|
||||||
|
The documentation will then be available at <http://127.0.0.1:8000/>. See the documentation of
|
||||||
|
[mkdocs](https://www.mkdocs.org) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for more
|
||||||
|
information.
|
||||||
|
|
||||||
|
### Amalgamate the source code
|
||||||
|
|
||||||
|
The single-header files
|
||||||
|
[`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) and
|
||||||
|
[`single_include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_fwd.hpp)
|
||||||
|
are **generated** from the source files in the
|
||||||
|
[`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). **Do not** edit the
|
||||||
|
files directly; instead, modify the include/nlohmann sources and regenerate the files by executing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make amalgamate
|
||||||
|
```
|
||||||
|
|
||||||
|
## Recommended documentation
|
||||||
|
|
||||||
|
- The library’s [README file](https://github.com/nlohmann/json/blob/master/README.md) is an excellent starting point to
|
||||||
|
understand its functionality.
|
||||||
|
- The [documentation page](https://json.nlohmann.me) is the reference documentation of the library.
|
||||||
|
- [RFC 8259](https://datatracker.ietf.org/doc/html/rfc8259) is the reference for the JavaScript Object Notation (JSON)
|
||||||
|
Data Interchange Format.
|
||||||
|
|
||||||
|
## Please don't...
|
||||||
|
|
||||||
|
Certain contributions are not helpful.
|
||||||
|
|
||||||
|
### Break the public API
|
||||||
|
|
||||||
|
We take pride in the library being used by
|
||||||
|
[numerous customers across various industries](https://json.nlohmann.me/home/customers/). They all rely on the
|
||||||
|
guarantees provided by [semantic versioning](https://semver.org). Please do not change the library such that the public
|
||||||
|
API of the 3.x.y version is broken. This includes:
|
||||||
|
|
||||||
|
- Changing function signatures (altering parameter types, return types, number of parameters) or changing the const-ness
|
||||||
|
of member functions.
|
||||||
|
- Removing functions.
|
||||||
|
- Renaming functions or classes.
|
||||||
|
- Changing exception handling.
|
||||||
|
- Changing exception ids.
|
||||||
|
- Changing access specifiers.
|
||||||
|
- Changing default arguments.
|
||||||
|
|
||||||
|
Although these guidelines may seem restrictive, they are essential for maintaining the library’s utility.
|
||||||
|
|
||||||
|
Breaking changes may be introduced when they are guarded with a feature macro such as
|
||||||
|
[`JSON_USE_IMPLICIT_CONVERSIONS`](https://json.nlohmann.me/api/macros/json_use_implicit_conversions/) which allows
|
||||||
|
selectively changing the behavior of the library. In next steps, the current behavior can then be deprecated. Using
|
||||||
|
feature macros then allows users to test their code against the library in the next major release.
|
||||||
|
|
||||||
|
### Break C++11 language conformance
|
||||||
|
|
||||||
|
This library is designed to work with C++11 and later. This means that any
|
||||||
|
[supported C++11 compiler](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers) should compile
|
||||||
|
the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual
|
||||||
|
Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support.
|
||||||
|
|
||||||
|
Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and
|
||||||
|
later against the respective [`JSON_HAS_CPP_14`](https://json.nlohmann.me/api/macros/json_has_cpp_11/) macros.
|
||||||
|
|
||||||
|
### Break JSON conformance
|
||||||
|
|
||||||
|
Please refrain from proposing changes that would **break [JSON](https://datatracker.ietf.org/doc/html/rfc8259)
|
||||||
|
conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this
|
||||||
|
extension.
|
||||||
|
|
||||||
## Wanted
|
## Wanted
|
||||||
|
|
||||||
The following areas really need contribution:
|
The following areas really need contribution and are always welcomed:
|
||||||
|
|
||||||
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions Clang.
|
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the
|
||||||
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser with hand coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for parsing.
|
bleeding-edge versions Clang.
|
||||||
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency is not everything, speed and memory consumption are very important characteristics for C++ developers, so having proper comparisons would be interesting.
|
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser
|
||||||
|
with hand-coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That
|
||||||
|
said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep
|
||||||
|
the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for
|
||||||
|
parsing.
|
||||||
|
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency
|
||||||
|
is not everything, speed and memory consumption are very important characteristics for C++ developers, so having
|
||||||
|
proper comparisons would be interesting.
|
||||||
|
|
||||||
|
We look forward to your contributions and collaboration to enhance the library!
|
||||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1,2 +1,2 @@
|
|||||||
github: nlohmann
|
github: nlohmann
|
||||||
custom: http://paypal.me/nlohmann
|
custom: https://paypal.me/nlohmann
|
||||||
|
4
.github/ISSUE_TEMPLATE/bug.yaml
vendored
4
.github/ISSUE_TEMPLATE/bug.yaml
vendored
@ -13,7 +13,7 @@ body:
|
|||||||
|
|
||||||
Note that this form is for bug reports only. Please
|
Note that this form is for bug reports only. Please
|
||||||
[open a discussion](https://github.com/nlohmann/json/discussions/new)
|
[open a discussion](https://github.com/nlohmann/json/discussions/new)
|
||||||
for questions, feature requests, or support requests
|
for questions, feature requests, or support requests.
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: summary
|
id: summary
|
||||||
attributes:
|
attributes:
|
||||||
@ -76,7 +76,7 @@ body:
|
|||||||
label: Library version
|
label: Library version
|
||||||
description: >
|
description: >
|
||||||
Which version of the library did you use? If it is a released version,
|
Which version of the library did you use? If it is a released version,
|
||||||
please enter the version number (e.g., 3.11.1). Otherwise, please enter
|
please enter the version number (e.g., 3.12.0). Otherwise, please enter
|
||||||
the commit hash. If you got the library from another source as the
|
the commit hash. If you got the library from another source as the
|
||||||
GitHub repository (e.g., via a package manager), please also state
|
GitHub repository (e.g., via a package manager), please also state
|
||||||
this.
|
this.
|
||||||
|
22
.github/PULL_REQUEST_TEMPLATE.md
vendored
22
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,19 +1,9 @@
|
|||||||
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
|
[Describe your pull request here. Please read the text below the line and make sure you follow the checklist.]
|
||||||
|
|
||||||
* * *
|
- [ ] The changes are described in detail, both the what and why.
|
||||||
|
- [ ] If applicable, an [existing issue](https://github.com/nlohmann/json/issues) is referenced.
|
||||||
## Pull request checklist
|
- [ ] 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.
|
||||||
|
- [ ] The source code is amalgamated by running `make amalgamate`.
|
||||||
|
|
||||||
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
|
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
|
||||||
|
|
||||||
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
|
|
||||||
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
|
|
||||||
- [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src).
|
|
||||||
- [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header file `single_include/nlohmann/json.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).
|
|
||||||
|
|
||||||
## Please don't
|
|
||||||
|
|
||||||
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
|
|
||||||
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
|
|
||||||
- Please refrain from proposing changes that would **break [JSON](https://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
|
|
||||||
- Please do not open pull requests that address **multiple issues**.
|
|
||||||
|
22
.github/SECURITY.md
vendored
22
.github/SECURITY.md
vendored
@ -2,4 +2,24 @@
|
|||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <mail@nlohmann.me>. You can use [this key](https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69) for encryption.
|
We value the security of our users and appreciate your efforts to responsibly disclose vulnerabilities. If you have
|
||||||
|
identified a security vulnerability in this repository, please use the GitHub Security Advisory
|
||||||
|
["Report a Vulnerability"](https://github.com/nlohmann/json/security/advisories/new) tab.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
We will send a response indicating the next steps in handling your report. After the initial reply to your report, we
|
||||||
|
will keep you informed of the progress towards a fix and full announcement and may ask for additional information or
|
||||||
|
guidance.
|
||||||
|
|
||||||
|
For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- Explore security-related topics and contribute to tools and projects through
|
||||||
|
[GitHub Security Lab](https://securitylab.github.com/).
|
||||||
|
- Learn more about responsible disclosure and reporting vulnerabilities in GitHub at
|
||||||
|
[About coordinated disclosure of security vulnerabilities](https://docs.github.com/en/code-security/repository-security-advisories/about-coordinated-disclosure-of-security-vulnerabilities).
|
||||||
|
|
||||||
|
We sincerely thank you for contributing to the security and integrity of this project!
|
||||||
|
5
.github/config.yml
vendored
5
.github/config.yml
vendored
@ -6,7 +6,7 @@ sentimentBotToxicityThreshold: .7
|
|||||||
|
|
||||||
# *Required* Comment to reply with
|
# *Required* Comment to reply with
|
||||||
sentimentBotReplyComment: >
|
sentimentBotReplyComment: >
|
||||||
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
|
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/.github/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
|
||||||
|
|
||||||
|
|
||||||
# Configuration for request-info - https://github.com/behaviorbot/request-info
|
# Configuration for request-info - https://github.com/behaviorbot/request-info
|
||||||
@ -17,3 +17,6 @@ requestInfoReplyComment: >
|
|||||||
|
|
||||||
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
|
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
|
||||||
requestInfoLabelToAdd: "state: needs more info"
|
requestInfoLabelToAdd: "state: needs more info"
|
||||||
|
|
||||||
|
checkIssueTemplate: true
|
||||||
|
checkPullRequestTemplate: true
|
||||||
|
31
.github/dependabot.yml
vendored
Normal file
31
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /docs/mkdocs
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /tools/astyle
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /tools/generate_natvis
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /tools/serve_header
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /cmake/requirements
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
24
.github/external_ci/appveyor.yml
vendored
24
.github/external_ci/appveyor.yml
vendored
@ -1,5 +1,19 @@
|
|||||||
version: '{build}'
|
version: '{build}'
|
||||||
|
|
||||||
|
# only build PRs and commits to develop branch
|
||||||
|
# (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request)
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
only_commits:
|
||||||
|
files:
|
||||||
|
- .github/external_ci/appveyor.yml
|
||||||
|
- cmake/
|
||||||
|
- include/
|
||||||
|
- tests/
|
||||||
|
- CMakeLists.txt
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
@ -27,7 +41,7 @@ environment:
|
|||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform: x86
|
platform: x86
|
||||||
CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /W4 /WX"
|
CXX_FLAGS: "/permissive- /std:c++17 /utf-8 /W4 /WX"
|
||||||
CMAKE_OPTIONS: ""
|
CMAKE_OPTIONS: ""
|
||||||
GENERATOR: Visual Studio 15 2017
|
GENERATOR: Visual Studio 15 2017
|
||||||
|
|
||||||
@ -48,7 +62,7 @@ environment:
|
|||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform: x64
|
platform: x64
|
||||||
CXX_FLAGS: "/permissive- /std:c++latest /Zc:__cplusplus /utf-8 /W4 /WX"
|
CXX_FLAGS: "/permissive- /std:c++17 /Zc:__cplusplus /utf-8 /W4 /WX"
|
||||||
CMAKE_OPTIONS: ""
|
CMAKE_OPTIONS: ""
|
||||||
GENERATOR: Visual Studio 15 2017
|
GENERATOR: Visual Studio 15 2017
|
||||||
|
|
||||||
@ -75,9 +89,3 @@ test_script:
|
|||||||
# occasional timeouts on AppVeyor.
|
# occasional timeouts on AppVeyor.
|
||||||
# More info: https://github.com/nlohmann/json/pull/1570
|
# More info: https://github.com/nlohmann/json/pull/1570
|
||||||
- if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" --parallel 2 --output-on-failure
|
- if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" --parallel 2 --output-on-failure
|
||||||
|
|
||||||
# only build PRs and commits to develop branch
|
|
||||||
# (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request)
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- develop
|
|
||||||
|
38
.github/labeler.yml
vendored
Normal file
38
.github/labeler.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
version: 1
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- label: "documentation"
|
||||||
|
files:
|
||||||
|
- "README.md"
|
||||||
|
|
||||||
|
- label: "documentation"
|
||||||
|
files:
|
||||||
|
- "docs/.*"
|
||||||
|
|
||||||
|
- label: "tests"
|
||||||
|
files:
|
||||||
|
- "tests/.*"
|
||||||
|
|
||||||
|
- label: "CMake"
|
||||||
|
files:
|
||||||
|
- ".*CMakeLists.txt"
|
||||||
|
|
||||||
|
- label: "CMake"
|
||||||
|
files:
|
||||||
|
- "cmake/.*"
|
||||||
|
|
||||||
|
- label: "CI"
|
||||||
|
files:
|
||||||
|
- "github/workflows/.*"
|
||||||
|
|
||||||
|
- label: "CI"
|
||||||
|
files:
|
||||||
|
- "github/external_ci/.*"
|
||||||
|
|
||||||
|
- label: "S"
|
||||||
|
size-below: 10
|
||||||
|
- label: "M"
|
||||||
|
size-above: 9
|
||||||
|
size-below: 100
|
||||||
|
- label: "L"
|
||||||
|
size-above: 100
|
17
.github/stale.yml
vendored
17
.github/stale.yml
vendored
@ -1,17 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 30
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: "state: stale"
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
76
.github/workflows/check_amalgamation.yml
vendored
Normal file
76
.github/workflows/check_amalgamation.yml
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
name: "Check amalgamation"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
save:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: Save PR number
|
||||||
|
run: |
|
||||||
|
mkdir -p ./pr
|
||||||
|
echo ${{ github.event.number }} > ./pr/number
|
||||||
|
echo ${{ github.event.pull_request.user.login }} > ./pr/author
|
||||||
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
|
with:
|
||||||
|
name: pr
|
||||||
|
path: pr/
|
||||||
|
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
MAIN_DIR: ${{ github.workspace }}/main
|
||||||
|
INCLUDE_DIR: ${{ github.workspace }}/main/single_include/nlohmann
|
||||||
|
TOOL_DIR: ${{ github.workspace }}/tools/tools/amalgamate
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: Checkout pull request
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: main
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Checkout tools
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
path: tools
|
||||||
|
ref: develop
|
||||||
|
|
||||||
|
- name: Install astyle
|
||||||
|
run: |
|
||||||
|
python3 -mvenv venv
|
||||||
|
venv/bin/pip3 install -r $MAIN_DIR/tools/astyle/requirements.txt
|
||||||
|
|
||||||
|
- name: Check amalgamation
|
||||||
|
run: |
|
||||||
|
cd $MAIN_DIR
|
||||||
|
|
||||||
|
rm -fr $INCLUDE_DIR/json.hpp~ $INCLUDE_DIR/json_fwd.hpp~
|
||||||
|
cp $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json.hpp~
|
||||||
|
cp $INCLUDE_DIR/json_fwd.hpp $INCLUDE_DIR/json_fwd.hpp~
|
||||||
|
|
||||||
|
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 .
|
||||||
|
echo "Format (1)"
|
||||||
|
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
|
||||||
|
|
||||||
|
diff $INCLUDE_DIR/json.hpp~ $INCLUDE_DIR/json.hpp
|
||||||
|
diff $INCLUDE_DIR/json_fwd.hpp~ $INCLUDE_DIR/json_fwd.hpp
|
||||||
|
|
||||||
|
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=orig $(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)
|
||||||
|
echo Check
|
||||||
|
find $MAIN_DIR -name '*.orig' -exec false {} \+
|
35
.github/workflows/cifuzz.yml
vendored
Normal file
35
.github/workflows/cifuzz.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
name: CIFuzz
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Fuzzing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: Build Fuzzers
|
||||||
|
id: build
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'json'
|
||||||
|
dry-run: false
|
||||||
|
language: c++
|
||||||
|
- name: Run Fuzzers
|
||||||
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
|
||||||
|
with:
|
||||||
|
oss-fuzz-project-name: 'json'
|
||||||
|
fuzz-seconds: 300
|
||||||
|
dry-run: false
|
||||||
|
language: c++
|
||||||
|
- name: Upload Crash
|
||||||
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
|
if: failure() && steps.build.outcome == 'success'
|
||||||
|
with:
|
||||||
|
name: artifacts
|
||||||
|
path: ./out/artifacts
|
43
.github/workflows/codeql-analysis.yml
vendored
43
.github/workflows/codeql-analysis.yml
vendored
@ -10,51 +10,40 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '0 19 * * 1'
|
- cron: '0 19 * * 1'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL-Build:
|
CodeQL-Build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Harden Runner
|
||||||
uses: actions/checkout@v3
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
with:
|
with:
|
||||||
# We must fetch at least the immediate parents so that if this is
|
egress-policy: audit
|
||||||
# a pull request then we can check out the head.
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
# If this run was triggered by a pull request event, then checkout
|
- name: Checkout repository
|
||||||
# the head of the pull request instead of the merge commit.
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- run: git checkout HEAD^2
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
with:
|
||||||
# with:
|
languages: c-cpp
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
|
||||||
|
|
||||||
# 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@v2
|
uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||||
|
81
.github/workflows/comment_check_amalgamation.yml
vendored
Normal file
81
.github/workflows/comment_check_amalgamation.yml
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
name: Comment Check Amalgamation
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Check amalgamation"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
comment:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
issues: read
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: 'Download artifact'
|
||||||
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
run_id: ${{github.event.workflow_run.id }},
|
||||||
|
});
|
||||||
|
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||||
|
return artifact.name == "pr"
|
||||||
|
})[0];
|
||||||
|
var download = await github.rest.actions.downloadArtifact({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
artifact_id: matchArtifact.id,
|
||||||
|
archive_format: 'zip',
|
||||||
|
});
|
||||||
|
var fs = require('fs');
|
||||||
|
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
|
||||||
|
- run: unzip pr.zip
|
||||||
|
|
||||||
|
- name: 'Comment on PR'
|
||||||
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
var fs = require('fs');
|
||||||
|
const author = fs.readFileSync('./author')
|
||||||
|
const issue_number = Number(fs.readFileSync('./number'));
|
||||||
|
const opts = github.rest.issues.listForRepo.endpoint.merge({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
creator: author,
|
||||||
|
state: 'all'
|
||||||
|
})
|
||||||
|
let first = true
|
||||||
|
const issues = await github.paginate(opts)
|
||||||
|
for (const issue of issues) {
|
||||||
|
if (issue.number === issue_number) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (issue.pull_request) {
|
||||||
|
first = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
issue_number: issue_number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: '## 🔴 Amalgamation check failed! 🔴\nThe source code has not been amalgamated.'
|
||||||
|
+ (first ? ' @' + author + ' Please read and follow the [Contribution Guidelines]'
|
||||||
|
+ '(https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).'
|
||||||
|
: '')
|
||||||
|
})
|
27
.github/workflows/dependency-review.yml
vendored
Normal file
27
.github/workflows/dependency-review.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Dependency Review Action
|
||||||
|
#
|
||||||
|
# This Action will scan dependency manifest files that change as part of a Pull Request,
|
||||||
|
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
|
||||||
|
# Once installed, if the workflow run is marked as required,
|
||||||
|
# PRs introducing known-vulnerable packages will be blocked from merging.
|
||||||
|
#
|
||||||
|
# Source repository: https://github.com/actions/dependency-review-action
|
||||||
|
name: 'Dependency Review'
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependency-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: 'Checkout Repository'
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: 'Dependency Review'
|
||||||
|
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
|
26
.github/workflows/labeler.yml
vendored
Normal file
26
.github/workflows/labeler.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: "Pull Request Labeler"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- uses: srvaroa/labeler@e7bef2249506ba9cbbd3ca5cee256abd9f930b04 # master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
96
.github/workflows/macos.yml
vendored
96
.github/workflows/macos.yml
vendored
@ -13,54 +13,108 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
xcode_1:
|
# macos-11 is deprecated
|
||||||
runs-on: macos-10.15
|
# macos-11:
|
||||||
|
# runs-on: macos-11
|
||||||
|
# strategy:
|
||||||
|
# matrix:
|
||||||
|
# xcode: ['11.7', '12.4', '12.5.1', '13.0']
|
||||||
|
# env:
|
||||||
|
# DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
#
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
# - name: Run CMake
|
||||||
|
# run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
|
# - name: Build
|
||||||
|
# run: cmake --build build --parallel 10
|
||||||
|
# - name: Test
|
||||||
|
# run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
|
# macos-12 is deprecated (https://github.com/actions/runner-images/issues/10721)
|
||||||
|
# macos-12:
|
||||||
|
# runs-on: macos-12 # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
|
||||||
|
# strategy:
|
||||||
|
# matrix:
|
||||||
|
# xcode: ['13.1', '13.2.1', '13.3.1', '13.4.1', '14.0', '14.0.1', '14.1']
|
||||||
|
# env:
|
||||||
|
# DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
#
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
# - name: Run CMake
|
||||||
|
# run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
|
# - name: Build
|
||||||
|
# run: cmake --build build --parallel 10
|
||||||
|
# - name: Test
|
||||||
|
# run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
|
macos-13:
|
||||||
|
runs-on: macos-13 # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: [12.4, 12.3, 12.2, 12.1.1, 12.1, 12, 11.7, 11.6, 11.5, 11.4.1, 11.3.1, 11.2.1, 10.3]
|
xcode: ['14.1', '14.2', '14.3', '14.3.1', '15.0.1', '15.1', '15.2']
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
xcode_2:
|
macos-14:
|
||||||
runs-on: macos-12
|
runs-on: macos-14 # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: [13.3.1, 13.3, 13.2.1, 13.2, 13.1]
|
xcode: ['15.3', '15.4']
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
|
macos-15:
|
||||||
|
runs-on: macos-15 # https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
xcode: ['16.0', '16.1', '16.2', '16.3']
|
||||||
|
env:
|
||||||
|
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --parallel 10
|
||||||
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
xcode_standards:
|
xcode_standards:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
standard: [11, 14, 17, 20]
|
standard: [11, 14, 17, 20, 23, 26]
|
||||||
env:
|
|
||||||
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_TestStandards=${{ matrix.standard }}
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_TestStandards=${{ matrix.standard }}
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
46
.github/workflows/publish_documentation.yml
vendored
Normal file
46
.github/workflows/publish_documentation.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
name: Publish documentation
|
||||||
|
|
||||||
|
# publish the documentation on every merge to develop branch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- docs/mkdocs/**
|
||||||
|
- docs/examples/**
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# we don't want to have concurrent jobs, and we don't want to cancel running jobs to avoid broken publications
|
||||||
|
concurrency:
|
||||||
|
group: documentation
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_documentation:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
if: github.repository == 'nlohmann/json'
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- name: Install virtual environment
|
||||||
|
run: make install_venv -C docs/mkdocs
|
||||||
|
|
||||||
|
- name: Build documentation
|
||||||
|
run: make build -C docs/mkdocs
|
||||||
|
|
||||||
|
- name: Deploy documentation
|
||||||
|
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./docs/mkdocs/site
|
81
.github/workflows/scorecards.yml
vendored
Normal file
81
.github/workflows/scorecards.yml
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||||
|
# by a third-party and are governed by separate terms of service, privacy
|
||||||
|
# policy, and support documentation.
|
||||||
|
|
||||||
|
name: Scorecard supply-chain security
|
||||||
|
on:
|
||||||
|
# For Branch-Protection check. Only the default branch is supported. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||||
|
branch_protection_rule:
|
||||||
|
# To guarantee Maintained check is occasionally updated. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||||
|
schedule:
|
||||||
|
- cron: '20 7 * * 2'
|
||||||
|
push:
|
||||||
|
branches: ["develop"]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecard analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Needed to publish results and get a badge (see publish_results below).
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
# To allow GraphQL ListCommits to work
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
# To detect SAST tools
|
||||||
|
checks: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||||
|
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||||
|
# - you are installing Scorecards on a *private* repository
|
||||||
|
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
|
||||||
|
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||||
|
|
||||||
|
# Public repositories:
|
||||||
|
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||||
|
# - Allows the repository to include the Scorecard badge.
|
||||||
|
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||||
|
# For private repositories:
|
||||||
|
# - `publish_results` will always be set to `false`, regardless
|
||||||
|
# of the value entered here.
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
|
# format to the repository Actions tab.
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
34
.github/workflows/stale.yml
vendored
Normal file
34
.github/workflows/stale.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
name: 'Comment and close stale issues and PR'
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden Runner
|
||||||
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||||
|
with:
|
||||||
|
stale-issue-label: 'state: stale'
|
||||||
|
stale-pr-label: 'state: stale'
|
||||||
|
exempt-issue-labels: 'pinned,security'
|
||||||
|
stale-issue-message: 'This issue has been marked as stale because it has been open for 90 days without activity. If this issue is still relevant, please add a comment or remove the "stale" label. Otherwise, it will be closed in 10 days. Thank you for helping us prioritize our work!'
|
||||||
|
stale-pr-message: 'This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!'
|
||||||
|
close-issue-message: 'This issue has been closed after being marked as stale for 10 days without any further activity. If this was done in error or the issue is still relevant, please feel free to reopen it or create a new issue. We appreciate your understanding and contributions.'
|
||||||
|
days-before-stale: 90
|
||||||
|
days-before-pr-stale: 30
|
||||||
|
days-before-close: 10
|
||||||
|
days-before-pr-close: -1
|
276
.github/workflows/ubuntu.yml
vendored
276
.github/workflows/ubuntu.yml
vendored
@ -9,150 +9,276 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci_test_clang:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
|
||||||
- name: build
|
|
||||||
run: cmake --build build --target ci_test_clang
|
|
||||||
|
|
||||||
ci_test_gcc:
|
ci_test_gcc:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: gcc:latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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_test_gcc
|
run: cmake --build build --target ci_test_gcc
|
||||||
|
|
||||||
ci_static_analysis:
|
ci_infer:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target ci_infer
|
||||||
|
|
||||||
|
ci_static_analysis_ubuntu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_clang_tidy, ci_cppcheck, ci_test_valgrind, ci_test_clang_sanitizer, ci_test_amalgamation, ci_clang_analyze, ci_cpplint, ci_cmake_flags, ci_single_binaries, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_infer]
|
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:
|
||||||
- uses: actions/checkout@v3
|
- name: Harden Runner
|
||||||
- name: cmake
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: Install Valgrind
|
||||||
|
run: sudo apt-get update ; sudo apt-get install -y valgrind
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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 }}
|
||||||
|
|
||||||
ci_test_single_header:
|
ci_static_analysis_clang:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: silkeh/clang:dev
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [ci_test_clang, ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze, ci_single_binaries]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Install git, clang-tools, iwyu (ci_single_binaries), and unzip
|
||||||
- name: cmake
|
run: apt-get update ; apt-get install -y git clang-tools iwyu unzip
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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_test_single_header
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
|
||||||
ci_cmake_options:
|
ci_cmake_options:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ubuntu:focal
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [ci_test_diagnostics, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls]
|
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:
|
||||||
- uses: actions/checkout@v3
|
- name: Install build-essential
|
||||||
- name: cmake
|
run: apt-get update ; apt-get install -y build-essential unzip wget git libssl-dev
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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 }}
|
||||||
|
|
||||||
ci_test_coverage:
|
ci_test_coverage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Harden Runner
|
||||||
- name: cmake
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Install dependencies and de_DE locale
|
||||||
|
run: |
|
||||||
|
sudo apt-get clean
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y build-essential cmake lcov ninja-build make locales gcc-multilib g++-multilib
|
||||||
|
sudo locale-gen de_DE
|
||||||
|
sudo update-locale
|
||||||
|
- 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_test_coverage
|
run: cmake --build build --target ci_test_coverage
|
||||||
- name: archive coverage report
|
- name: Archive coverage report
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
name: code-coverage-report
|
name: code-coverage-report
|
||||||
path: /__w/json/json/build/html
|
path: ${{ github.workspace }}/build/html
|
||||||
- name: Coveralls
|
- name: Publish report to Coveralls
|
||||||
uses: coverallsapp/github-action@master
|
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path-to-lcov: /__w/json/json/build/json.info.filtered.noexcept
|
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept
|
||||||
|
|
||||||
ci_test_compilers:
|
ci_test_compilers_gcc_old:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
compiler: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, g++-11, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12, clang++-13, clang++-14]
|
compiler: ['4.8', '4.9', '5', '6']
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
|
||||||
- name: build
|
|
||||||
run: cmake --build build --target ci_test_compiler_${{ matrix.compiler }}
|
|
||||||
|
|
||||||
ci_test_standards:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Run CMake
|
||||||
|
run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target ci_test_compiler_g++-${{ matrix.compiler }}
|
||||||
|
|
||||||
|
ci_test_compilers_gcc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
standard: [11, 14, 17, 20]
|
# older GCC docker images (4, 5, 6) fail to check out code
|
||||||
compiler: [gcc, clang]
|
compiler: ['7', '8', '9', '10', '11', '12', '13', '14', '15', 'latest']
|
||||||
|
container: gcc:${{ matrix.compiler }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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_test_${{ matrix.compiler }}_cxx${{ matrix.standard }}
|
run: cmake --build build --target ci_test_compiler_default
|
||||||
|
|
||||||
|
ci_test_compilers_clang:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
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', 'latest']
|
||||||
|
container: silkeh/clang:${{ matrix.compiler }}
|
||||||
|
steps:
|
||||||
|
- name: Install unzip and git
|
||||||
|
run: apt-get update ; apt-get install -y unzip git
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- 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"
|
||||||
|
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target ci_test_compiler_default
|
||||||
|
|
||||||
|
ci_test_standards_gcc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: gcc:latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
standard: [11, 14, 17, 20, 23, 26]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target ci_test_gcc_cxx${{ matrix.standard }}
|
||||||
|
|
||||||
|
ci_test_standards_clang:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: silkeh/clang:latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
standard: [11, 14, 17, 20, 23, 26]
|
||||||
|
stdlib: [libcxx, libstdcxx]
|
||||||
|
steps:
|
||||||
|
- name: Install git and unzip
|
||||||
|
run: apt-get update ; apt-get install -y git unzip
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build with libc++
|
||||||
|
run: cmake --build build --target ci_test_clang_libcxx_cxx${{ matrix.standard }}
|
||||||
|
if: ${{ matrix.stdlib == 'libcxx' }}
|
||||||
|
- name: Build with libstdc++
|
||||||
|
run: cmake --build build --target ci_test_clang_cxx${{ matrix.standard }}
|
||||||
|
if: ${{ matrix.stdlib == 'libstdcxx' }}
|
||||||
|
|
||||||
ci_cuda_example:
|
ci_cuda_example:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: 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_cuda_example
|
run: cmake --build build --target ci_cuda_example
|
||||||
|
|
||||||
|
ci_module_cpp20:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
container: ['gcc:latest', 'silkeh/clang:latest']
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target ci_module_cpp20
|
||||||
|
|
||||||
ci_icpc:
|
ci_icpc:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nlohmann/json-ci:v2.2.0
|
container: ghcr.io/nlohmann/json-ci:v2.2.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: 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: |
|
run: |
|
||||||
. /opt/intel/oneapi/setvars.sh
|
. /opt/intel/oneapi/setvars.sh
|
||||||
cmake --build build --target ci_icpc
|
cmake --build build --target ci_icpc
|
||||||
ci_reuse_compliance:
|
|
||||||
|
ci_emscripten:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Harden Runner
|
||||||
- uses: actions/setup-python@v3
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
- name: install REUSE tool
|
with:
|
||||||
run: python -m pip install reuse
|
egress-policy: audit
|
||||||
- name: REUSE lint
|
|
||||||
run: reuse lint
|
- name: Install emscripten
|
||||||
|
uses: mymindstorm/setup-emsdk@v14
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -GNinja
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build
|
||||||
|
|
||||||
ci_test_documentation:
|
ci_test_documentation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [ci_test_examples, ci_test_build_documentation]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Harden Runner
|
||||||
- name: cmake
|
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- 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_test_documentation
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
158
.github/workflows/windows.yml
vendored
158
.github/workflows/windows.yml
vendored
@ -9,143 +9,105 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mingw:
|
mingw:
|
||||||
runs-on: windows-latest
|
runs-on: windows-2019
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
architecture: [x64, x86]
|
architecture: [x64, x86]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Download MinGW 8.1.0
|
- name: Set up MinGW
|
||||||
run: |
|
uses: egor-tensin/setup-mingw@84c781b557efd538dec66bde06988d81cd3138cf # v2.2.0
|
||||||
$headers = @{Authorization = 'Bearer ${{ secrets.GITHUB_TOKEN }}'}
|
with:
|
||||||
$uri = 'https://nuget.pkg.github.com/falbrechtskirchinger/download/mingw/8.1.0/mingw.8.1.0.nupkg'
|
platform: ${{ matrix.architecture }}
|
||||||
Invoke-WebRequest -Uri $uri -Headers $headers -OutFile mingw.8.1.0.nupkg
|
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
|
||||||
- name: Uninstall MinGW
|
- name: Run CMake
|
||||||
continue-on-error: true
|
|
||||||
run: choco uninstall mingw
|
|
||||||
# Based on egor-tensin/setup-mingw
|
|
||||||
- name: Install MinGW 8.1.0
|
|
||||||
run: |
|
|
||||||
choco install mingw.8.1.0.nupkg ${{ matrix.architecture == 'x86' && '--x86' || '' }}
|
|
||||||
$prefix = "${{ matrix.architecture == 'x64' && 'x86_64-w64-mingw32' || 'i686-w64-mingw32' }}"
|
|
||||||
$mingw = "${{ matrix.architecture == 'x64' && 'mingw64' || 'mingw32' }}"
|
|
||||||
$mingw_install = Join-Path C: ProgramData chocolatey lib mingw tools install
|
|
||||||
$mingw_root = Join-Path $mingw_install $mingw
|
|
||||||
$mingw_bin = Join-Path $mingw_root bin
|
|
||||||
$mingw_lib = Join-Path $mingw_root $prefix lib
|
|
||||||
echo $mingw_bin >> $env:GITHUB_PATH
|
|
||||||
Remove-Item (Join-Path $mingw_lib 'libpthread.dll.a')
|
|
||||||
Remove-Item (Join-Path $mingw_lib 'libwinpthread.dll.a')
|
|
||||||
#- name: Set up MinGW
|
|
||||||
# uses: egor-tensin/setup-mingw@v2
|
|
||||||
# with:
|
|
||||||
# platform: ${{ matrix.architecture }}
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
run: cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
||||||
|
|
||||||
msvc2019:
|
msvc:
|
||||||
runs-on: windows-2019
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
runs_on: [windows-2019, windows-2022]
|
||||||
build_type: [Debug, Release]
|
build_type: [Debug, Release]
|
||||||
architecture: [Win32, x64]
|
architecture: [Win32, x64]
|
||||||
|
std_version: [default, latest]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.runs_on }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Set generator
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
id: generator
|
||||||
if: matrix.build_type == 'Release'
|
run: |
|
||||||
- name: cmake
|
if [ "${{ matrix.runs_on }}" = "windows-2019" ]; then
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
echo "generator=Visual Studio 16 2019" >> $GITHUB_ENV
|
||||||
if: matrix.build_type == 'Debug'
|
else
|
||||||
- name: build
|
echo "generator=Visual Studio 17 2022" >> $GITHUB_ENV
|
||||||
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
fi
|
||||||
- name: test
|
shell: bash
|
||||||
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
- name: Set extra CXX_FLAGS for latest std_version
|
||||||
|
id: cxxflags
|
||||||
msvc2019_latest:
|
run: |
|
||||||
runs-on: windows-2019
|
if [ "${{ matrix.std_version }}" = "latest" ]; then
|
||||||
|
echo "flags=/permissive- /std:c++latest /utf-8 /W4 /WX" >> $GITHUB_ENV
|
||||||
steps:
|
else
|
||||||
- uses: actions/checkout@v3
|
echo "flags=/W4 /WX" >> $GITHUB_ENV
|
||||||
- name: cmake
|
fi
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
shell: bash
|
||||||
- name: build
|
- name: Run CMake (Release)
|
||||||
run: cmake --build build --config Release --parallel 10
|
run: cmake -S . -B build -G "$env:generator" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags"
|
||||||
- name: test
|
if: matrix.build_type == 'Release'
|
||||||
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
shell: pwsh
|
||||||
|
- name: Run CMake (Debug)
|
||||||
msvc2022:
|
run: cmake -S . -B build -G "$env:generator" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags"
|
||||||
runs-on: windows-2022
|
if: matrix.build_type == 'Debug'
|
||||||
strategy:
|
shell: pwsh
|
||||||
matrix:
|
- name: Build
|
||||||
build_type: [Debug, Release]
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
||||||
architecture: [Win32, x64]
|
- name: Test
|
||||||
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
|
||||||
if: matrix.build_type == 'Release'
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
|
||||||
if: matrix.build_type == 'Debug'
|
|
||||||
- name: build
|
|
||||||
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
|
||||||
- name: test
|
|
||||||
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
|
||||||
|
|
||||||
msvc2022_latest:
|
|
||||||
runs-on: windows-2022
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: cmake
|
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
|
||||||
- name: build
|
|
||||||
run: cmake --build build --config Release --parallel 10
|
|
||||||
- name: test
|
|
||||||
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
|
||||||
|
|
||||||
clang:
|
clang:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
version: [11, 12]
|
version: [11, 12, 13, 14, 15]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: install Clang
|
- name: Install Clang
|
||||||
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
|
|
||||||
clang-cl-11:
|
clang-cl-12:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
architecture: [Win32, x64]
|
architecture: [Win32, x64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config Debug --parallel 10
|
run: cmake --build build --config Debug --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
|
18
.gitignore
vendored
18
.gitignore
vendored
@ -4,9 +4,6 @@
|
|||||||
*.gcda
|
*.gcda
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
.wsjcpp-logs/*
|
|
||||||
.wsjcpp/*
|
|
||||||
|
|
||||||
/.idea
|
/.idea
|
||||||
/cmake-build-*
|
/cmake-build-*
|
||||||
|
|
||||||
@ -26,12 +23,11 @@
|
|||||||
/tests/parse_*_fuzzer
|
/tests/parse_*_fuzzer
|
||||||
|
|
||||||
# documentation
|
# documentation
|
||||||
/docs/docset/docSet.dsidx
|
|
||||||
/docs/docset/JSON_for_Modern_C++.docset/
|
/docs/docset/JSON_for_Modern_C++.docset/
|
||||||
/docs/docset/JSON_for_Modern_C++.tgz
|
/docs/docset/JSON_for_Modern_C++.tgz
|
||||||
|
/docs/docset/docSet.dsidx
|
||||||
|
/docs/mkdocs/.cache/
|
||||||
/docs/mkdocs/docs/__pycache__/
|
/docs/mkdocs/docs/__pycache__/
|
||||||
/docs/mkdocs/docs/examples/
|
|
||||||
/docs/mkdocs/docs/images/json.gif
|
|
||||||
/docs/mkdocs/site/
|
/docs/mkdocs/site/
|
||||||
/docs/mkdocs/venv/
|
/docs/mkdocs/venv/
|
||||||
|
|
||||||
@ -39,3 +35,13 @@
|
|||||||
/localhost.pem
|
/localhost.pem
|
||||||
/localhost-key.pem
|
/localhost-key.pem
|
||||||
/serve_header.yml
|
/serve_header.yml
|
||||||
|
|
||||||
|
# Swift Package Manager build directory
|
||||||
|
/.build
|
||||||
|
|
||||||
|
venv
|
||||||
|
|
||||||
|
nlohmann_json.spdx
|
||||||
|
|
||||||
|
# Bazel-related
|
||||||
|
MODULE.bazel.lock
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
# REUSE Software
|
|
||||||
|
|
||||||
This directory contains supporting files to make the project compliant with the REUSE specification.
|
|
||||||
|
|
||||||
The root `Makefile` contains a target `reuse` that updates copyright headers and checks for compliance.
|
|
||||||
|
|
||||||
See <http://reuse.software> for more information.
|
|
16
.reuse/dep5
16
.reuse/dep5
@ -4,11 +4,15 @@ Upstream-Contact: Niels Lohmann <mail@nlohmann.me>
|
|||||||
Source: https://github.com/nlohmann/json
|
Source: https://github.com/nlohmann/json
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 2013-2022 Niels Lohmann <https://nlohmann.me>
|
Copyright: 2013-2025 Niels Lohmann <https://nlohmann.me>
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
|
Files: include/nlohmann/thirdparty/hedley.hpp
|
||||||
|
Copyright: 2016-2021 Evan Nemerson <evan@nemerson.com>
|
||||||
|
License: CC0
|
||||||
|
|
||||||
Files: tests/thirdparty/doctest/*
|
Files: tests/thirdparty/doctest/*
|
||||||
Copyright: 2016-2021 Viktor Kirilov
|
Copyright: 2016-2023 Viktor Kirilov
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
Files: tests/thirdparty/fifo_map/*
|
Files: tests/thirdparty/fifo_map/*
|
||||||
@ -16,7 +20,7 @@ Copyright: 2015-2017 Niels Lohmann
|
|||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
Files: tests/thirdparty/Fuzzer/*
|
Files: tests/thirdparty/Fuzzer/*
|
||||||
Copyright: 2003-2022, LLVM Project.
|
Copyright: 2003-2022 LLVM Project.
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
|
|
||||||
Files: tests/thirdparty/imapdl/*
|
Files: tests/thirdparty/imapdl/*
|
||||||
@ -27,10 +31,6 @@ Files: tools/amalgamate/*
|
|||||||
Copyright: 2012 Erik Edlund <erik.edlund@32767.se>
|
Copyright: 2012 Erik Edlund <erik.edlund@32767.se>
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
|
|
||||||
Files: tools/cpplint/*
|
Files: tools/gdb_pretty_printer/*
|
||||||
Copyright: 2009 Google Inc. All rights reserved.
|
|
||||||
License: BSD-3-Clause
|
|
||||||
|
|
||||||
Files: tools/gdb_pretty_printer
|
|
||||||
Copyright: 2020 Hannes Domani <https://github.com/ssbssa>
|
Copyright: 2020 Hannes Domani <https://github.com/ssbssa>
|
||||||
License: MIT
|
License: MIT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
__ _____ _____ _____
|
__ _____ _____ _____
|
||||||
__| | __| | | | JSON for Modern C++
|
__| | __| | | | JSON for Modern C++
|
||||||
| | |__ | | | | | | version 3.11.1
|
| | |__ | | | | | | version 3.12.0
|
||||||
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||||
|
|
||||||
{% for copyright_line in copyright_lines %}
|
{% for copyright_line in copyright_lines %}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
__ _____ _____ _____
|
__ _____ _____ _____
|
||||||
__| | __| | | | JSON for Modern C++ (supporting code)
|
__| | __| | | | JSON for Modern C++ (supporting code)
|
||||||
| | |__ | | | | | | version 3.11.1
|
| | |__ | | | | | | version 3.12.0
|
||||||
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||||
|
|
||||||
{% for copyright_line in copyright_lines %}
|
{% for copyright_line in copyright_lines %}
|
||||||
|
80
BUILD.bazel
Normal file
80
BUILD.bazel
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
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",
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "json",
|
||||||
|
hdrs = [
|
||||||
|
"include/nlohmann/adl_serializer.hpp",
|
||||||
|
"include/nlohmann/byte_container_with_subtype.hpp",
|
||||||
|
"include/nlohmann/detail/abi_macros.hpp",
|
||||||
|
"include/nlohmann/detail/conversions/from_json.hpp",
|
||||||
|
"include/nlohmann/detail/conversions/to_chars.hpp",
|
||||||
|
"include/nlohmann/detail/conversions/to_json.hpp",
|
||||||
|
"include/nlohmann/detail/exceptions.hpp",
|
||||||
|
"include/nlohmann/detail/hash.hpp",
|
||||||
|
"include/nlohmann/detail/input/binary_reader.hpp",
|
||||||
|
"include/nlohmann/detail/input/input_adapters.hpp",
|
||||||
|
"include/nlohmann/detail/input/json_sax.hpp",
|
||||||
|
"include/nlohmann/detail/input/lexer.hpp",
|
||||||
|
"include/nlohmann/detail/input/parser.hpp",
|
||||||
|
"include/nlohmann/detail/input/position_t.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/internal_iterator.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/iter_impl.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/iteration_proxy.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/iterator_traits.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/json_reverse_iterator.hpp",
|
||||||
|
"include/nlohmann/detail/iterators/primitive_iterator.hpp",
|
||||||
|
"include/nlohmann/detail/json_custom_base_class.hpp",
|
||||||
|
"include/nlohmann/detail/json_pointer.hpp",
|
||||||
|
"include/nlohmann/detail/json_ref.hpp",
|
||||||
|
"include/nlohmann/detail/macro_scope.hpp",
|
||||||
|
"include/nlohmann/detail/macro_unscope.hpp",
|
||||||
|
"include/nlohmann/detail/meta/call_std/begin.hpp",
|
||||||
|
"include/nlohmann/detail/meta/call_std/end.hpp",
|
||||||
|
"include/nlohmann/detail/meta/cpp_future.hpp",
|
||||||
|
"include/nlohmann/detail/meta/detected.hpp",
|
||||||
|
"include/nlohmann/detail/meta/identity_tag.hpp",
|
||||||
|
"include/nlohmann/detail/meta/is_sax.hpp",
|
||||||
|
"include/nlohmann/detail/meta/std_fs.hpp",
|
||||||
|
"include/nlohmann/detail/meta/type_traits.hpp",
|
||||||
|
"include/nlohmann/detail/meta/void_t.hpp",
|
||||||
|
"include/nlohmann/detail/output/binary_writer.hpp",
|
||||||
|
"include/nlohmann/detail/output/output_adapters.hpp",
|
||||||
|
"include/nlohmann/detail/output/serializer.hpp",
|
||||||
|
"include/nlohmann/detail/string_concat.hpp",
|
||||||
|
"include/nlohmann/detail/string_escape.hpp",
|
||||||
|
"include/nlohmann/detail/string_utils.hpp",
|
||||||
|
"include/nlohmann/detail/value_t.hpp",
|
||||||
|
"include/nlohmann/json.hpp",
|
||||||
|
"include/nlohmann/json_fwd.hpp",
|
||||||
|
"include/nlohmann/ordered_map.hpp",
|
||||||
|
"include/nlohmann/thirdparty/hedley/hedley.hpp",
|
||||||
|
"include/nlohmann/thirdparty/hedley/hedley_undef.hpp",
|
||||||
|
],
|
||||||
|
includes = ["include"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
alwayslink = True,
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "singleheader-json",
|
||||||
|
hdrs = [
|
||||||
|
"single_include/nlohmann/json.hpp",
|
||||||
|
],
|
||||||
|
includes = ["single_include"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
@ -7,8 +7,8 @@ authors:
|
|||||||
email: mail@nlohmann.me
|
email: mail@nlohmann.me
|
||||||
website: https://nlohmann.me
|
website: https://nlohmann.me
|
||||||
title: "JSON for Modern C++"
|
title: "JSON for Modern C++"
|
||||||
version: 3.11.1
|
version: 3.12.0
|
||||||
date-released: 2022-01-03
|
date-released: 2025-04-07
|
||||||
license: MIT
|
license: MIT
|
||||||
repository-code: "https://github.com/nlohmann"
|
repository-code: "https://github.com/nlohmann"
|
||||||
url: https://json.nlohmann.me
|
url: https://json.nlohmann.me
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.5...4.0)
|
||||||
|
|
||||||
##
|
##
|
||||||
## PROJECT
|
## PROJECT
|
||||||
## name and version
|
## name and version
|
||||||
##
|
##
|
||||||
project(nlohmann_json VERSION 3.11.1 LANGUAGES CXX)
|
project(nlohmann_json VERSION 3.12.0 LANGUAGES CXX)
|
||||||
|
|
||||||
##
|
##
|
||||||
## MAIN_PROJECT CHECK
|
## MAIN_PROJECT CHECK
|
||||||
@ -40,10 +40,11 @@ endif()
|
|||||||
option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ${JSON_BuildTests_INIT})
|
option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ${JSON_BuildTests_INIT})
|
||||||
option(JSON_CI "Enable CI build targets." OFF)
|
option(JSON_CI "Enable CI build targets." OFF)
|
||||||
option(JSON_Diagnostics "Use extended diagnostic messages." OFF)
|
option(JSON_Diagnostics "Use extended diagnostic messages." OFF)
|
||||||
option(JSON_GlobalUDLs "Place use-defined string literals in the global namespace." ON)
|
option(JSON_Diagnostic_Positions "Enable diagnostic positions." OFF)
|
||||||
|
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_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)
|
||||||
@ -57,7 +58,11 @@ endif ()
|
|||||||
##
|
##
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
|
if (NOT DEFINED NLOHMANN_JSON_TARGET_NAME)
|
||||||
|
# Allow overriding the target name when using FetchContent / add_subdirectory.
|
||||||
|
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
|
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
|
||||||
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||||
@ -77,19 +82,27 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT JSON_ImplicitConversions)
|
if (NOT JSON_ImplicitConversions)
|
||||||
message(STATUS "Implicit conversions are disabled")
|
message(STATUS "Implicit conversions are disabled (JSON_USE_IMPLICIT_CONVERSIONS=0)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_DisableEnumSerialization)
|
if (JSON_DisableEnumSerialization)
|
||||||
message(STATUS "Enum integer serialization is disabled")
|
message(STATUS "Enum integer serialization is disabled (JSON_DISABLE_ENUM_SERIALIZATION=0)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_LegacyDiscardedValueComparison)
|
if (JSON_LegacyDiscardedValueComparison)
|
||||||
message(STATUS "Legacy discarded value comparison enabled")
|
message(STATUS "Legacy discarded value comparison enabled (JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_Diagnostics)
|
if (JSON_Diagnostics)
|
||||||
message(STATUS "Diagnostics enabled")
|
message(STATUS "Diagnostics enabled (JSON_DIAGNOSTICS=1)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (JSON_Diagnostic_Positions)
|
||||||
|
message(STATUS "Diagnostic positions enabled (JSON_DIAGNOSTIC_POSITIONS=1)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT JSON_GlobalUDLs)
|
||||||
|
message(STATUS "User-defined string literals are not put in the global namespace (JSON_USE_GLOBAL_UDLS=0)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (JSON_SystemInclude)
|
if (JSON_SystemInclude)
|
||||||
@ -115,6 +128,7 @@ target_compile_definitions(
|
|||||||
$<$<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_Diagnostics}>:JSON_DIAGNOSTICS=1>
|
$<$<BOOL:${JSON_Diagnostics}>:JSON_DIAGNOSTICS=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>
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -122,7 +136,7 @@ target_include_directories(
|
|||||||
${NLOHMANN_JSON_TARGET_NAME}
|
${NLOHMANN_JSON_TARGET_NAME}
|
||||||
${NLOHMANN_JSON_SYSTEM_INCLUDE} INTERFACE
|
${NLOHMANN_JSON_SYSTEM_INCLUDE} INTERFACE
|
||||||
$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_BUILD_DIR}>
|
$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_BUILD_DIR}>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
## add debug view definition file for msvc (natvis)
|
## add debug view definition file for msvc (natvis)
|
||||||
@ -141,6 +155,7 @@ endif()
|
|||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkg-config.pc.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkg-config.pc.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -206,4 +221,5 @@ if(JSON_Install)
|
|||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
DESTINATION ${NLOHMANN_JSON_PKGCONFIG_INSTALL_DIR}
|
DESTINATION ${NLOHMANN_JSON_PKGCONFIG_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
|
include(CPack)
|
||||||
endif()
|
endif()
|
||||||
|
395
ChangeLog.md
395
ChangeLog.md
@ -1,9 +1,380 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [3.11.1](https://github.com/nlohmann/json/releases/tag/3.11.1) (2022-08-01)
|
## [unreleased](https://github.com/nlohmann/json/releases/tag/unreleased) (2024-12-22)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.0...3.11.1)
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.3...unreleased)
|
||||||
|
|
||||||
|
- Impossible de read json file create with nlohmann::ordered\_json::dump [\#4556](https://github.com/nlohmann/json/issues/4556)
|
||||||
|
- Error C2039 : 'json\_sax\_dom\_callback\_parser': is not a member of 'nlohmann::json\_abi\_v3\_11\_3::detail' [\#4529](https://github.com/nlohmann/json/issues/4529)
|
||||||
|
- `json_fwd.hpp` don't define default template arguments for ordered\_map [\#4518](https://github.com/nlohmann/json/issues/4518)
|
||||||
|
- new repo version seems stop create any the ingress-nginx controller with opentelemetry-cpp.git [\#4515](https://github.com/nlohmann/json/issues/4515)
|
||||||
|
- Error converting to/from scoped enumerations [\#4499](https://github.com/nlohmann/json/issues/4499)
|
||||||
|
- Default initialized iterators are not comparable [\#4493](https://github.com/nlohmann/json/issues/4493)
|
||||||
|
- Bug json.exception.type\_error.302 [\#4492](https://github.com/nlohmann/json/issues/4492)
|
||||||
|
- tests fail to build with clang-19 and libc++ due to unsupported `std::char_traits` [\#4490](https://github.com/nlohmann/json/issues/4490)
|
||||||
|
- Brace-Initialization Fails with json::parse and Key Access on Linux [\#4488](https://github.com/nlohmann/json/issues/4488)
|
||||||
|
- Crash when parsing nullptr [\#4485](https://github.com/nlohmann/json/issues/4485)
|
||||||
|
- Namespace macros are not respected in many instances [\#4484](https://github.com/nlohmann/json/issues/4484)
|
||||||
|
- ohos model to json string garbage characters [\#4481](https://github.com/nlohmann/json/issues/4481)
|
||||||
|
- Missing newlines in deserialized string [\#4479](https://github.com/nlohmann/json/issues/4479)
|
||||||
|
- Latest tag not available on NuGet [\#4478](https://github.com/nlohmann/json/issues/4478)
|
||||||
|
- Invalid union access for get\_ref/get\_ptr with unsigned integer [\#4475](https://github.com/nlohmann/json/issues/4475)
|
||||||
|
- /accesswallet [\#4469](https://github.com/nlohmann/json/issues/4469)
|
||||||
|
- struct reflect json with error C2440 [\#4467](https://github.com/nlohmann/json/issues/4467)
|
||||||
|
- Compiler error when using macro NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE [\#4463](https://github.com/nlohmann/json/issues/4463)
|
||||||
|
- Issue when dumping a vector of derived classes [\#4462](https://github.com/nlohmann/json/issues/4462)
|
||||||
|
- whit std::wstring compile error [\#4460](https://github.com/nlohmann/json/issues/4460)
|
||||||
|
- Inconsisten operator\[\] [\#4458](https://github.com/nlohmann/json/issues/4458)
|
||||||
|
- json parse enclosing json object with \[\] [\#4457](https://github.com/nlohmann/json/issues/4457)
|
||||||
|
- \[bug\] nlohmann::json constructor behaves improperly [\#4450](https://github.com/nlohmann/json/issues/4450)
|
||||||
|
- parse OOM [\#4449](https://github.com/nlohmann/json/issues/4449)
|
||||||
|
- Library Cannot Parse JSON File It Wrote [\#4448](https://github.com/nlohmann/json/issues/4448)
|
||||||
|
- Unexpected Integer Conversion of JSON Values on ARM64 [\#4447](https://github.com/nlohmann/json/issues/4447)
|
||||||
|
- Structure declared in natvis file template doesn't seem to match current structure of `basic_json<>` [\#4438](https://github.com/nlohmann/json/issues/4438)
|
||||||
|
- A lot of EOT in json file [\#4436](https://github.com/nlohmann/json/issues/4436)
|
||||||
|
- CVE-2024-34062 [\#4429](https://github.com/nlohmann/json/issues/4429)
|
||||||
|
- CVE-2024-39689 [\#4428](https://github.com/nlohmann/json/issues/4428)
|
||||||
|
- CVE-2024-5569 [\#4427](https://github.com/nlohmann/json/issues/4427)
|
||||||
|
- CVE-2024-37891 [\#4426](https://github.com/nlohmann/json/issues/4426)
|
||||||
|
- Tornado vulnerabilities [\#4425](https://github.com/nlohmann/json/issues/4425)
|
||||||
|
- CVE-2024-35195 [\#4424](https://github.com/nlohmann/json/issues/4424)
|
||||||
|
- CVE-2024-22195, CVE-2024-34064 [\#4423](https://github.com/nlohmann/json/issues/4423)
|
||||||
|
- CVE-2024-3651 [\#4422](https://github.com/nlohmann/json/issues/4422)
|
||||||
|
- CVE-2024-22190 [\#4421](https://github.com/nlohmann/json/issues/4421)
|
||||||
|
- CVE-2024-39705 [\#4420](https://github.com/nlohmann/json/issues/4420)
|
||||||
|
- Failing to read complex Unicode string embedded in JSON [\#4417](https://github.com/nlohmann/json/issues/4417)
|
||||||
|
- Unable to parse JSON string from snake case to camel case [\#4399](https://github.com/nlohmann/json/issues/4399)
|
||||||
|
- Crashes when I try to use ‘json::at\(\)’ on a properly structured, non null, and correctly constructed ‘.json’ file [\#4387](https://github.com/nlohmann/json/issues/4387)
|
||||||
|
- JSON\_BuildTests fail when JSON\_DisableEnumSerialization is set to ON [\#4384](https://github.com/nlohmann/json/issues/4384)
|
||||||
|
- JSON can't parse a simple data [\#4383](https://github.com/nlohmann/json/issues/4383)
|
||||||
|
- json.exception.type\_error.302 [\#4373](https://github.com/nlohmann/json/issues/4373)
|
||||||
|
- iteration\_proxy has limited usefulness in C++20 range views [\#4371](https://github.com/nlohmann/json/issues/4371)
|
||||||
|
- Clone is long due to large history [\#4370](https://github.com/nlohmann/json/issues/4370)
|
||||||
|
- Can't use nlohmann on Linux [\#4363](https://github.com/nlohmann/json/issues/4363)
|
||||||
|
- CodeQL suppressions lack justification [\#4361](https://github.com/nlohmann/json/issues/4361)
|
||||||
|
- \[json.exception.parse\_error.101\] parse error at line 1, column 4520: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '".\? [\#4352](https://github.com/nlohmann/json/issues/4352)
|
||||||
|
- Cannot unflatten json object [\#4349](https://github.com/nlohmann/json/issues/4349)
|
||||||
|
- Json parsed from raw string does not interpret lists of objects like json parsed from file [\#4341](https://github.com/nlohmann/json/issues/4341)
|
||||||
|
- natvis not updated to 3.11.3 [\#4340](https://github.com/nlohmann/json/issues/4340)
|
||||||
|
- Wrong function name in documentation example [\#4334](https://github.com/nlohmann/json/issues/4334)
|
||||||
|
- git ref got interpreted as number [\#4332](https://github.com/nlohmann/json/issues/4332)
|
||||||
|
- Is float valid number been limited? [\#4322](https://github.com/nlohmann/json/issues/4322)
|
||||||
|
- Crash when construct a new json object [\#4321](https://github.com/nlohmann/json/issues/4321)
|
||||||
|
- gdb-pretty-print broken since m\_data added [\#4309](https://github.com/nlohmann/json/issues/4309)
|
||||||
|
- Docs have incorrect info for `update()` [\#4307](https://github.com/nlohmann/json/issues/4307)
|
||||||
|
- CBOR data cannot be decoded [\#4301](https://github.com/nlohmann/json/issues/4301)
|
||||||
|
- Inconsistent behaviour of json construction using `std::initializer_list` [\#4299](https://github.com/nlohmann/json/issues/4299)
|
||||||
|
- Assertion failed when accessing non-existing object with const json object [\#4297](https://github.com/nlohmann/json/issues/4297)
|
||||||
|
- Validatable release artifacts are not sufficient for packaging \(trying to run tests\) [\#4296](https://github.com/nlohmann/json/issues/4296)
|
||||||
|
- ordered json pointer corruption [\#4289](https://github.com/nlohmann/json/issues/4289)
|
||||||
|
- Incorrect floating point parsing [\#4285](https://github.com/nlohmann/json/issues/4285)
|
||||||
|
- Segfault on parse when using "\#pragma pack \(push, 1\)" [\#4284](https://github.com/nlohmann/json/issues/4284)
|
||||||
|
- Simple example with nlohmann::ordered\_json doesn't compile [\#4282](https://github.com/nlohmann/json/issues/4282)
|
||||||
|
- Program crashes with ordered\_json, but works fine with json [\#4279](https://github.com/nlohmann/json/issues/4279)
|
||||||
|
- JSON parses as array when assigned in initializer list. [\#4278](https://github.com/nlohmann/json/issues/4278)
|
||||||
|
- Can't run `make amalgamate` [\#4275](https://github.com/nlohmann/json/issues/4275)
|
||||||
|
- Parsing the unicode string got the wrong result [\#4272](https://github.com/nlohmann/json/issues/4272)
|
||||||
|
- Issue with including \<version\> [\#4241](https://github.com/nlohmann/json/issues/4241)
|
||||||
|
- Exception when trying to insert my json object inside json file [\#4239](https://github.com/nlohmann/json/issues/4239)
|
||||||
|
- `to_json` is erroneously converting enums with underlying unsigned types to signed numbers [\#4236](https://github.com/nlohmann/json/issues/4236)
|
||||||
|
- Build failure on macOS Sonoma 14.1.1 [\#4228](https://github.com/nlohmann/json/issues/4228)
|
||||||
|
- Deprecation warning on save action in check-amalgamation CI step [\#4227](https://github.com/nlohmann/json/issues/4227)
|
||||||
|
- 3.11.3: test suite fails in 4 units [\#4224](https://github.com/nlohmann/json/issues/4224)
|
||||||
|
- Exception thrown when dumping utf-8 characters when using std::string [\#4213](https://github.com/nlohmann/json/issues/4213)
|
||||||
|
- patch\_inplace assumes StringType is std::string [\#4134](https://github.com/nlohmann/json/issues/4134)
|
||||||
|
- Getting a weak-vtables warning with clang on ubuntu 22.04 [\#4087](https://github.com/nlohmann/json/issues/4087)
|
||||||
|
- SAX interface unexpectedly gets locale-altered float representation. [\#4084](https://github.com/nlohmann/json/issues/4084)
|
||||||
|
- Feat: hash pin github workflow dependencies [\#4058](https://github.com/nlohmann/json/issues/4058)
|
||||||
|
- compiler error using clang-16.0.5 when using gcc-13.1 standard library [\#4051](https://github.com/nlohmann/json/issues/4051)
|
||||||
|
- Missing requirement on `plantuml` binary package [\#4026](https://github.com/nlohmann/json/issues/4026)
|
||||||
|
- Compile failure for macos 10.10 SDK + darwin14 [\#3991](https://github.com/nlohmann/json/issues/3991)
|
||||||
|
- Test suite does not compile with C++20 and Clang 17 [\#3979](https://github.com/nlohmann/json/issues/3979)
|
||||||
|
- `modernize-avoid-c-arrays` clang-tidy warning when using `NLOHMANN_JSON_SERIALIZE_ENUM` macro [\#3924](https://github.com/nlohmann/json/issues/3924)
|
||||||
|
- JSON\_DIAGNOSTICS trigger assertion [\#3915](https://github.com/nlohmann/json/issues/3915)
|
||||||
|
- Compiler warning 'array-bounds' on g++12.2.0 on Ubuntu 22.10 kinetic with RelWithDebugInfo [\#3808](https://github.com/nlohmann/json/issues/3808)
|
||||||
|
- The MSVC team recently test JSON project failed to run test on release configuration on windows\_x64. [\#3542](https://github.com/nlohmann/json/issues/3542)
|
||||||
|
- Bad JSON diff when removing object in array of object [\#3146](https://github.com/nlohmann/json/issues/3146)
|
||||||
|
- Limit AppVeyor use [\#3089](https://github.com/nlohmann/json/issues/3089)
|
||||||
|
- pkgconfig integration wrongly rendered if tests are run [\#2907](https://github.com/nlohmann/json/issues/2907)
|
||||||
|
- Compile error for json in template and variadic macros. [\#2794](https://github.com/nlohmann/json/issues/2794)
|
||||||
|
- How to Serialize derived class to JSON object? [\#2199](https://github.com/nlohmann/json/issues/2199)
|
||||||
|
- \[C++17\] Allow std::optional to convert to nlohmann::json [\#1749](https://github.com/nlohmann/json/issues/1749)
|
||||||
|
|
||||||
|
- Fix typo in nlohmann\_define\_derived\_type.md [\#4565](https://github.com/nlohmann/json/pull/4565) ([gregmarr](https://github.com/gregmarr))
|
||||||
|
- Add ONLY\_SERIALIZE for NLOHMANN\_DEFINE\_DERIVED\_TYPE\_\* macros [\#4562](https://github.com/nlohmann/json/pull/4562) ([EinarsNG](https://github.com/EinarsNG))
|
||||||
|
- Suppress modernize-use-integer-sign-comparison [\#4558](https://github.com/nlohmann/json/pull/4558) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Bump actions/upload-artifact from 4.4.3 to 4.5.0 [\#4557](https://github.com/nlohmann/json/pull/4557) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Clean up CI [\#4553](https://github.com/nlohmann/json/pull/4553) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- \[StepSecurity\] ci: Harden GitHub Actions [\#4551](https://github.com/nlohmann/json/pull/4551) ([step-security-bot](https://github.com/step-security-bot))
|
||||||
|
- Fix token permissions warnings [\#4550](https://github.com/nlohmann/json/pull/4550) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add step to build the documentation [\#4549](https://github.com/nlohmann/json/pull/4549) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Bump mkdocs-material from 9.5.48 to 9.5.49 in /docs/mkdocs [\#4548](https://github.com/nlohmann/json/pull/4548) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Move reuse dependency to requirements.txt file [\#4547](https://github.com/nlohmann/json/pull/4547) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Clean up [\#4546](https://github.com/nlohmann/json/pull/4546) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- ⬆️ Bump ossf/scorecard-action from 2.3.3 to 2.4.0 [\#4545](https://github.com/nlohmann/json/pull/4545) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- ⬆️ Bump lukka/get-cmake from 3.31.0 to 3.31.2 [\#4544](https://github.com/nlohmann/json/pull/4544) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- ⬆️ Bump github/codeql-action from 2.27.9 to 3.27.9 [\#4543](https://github.com/nlohmann/json/pull/4543) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- ⬆️ Bump watchdog from 2.1.7 to 6.0.0 in /tools/serve\_header [\#4542](https://github.com/nlohmann/json/pull/4542) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- ⬆️ Bump pyyaml from 6.0 to 6.0.2 in /tools/serve\_header [\#4541](https://github.com/nlohmann/json/pull/4541) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- ⬆️ Bump actions/github-script from 6.4.0 to 7.0.1 [\#4540](https://github.com/nlohmann/json/pull/4540) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- \[StepSecurity\] Apply security best practices [\#4539](https://github.com/nlohmann/json/pull/4539) ([step-security-bot](https://github.com/step-security-bot))
|
||||||
|
- Set parents after insert call [\#4537](https://github.com/nlohmann/json/pull/4537) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Allow patch and diff to be used with arbitrary string types [\#4536](https://github.com/nlohmann/json/pull/4536) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add more package managers [\#4533](https://github.com/nlohmann/json/pull/4533) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Replace EOF with char\_traits [\#4532](https://github.com/nlohmann/json/pull/4532) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix return value of get\_ptr for unsigned integers [\#4525](https://github.com/nlohmann/json/pull/4525) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add more GCC warning flags [\#4524](https://github.com/nlohmann/json/pull/4524) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Update licenses [\#4521](https://github.com/nlohmann/json/pull/4521) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- json start/end position implementation [\#4517](https://github.com/nlohmann/json/pull/4517) ([sushshring](https://github.com/sushshring))
|
||||||
|
- Overwork documentation [\#4516](https://github.com/nlohmann/json/pull/4516) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Allow comparing default initialized iterators [\#4512](https://github.com/nlohmann/json/pull/4512) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- fix: integer parsed as float when EINTR set in errno [\#4506](https://github.com/nlohmann/json/pull/4506) ([StuartGorman](https://github.com/StuartGorman))
|
||||||
|
- Make SAX output locale-independent [\#4505](https://github.com/nlohmann/json/pull/4505) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Skip enum tests when JSON\_DisableEnumSerialization=ON [\#4504](https://github.com/nlohmann/json/pull/4504) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix weak-vtables warning [\#4500](https://github.com/nlohmann/json/pull/4500) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Suppress warnings in NLOHMANN\_JSON\_SERIALIZE\_ENUM [\#4497](https://github.com/nlohmann/json/pull/4497) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add comment for \#4494 [\#4496](https://github.com/nlohmann/json/pull/4496) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add test for libstdc++ [\#4495](https://github.com/nlohmann/json/pull/4495) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Another desperate try to fix the CI [\#4489](https://github.com/nlohmann/json/pull/4489) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Possible fix for \#4485 [\#4487](https://github.com/nlohmann/json/pull/4487) ([jordan-hoang](https://github.com/jordan-hoang))
|
||||||
|
- Update CONTRIBUTING.md [\#4486](https://github.com/nlohmann/json/pull/4486) ([zerocukor287](https://github.com/zerocukor287))
|
||||||
|
- Allow overriding the CMake target name [\#4483](https://github.com/nlohmann/json/pull/4483) ([iboB](https://github.com/iboB))
|
||||||
|
- Update is\_structured.md [\#4472](https://github.com/nlohmann/json/pull/4472) ([thetimr](https://github.com/thetimr))
|
||||||
|
- Add CPack support [\#4459](https://github.com/nlohmann/json/pull/4459) ([zjyhjqs](https://github.com/zjyhjqs))
|
||||||
|
- CMake: generate a pkg-config file that follow pkg-config conventions [\#4456](https://github.com/nlohmann/json/pull/4456) ([dcbaker](https://github.com/dcbaker))
|
||||||
|
- Update natvis to reflect 3.11.3 and the current structure of basic\_json [\#4451](https://github.com/nlohmann/json/pull/4451) ([gmyers18](https://github.com/gmyers18))
|
||||||
|
- Docs: fix typos of 'whether' in `operator_{gt,le,lt}.md` [\#4412](https://github.com/nlohmann/json/pull/4412) ([tsnl](https://github.com/tsnl))
|
||||||
|
- Remove alwayslink=True Bazel flag [\#4396](https://github.com/nlohmann/json/pull/4396) ([mering](https://github.com/mering))
|
||||||
|
- Optimize binary `get_number` implementation by reading multiple bytes at once [\#4391](https://github.com/nlohmann/json/pull/4391) ([TianyiChen](https://github.com/TianyiChen))
|
||||||
|
- Make iterator\_proxy\_value a forward\_iterator \(\#4371\) [\#4372](https://github.com/nlohmann/json/pull/4372) ([captaincrutches](https://github.com/captaincrutches))
|
||||||
|
- Add lgtm explanation [\#4362](https://github.com/nlohmann/json/pull/4362) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- chore: fix some typos in comments [\#4345](https://github.com/nlohmann/json/pull/4345) ([laterlaugh](https://github.com/laterlaugh))
|
||||||
|
- Fix gdb pretty printer [\#4343](https://github.com/nlohmann/json/pull/4343) ([MrJia1997](https://github.com/MrJia1997))
|
||||||
|
- Fix for incorrect function name in documentation example [\#4342](https://github.com/nlohmann/json/pull/4342) ([alexprabhat99](https://github.com/alexprabhat99))
|
||||||
|
- Fixed an error in the `Custom data source` example. [\#4335](https://github.com/nlohmann/json/pull/4335) ([philip-paul-mueller](https://github.com/philip-paul-mueller))
|
||||||
|
- Updated exception handling to catch const reference in out\_of\_range [\#4331](https://github.com/nlohmann/json/pull/4331) ([LeilaShcheglova](https://github.com/LeilaShcheglova))
|
||||||
|
- \#4307 Updated docx to 3.10.5 from 3.10.4 [\#4310](https://github.com/nlohmann/json/pull/4310) ([AniketDhemare](https://github.com/AniketDhemare))
|
||||||
|
- Align astyle flags in Makefile with CI [\#4277](https://github.com/nlohmann/json/pull/4277) ([serge-s](https://github.com/serge-s))
|
||||||
|
- Suppress Clang-Tidy warnings [\#4276](https://github.com/nlohmann/json/pull/4276) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Remove broken link from CONTRIBUTING.md [\#4274](https://github.com/nlohmann/json/pull/4274) ([serge-s](https://github.com/serge-s))
|
||||||
|
- Fix version in json\_has\_static\_rtti.md [\#4269](https://github.com/nlohmann/json/pull/4269) ([ALF-ONE](https://github.com/ALF-ONE))
|
||||||
|
- Add support of multi-dim C-style array member of struct. [\#4262](https://github.com/nlohmann/json/pull/4262) ([peng-wang-cn](https://github.com/peng-wang-cn))
|
||||||
|
- Docs: Fix wrong code usage in the Value access section of `json_pointer.md` [\#4255](https://github.com/nlohmann/json/pull/4255) ([Fallen-Breath](https://github.com/Fallen-Breath))
|
||||||
|
- Fix `to_json` for enums when the enum has an unsigned underlying type. [\#4237](https://github.com/nlohmann/json/pull/4237) ([TheJCAB](https://github.com/TheJCAB))
|
||||||
|
- feat: Rebase `feature/optional` to `develop` [\#4036](https://github.com/nlohmann/json/pull/4036) ([fsandhei](https://github.com/fsandhei))
|
||||||
|
- Add NLOHMANN\_DEFINE\_DERIVED\_TYPE\_\* macros [\#4033](https://github.com/nlohmann/json/pull/4033) ([rotolof](https://github.com/rotolof))
|
||||||
|
|
||||||
|
## [v3.11.3](https://github.com/nlohmann/json/releases/tag/v3.11.3) (2023-11-28)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.2...v3.11.3)
|
||||||
|
|
||||||
|
- Parser and constructor resolve integer types differently [\#4207](https://github.com/nlohmann/json/issues/4207)
|
||||||
|
- README.md overuses `template` keyword before `get` function [\#4205](https://github.com/nlohmann/json/issues/4205)
|
||||||
|
- Exception SIGSEGV - Segmentation violation signal on file parsing \(v3.11.2, linux, doctest\) [\#4193](https://github.com/nlohmann/json/issues/4193)
|
||||||
|
- In highly nested functions, passing json into a function leads to a segmentation fault/bus error [\#4186](https://github.com/nlohmann/json/issues/4186)
|
||||||
|
- why a single-object json file appears in an array [\#4183](https://github.com/nlohmann/json/issues/4183)
|
||||||
|
- Initializing `json` by direct initialization and copy initialization invokes different constructors [\#4174](https://github.com/nlohmann/json/issues/4174)
|
||||||
|
- Deprecation warning about std::char\_traits\<unsigned char\> [\#4163](https://github.com/nlohmann/json/issues/4163)
|
||||||
|
- LLVM 16.0.6 issues warning for literal operators when Wdeprecated-literal-operator [\#4129](https://github.com/nlohmann/json/issues/4129)
|
||||||
|
- GCC compiler warning about violating the C++ One Definition Rule \[-Wodr\] [\#4116](https://github.com/nlohmann/json/issues/4116)
|
||||||
|
- error: building nlohmann-json:arm64-osx failed with: BUILD\_FAILED [\#4091](https://github.com/nlohmann/json/issues/4091)
|
||||||
|
- dump\(\): Non-conforming with JSON-spec escape of strings? [\#4088](https://github.com/nlohmann/json/issues/4088)
|
||||||
|
- Compiling in visual studio 2022 gives a warning [\#4081](https://github.com/nlohmann/json/issues/4081)
|
||||||
|
- Upgrade CMake minimum version [\#4076](https://github.com/nlohmann/json/issues/4076)
|
||||||
|
- \ character in the content of a string cause error in parser.? [\#4067](https://github.com/nlohmann/json/issues/4067)
|
||||||
|
- JSON Parsing Freeze Issue on Nintendo Switch [\#4066](https://github.com/nlohmann/json/issues/4066)
|
||||||
|
- Clang++ compilation fails on extremely small example [\#4061](https://github.com/nlohmann/json/issues/4061)
|
||||||
|
- how about open a new repository for header only version? [\#4060](https://github.com/nlohmann/json/issues/4060)
|
||||||
|
- json::count returns only 0 or 1 [\#4052](https://github.com/nlohmann/json/issues/4052)
|
||||||
|
- std::function error [\#4050](https://github.com/nlohmann/json/issues/4050)
|
||||||
|
- Json package not compiling properly [\#4042](https://github.com/nlohmann/json/issues/4042)
|
||||||
|
- Explicit conversion example in docs should use `template get` [\#4038](https://github.com/nlohmann/json/issues/4038)
|
||||||
|
- Improve wording of parse\_error exception [\#4037](https://github.com/nlohmann/json/issues/4037)
|
||||||
|
- Parse error on valid JSON file [\#4028](https://github.com/nlohmann/json/issues/4028)
|
||||||
|
- Empty JSON object returns size of 1 [\#4027](https://github.com/nlohmann/json/issues/4027)
|
||||||
|
- Help needed to fix CI [\#4025](https://github.com/nlohmann/json/issues/4025)
|
||||||
|
- Security vulnerabilities detected: CVE-2022-24439, WS-2022-0438, WS-2022-0437 [\#4020](https://github.com/nlohmann/json/issues/4020)
|
||||||
|
- multithreading use from\_msgpack leading very slow [\#4016](https://github.com/nlohmann/json/issues/4016)
|
||||||
|
- Error with sol for Lua: items\(\) is not a recognized container [\#4012](https://github.com/nlohmann/json/issues/4012)
|
||||||
|
- Parser does not read non ascii characters : ŞÜİĞ [\#4007](https://github.com/nlohmann/json/issues/4007)
|
||||||
|
- malloc\(\): unaligned fastbin chunk detected [\#3999](https://github.com/nlohmann/json/issues/3999)
|
||||||
|
- try/catch block doesn't work while accessing const json& array. [\#3998](https://github.com/nlohmann/json/issues/3998)
|
||||||
|
- a bug about list [\#3995](https://github.com/nlohmann/json/issues/3995)
|
||||||
|
- heap corruption when i use nlohmann::json::accept function to check a valid json [\#3994](https://github.com/nlohmann/json/issues/3994)
|
||||||
|
- Exception on gcc but not apple clang [\#3986](https://github.com/nlohmann/json/issues/3986)
|
||||||
|
- Can't support convert the type? std::string json\_str = R"\({"value": "3.1415"}\)"; float value = j\["value"\].get\<float\>\(\); [\#3984](https://github.com/nlohmann/json/issues/3984)
|
||||||
|
- `#pragma once` not supported with C++20 modules in clang [\#3974](https://github.com/nlohmann/json/issues/3974)
|
||||||
|
- const array\_t::operator\[\] results in buffer overflow / segv on nullptr on out of bounds access [\#3973](https://github.com/nlohmann/json/issues/3973)
|
||||||
|
- Set minimal permissions to Github Workflows [\#3971](https://github.com/nlohmann/json/issues/3971)
|
||||||
|
- Parsing array error [\#3968](https://github.com/nlohmann/json/issues/3968)
|
||||||
|
- why I can return tuple as json? [\#3961](https://github.com/nlohmann/json/issues/3961)
|
||||||
|
- type must be number, but is null [\#3956](https://github.com/nlohmann/json/issues/3956)
|
||||||
|
- Class Composition of json members produces incorrect json when constructing with initialization list [\#3955](https://github.com/nlohmann/json/issues/3955)
|
||||||
|
- exit without error message [\#3948](https://github.com/nlohmann/json/issues/3948)
|
||||||
|
- NLOHMANN\_DEFINE\_TYPE\_INTRUSIVE doesn't work with "json\_fwd.hpp" [\#3946](https://github.com/nlohmann/json/issues/3946)
|
||||||
|
- Dangerous use of pull\_request\_target [\#3945](https://github.com/nlohmann/json/issues/3945)
|
||||||
|
- Test \#7: test-bjdata\_cpp11 ............................\*\*\*Failed [\#3941](https://github.com/nlohmann/json/issues/3941)
|
||||||
|
- Memory leak detection with basic usage of NLOHMANN\_JSON\_SERIALIZE\_ENUM [\#3939](https://github.com/nlohmann/json/issues/3939)
|
||||||
|
- Parse doesnt work [\#3936](https://github.com/nlohmann/json/issues/3936)
|
||||||
|
- Clean up badges [\#3935](https://github.com/nlohmann/json/issues/3935)
|
||||||
|
- \[json.exception.type\_error.305\] cannot use operator\[\] with a string argument with array [\#3931](https://github.com/nlohmann/json/issues/3931)
|
||||||
|
- GCC 13 build failures [\#3927](https://github.com/nlohmann/json/issues/3927)
|
||||||
|
- Exception throw even though code is inside try/catch [\#3926](https://github.com/nlohmann/json/issues/3926)
|
||||||
|
- Please fix failing tests [\#3923](https://github.com/nlohmann/json/issues/3923)
|
||||||
|
- Security vulnerability in dependency: future 0.18.2 [\#3922](https://github.com/nlohmann/json/issues/3922)
|
||||||
|
- json pretty printer causes python exceptions on non-json types [\#3919](https://github.com/nlohmann/json/issues/3919)
|
||||||
|
- how does a normal basic\_json\<\> object cuase assertion `false` [\#3918](https://github.com/nlohmann/json/issues/3918)
|
||||||
|
- The library can not parse JSON generate by Chome DevTools Protocol [\#3903](https://github.com/nlohmann/json/issues/3903)
|
||||||
|
- Typo in `cmake/test.cmake` [\#3902](https://github.com/nlohmann/json/issues/3902)
|
||||||
|
- Parser adds wrapping array when compiled with GCC [\#3897](https://github.com/nlohmann/json/issues/3897)
|
||||||
|
- when i use for\(auto iter& : jsonObject\) it occure some error [\#3893](https://github.com/nlohmann/json/issues/3893)
|
||||||
|
- Check Drone CI [\#3890](https://github.com/nlohmann/json/issues/3890)
|
||||||
|
- Json::accept\(std::ifstream\) [\#3884](https://github.com/nlohmann/json/issues/3884)
|
||||||
|
- \[json.exception.parse\_error.101\] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '\[', '{', or a literal [\#3882](https://github.com/nlohmann/json/issues/3882)
|
||||||
|
- Memory leak when exception is thrown in adl\_serializer::to\_json [\#3881](https://github.com/nlohmann/json/issues/3881)
|
||||||
|
- building with cmake [\#3880](https://github.com/nlohmann/json/issues/3880)
|
||||||
|
- \[json.exception.type\_error.316\] invalid UTF-8 byte at index 0: 0xB6 [\#3879](https://github.com/nlohmann/json/issues/3879)
|
||||||
|
- Visual Studio 2015 C2664 error std::pair\< [\#3867](https://github.com/nlohmann/json/issues/3867)
|
||||||
|
- I want the data field to be empty serialized and deserialized to each other [\#3866](https://github.com/nlohmann/json/issues/3866)
|
||||||
|
- Generated natvis is invalid XML [\#3858](https://github.com/nlohmann/json/issues/3858)
|
||||||
|
- Json Arrays have inconsistent nesting levels across different OSs [\#3854](https://github.com/nlohmann/json/issues/3854)
|
||||||
|
- Occur error when parse character '\' [\#3844](https://github.com/nlohmann/json/issues/3844)
|
||||||
|
- Proccess crash as soon as I parse json [\#3843](https://github.com/nlohmann/json/issues/3843)
|
||||||
|
- json::parse and constructor with the same json generates different type [\#3842](https://github.com/nlohmann/json/issues/3842)
|
||||||
|
- json::accept return false on valid JSON [\#3838](https://github.com/nlohmann/json/issues/3838)
|
||||||
|
- decode\(state, codep, byte\) generates warnings. [\#3837](https://github.com/nlohmann/json/issues/3837)
|
||||||
|
- Arithmetic operators are not working as expected [\#3832](https://github.com/nlohmann/json/issues/3832)
|
||||||
|
- array\_index does not catch std::invalid\_argument exception from std::stoull [\#3831](https://github.com/nlohmann/json/issues/3831)
|
||||||
|
- 3.11.2: test suite is failing in two units [\#3828](https://github.com/nlohmann/json/issues/3828)
|
||||||
|
- Compile Error on g++ using get\(\) function [\#3827](https://github.com/nlohmann/json/issues/3827)
|
||||||
|
- nlohmann::json::parse can't handle the "€" symbol. [\#3825](https://github.com/nlohmann/json/issues/3825)
|
||||||
|
- When reading a non-existent key, I unexpectedly get a value. Is it the wrong way I use it? [\#3811](https://github.com/nlohmann/json/issues/3811)
|
||||||
|
- Code analysis warning string\_concat.hpp C26800: Use of a moved from object [\#3805](https://github.com/nlohmann/json/issues/3805)
|
||||||
|
- The code used to build with 3.10.2 but fails now [\#3804](https://github.com/nlohmann/json/issues/3804)
|
||||||
|
- Inconsistent Behaviour of NaN & Null Values [\#3799](https://github.com/nlohmann/json/issues/3799)
|
||||||
|
- json\_fwd.hpp doesn't work [\#3796](https://github.com/nlohmann/json/issues/3796)
|
||||||
|
- Compilation fails in MSVC 22 [\#3787](https://github.com/nlohmann/json/issues/3787)
|
||||||
|
- parsing json with missing key throws exception [\#3784](https://github.com/nlohmann/json/issues/3784)
|
||||||
|
- Allow to disable inline namespaces completley [\#3746](https://github.com/nlohmann/json/issues/3746)
|
||||||
|
- double free or Assertion failed! [\#3729](https://github.com/nlohmann/json/issues/3729)
|
||||||
|
- Amalgated json\_fwd.hpp not included in include.zip [\#3727](https://github.com/nlohmann/json/issues/3727)
|
||||||
|
- INT64\_MIN/MAX not defined for newer g++ [\#3722](https://github.com/nlohmann/json/issues/3722)
|
||||||
|
- Compilation error with JSON\_DIAGNOSTICS enabled [\#3717](https://github.com/nlohmann/json/issues/3717)
|
||||||
|
- class-level enum not serialized as string via NLOHMANN\_JSON\_SERIALIZE\_ENUM [\#3715](https://github.com/nlohmann/json/issues/3715)
|
||||||
|
- Local copy given by operator\[\] or at\(\) [\#3704](https://github.com/nlohmann/json/issues/3704)
|
||||||
|
- nlohmann::to\_json method not acting as expected with nlohmann::adl\_serializer specialization. [\#3340](https://github.com/nlohmann/json/issues/3340)
|
||||||
|
- braced-init-list: array vs other constructor [\#2583](https://github.com/nlohmann/json/issues/2583)
|
||||||
|
|
||||||
|
- JSON for Modern C++ 3.11.3 [\#4222](https://github.com/nlohmann/json/pull/4222) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Update documentation for the next release [\#4216](https://github.com/nlohmann/json/pull/4216) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix failing CI checks [\#4215](https://github.com/nlohmann/json/pull/4215) ([colbychaskell](https://github.com/colbychaskell))
|
||||||
|
- Fix CI \(again\) [\#4196](https://github.com/nlohmann/json/pull/4196) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- fix cmake header path in install with custom CMAKE\_INSTALL\_INCLUDEDIR [\#4194](https://github.com/nlohmann/json/pull/4194) ([bebuch](https://github.com/bebuch))
|
||||||
|
- Add more specific error message when attempting to parse empty input [\#4180](https://github.com/nlohmann/json/pull/4180) ([colbychaskell](https://github.com/colbychaskell))
|
||||||
|
- Fix char\_traits deprecation warning [\#4179](https://github.com/nlohmann/json/pull/4179) ([colbychaskell](https://github.com/colbychaskell))
|
||||||
|
- Fix MinGW CI [\#4175](https://github.com/nlohmann/json/pull/4175) ([scribam](https://github.com/scribam))
|
||||||
|
- Fix spellcheck issue [\#4173](https://github.com/nlohmann/json/pull/4173) ([mwestphal](https://github.com/mwestphal))
|
||||||
|
- Fix source highlighting in user defined type macros docs [\#4169](https://github.com/nlohmann/json/pull/4169) ([ZeronSix](https://github.com/ZeronSix))
|
||||||
|
- Fix deprecation warning [\#4161](https://github.com/nlohmann/json/pull/4161) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix CI [\#4160](https://github.com/nlohmann/json/pull/4160) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Update index.md [\#4159](https://github.com/nlohmann/json/pull/4159) ([miny1233](https://github.com/miny1233))
|
||||||
|
- Update index.md [\#4149](https://github.com/nlohmann/json/pull/4149) ([HO-COOH](https://github.com/HO-COOH))
|
||||||
|
- Correct a typo in serve\_header/README.md [\#4143](https://github.com/nlohmann/json/pull/4143) ([felixonmars](https://github.com/felixonmars))
|
||||||
|
- Fixed init-list construction when size\_type is not int [\#4140](https://github.com/nlohmann/json/pull/4140) ([tomalakgeretkal](https://github.com/tomalakgeretkal))
|
||||||
|
- Update CODEOWNERS [\#4126](https://github.com/nlohmann/json/pull/4126) ([tarolling](https://github.com/tarolling))
|
||||||
|
- Accept NEW CMake policies up to CMake 3.14 [\#4112](https://github.com/nlohmann/json/pull/4112) ([craigscott-crascit](https://github.com/craigscott-crascit))
|
||||||
|
- Fix typo in afl\_driver.cpp [\#4109](https://github.com/nlohmann/json/pull/4109) ([eltociear](https://github.com/eltociear))
|
||||||
|
- Capture exceptions by const& in docs. [\#4099](https://github.com/nlohmann/json/pull/4099) ([iwanders](https://github.com/iwanders))
|
||||||
|
- Fix CI, again [\#4083](https://github.com/nlohmann/json/pull/4083) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix Clang-Tidy warnings [\#4047](https://github.com/nlohmann/json/pull/4047) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix compile error with \_HAS\_STATIC\_RTTI=0 [\#4046](https://github.com/nlohmann/json/pull/4046) ([ALF-ONE](https://github.com/ALF-ONE))
|
||||||
|
- Add to CONTRIBUTING.md that `make pretty` is required for test updates. [\#4045](https://github.com/nlohmann/json/pull/4045) ([gregmarr](https://github.com/gregmarr))
|
||||||
|
- Added to tests the file unit-algorithm.cpp \(c++ 11\) functions from algorithm library [\#4044](https://github.com/nlohmann/json/pull/4044) ([Tomerkm](https://github.com/Tomerkm))
|
||||||
|
- Use template get instead of get in examples [\#4039](https://github.com/nlohmann/json/pull/4039) ([tusooa](https://github.com/tusooa))
|
||||||
|
- Support Apple's Swift Package Manager [\#4010](https://github.com/nlohmann/json/pull/4010) ([aleksproger](https://github.com/aleksproger))
|
||||||
|
- Add Vcpkg port version badge [\#3988](https://github.com/nlohmann/json/pull/3988) ([njakob](https://github.com/njakob))
|
||||||
|
- Fix CI + new Doctest [\#3985](https://github.com/nlohmann/json/pull/3985) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Set minimal permissions to Github Workflows [\#3972](https://github.com/nlohmann/json/pull/3972) ([joycebrum](https://github.com/joycebrum))
|
||||||
|
- Refactor amalgamation workflow to avoid dangerous use of pull\_request\_target [\#3969](https://github.com/nlohmann/json/pull/3969) ([joycebrum](https://github.com/joycebrum))
|
||||||
|
- Fix typo in test.cmake [\#3951](https://github.com/nlohmann/json/pull/3951) ([theevilone45](https://github.com/theevilone45))
|
||||||
|
- tests/unit-iterators2: use std::ranges::equals for range comparisons [\#3950](https://github.com/nlohmann/json/pull/3950) ([ArsenArsen](https://github.com/ArsenArsen))
|
||||||
|
- 3935, removed lgtm badge and added Cirrus CI badge [\#3937](https://github.com/nlohmann/json/pull/3937) ([haadfida](https://github.com/haadfida))
|
||||||
|
- ⬆️ Bump future from 0.18.2 to 0.18.3 in /docs/mkdocs [\#3934](https://github.com/nlohmann/json/pull/3934) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Change 2022 to 2023 [\#3932](https://github.com/nlohmann/json/pull/3932) ([floriansegginger](https://github.com/floriansegginger))
|
||||||
|
- PrettyPrinter: Check if match is valid before accessing group [\#3920](https://github.com/nlohmann/json/pull/3920) ([Finkman](https://github.com/Finkman))
|
||||||
|
- Fix CI issues [\#3906](https://github.com/nlohmann/json/pull/3906) ([barcode](https://github.com/barcode))
|
||||||
|
- Prevent memory leak when exception is thrown in adl\_serializer::to\_json [\#3901](https://github.com/nlohmann/json/pull/3901) ([barcode](https://github.com/barcode))
|
||||||
|
- custom allocators: define missing 'rebind' type [\#3895](https://github.com/nlohmann/json/pull/3895) ([trofi](https://github.com/trofi))
|
||||||
|
- Try old MinGW script [\#3892](https://github.com/nlohmann/json/pull/3892) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Upgrade Python packages [\#3891](https://github.com/nlohmann/json/pull/3891) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix warning about moved from object [\#3889](https://github.com/nlohmann/json/pull/3889) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Remove a magic number [\#3888](https://github.com/nlohmann/json/pull/3888) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add migration guide [\#3887](https://github.com/nlohmann/json/pull/3887) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Clang 15 [\#3876](https://github.com/nlohmann/json/pull/3876) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Bump certifi from 2022.6.15 to 2022.12.7 in /docs/mkdocs [\#3872](https://github.com/nlohmann/json/pull/3872) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Fix natvis XML [\#3863](https://github.com/nlohmann/json/pull/3863) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Fix pipeline [\#3862](https://github.com/nlohmann/json/pull/3862) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add CIFuzz CI GitHub action [\#3845](https://github.com/nlohmann/json/pull/3845) ([DavidKorczynski](https://github.com/DavidKorczynski))
|
||||||
|
- Add serialization-only user defined type macros [\#3816](https://github.com/nlohmann/json/pull/3816) ([ZeronSix](https://github.com/ZeronSix))
|
||||||
|
- Bump joblib from 1.1.0 to 1.2.0 in /docs/mkdocs [\#3781](https://github.com/nlohmann/json/pull/3781) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Fix some typos for n-dimensional arrays [\#3767](https://github.com/nlohmann/json/pull/3767) ([striezel](https://github.com/striezel))
|
||||||
|
- Fix 'declaration hides global declaration' warning [\#3751](https://github.com/nlohmann/json/pull/3751) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Fix typos in .md files [\#3748](https://github.com/nlohmann/json/pull/3748) ([tocic](https://github.com/tocic))
|
||||||
|
- Update Codacy link [\#3740](https://github.com/nlohmann/json/pull/3740) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add missing files to release artifacts [\#3728](https://github.com/nlohmann/json/pull/3728) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add dark mode toggle to documentation [\#3726](https://github.com/nlohmann/json/pull/3726) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add clang-tools to required tools for ci\_static\_analysis\_clang [\#3724](https://github.com/nlohmann/json/pull/3724) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Replace limit macros with std::numeric\_limits [\#3723](https://github.com/nlohmann/json/pull/3723) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add missing \<numeric\> include [\#3719](https://github.com/nlohmann/json/pull/3719) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add Bazel build support [\#3709](https://github.com/nlohmann/json/pull/3709) ([Vertexwahn](https://github.com/Vertexwahn))
|
||||||
|
- Use official Clang/GCC containers [\#3703](https://github.com/nlohmann/json/pull/3703) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add 'Check amalgamation' workflow [\#3693](https://github.com/nlohmann/json/pull/3693) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Allow custom base class as node customization point [\#3110](https://github.com/nlohmann/json/pull/3110) ([barcode](https://github.com/barcode))
|
||||||
|
|
||||||
|
## [v3.11.2](https://github.com/nlohmann/json/releases/tag/v3.11.2) (2022-08-12)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.1...v3.11.2)
|
||||||
|
|
||||||
|
- MSVC natvis visualizer does not work after introduction of inline ABI namespace [\#3696](https://github.com/nlohmann/json/issues/3696)
|
||||||
|
- The use of parenthesis gives compilation errors in some situations [\#3682](https://github.com/nlohmann/json/issues/3682)
|
||||||
|
- extern from/to\_json result in linker error [\#3657](https://github.com/nlohmann/json/issues/3657)
|
||||||
|
- json\_fwd.hpp no longer standalone [\#3656](https://github.com/nlohmann/json/issues/3656)
|
||||||
|
- regression: `.value<size_t>` is compilation error. [\#3655](https://github.com/nlohmann/json/issues/3655)
|
||||||
|
- Regression: no match for 'operator!=' comparing json\_pointer and const char \*/string\_t [\#3654](https://github.com/nlohmann/json/issues/3654)
|
||||||
|
- Regression: call to member function 'value' is ambiguous [\#3652](https://github.com/nlohmann/json/issues/3652)
|
||||||
|
- macOS 10.15 Actions runner image deprecation [\#3612](https://github.com/nlohmann/json/issues/3612)
|
||||||
|
|
||||||
|
- generate\_natvis.py: validate version number; cleanup [\#3698](https://github.com/nlohmann/json/pull/3698) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add Python script for generating Natvis file and update file for 3.11.2 [\#3697](https://github.com/nlohmann/json/pull/3697) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- fix typo in json\_pointer.md [\#3692](https://github.com/nlohmann/json/pull/3692) ([eltociear](https://github.com/eltociear))
|
||||||
|
- Add amalgamated json-fwd.hpp to release [\#3687](https://github.com/nlohmann/json/pull/3687) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Documentation updates for 3.11.2 [\#3686](https://github.com/nlohmann/json/pull/3686) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Make json\_pointer usable as map key \(again\) [\#3685](https://github.com/nlohmann/json/pull/3685) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Deprecate json\_pointer/string\_t comparisons [\#3684](https://github.com/nlohmann/json/pull/3684) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Restructure inline namespace and allow version component to be disabled [\#3683](https://github.com/nlohmann/json/pull/3683) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Properly constrain non-string json\_pointer overloads [\#3681](https://github.com/nlohmann/json/pull/3681) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Amalgamate the forward declaration header [\#3679](https://github.com/nlohmann/json/pull/3679) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Fix 'const' qualifier on bool& has no effect [\#3678](https://github.com/nlohmann/json/pull/3678) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Fix whitespace in workflow files [\#3675](https://github.com/nlohmann/json/pull/3675) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Attempt to fix labeler permissions [\#3674](https://github.com/nlohmann/json/pull/3674) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Refine 'Publish documentation' workflow [\#3673](https://github.com/nlohmann/json/pull/3673) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Documentation change [\#3672](https://github.com/nlohmann/json/pull/3672) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add labeler action [\#3671](https://github.com/nlohmann/json/pull/3671) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Complete contributor list [\#3670](https://github.com/nlohmann/json/pull/3670) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add json\_pointer/string\_t equality comparison operators [\#3664](https://github.com/nlohmann/json/pull/3664) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Reimplement value\(\) access functions [\#3663](https://github.com/nlohmann/json/pull/3663) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Complete contributor list [\#3662](https://github.com/nlohmann/json/pull/3662) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Adjust naming of GitHub action jobs [\#3661](https://github.com/nlohmann/json/pull/3661) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Publish documentation on push to develop branch [\#3660](https://github.com/nlohmann/json/pull/3660) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add Discord badge to README [\#3651](https://github.com/nlohmann/json/pull/3651) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Miscellaneous small fixes [\#3643](https://github.com/nlohmann/json/pull/3643) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Minor BJData fixes [\#3637](https://github.com/nlohmann/json/pull/3637) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Update CI [\#3626](https://github.com/nlohmann/json/pull/3626) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
|
||||||
|
## [v3.11.1](https://github.com/nlohmann/json/releases/tag/v3.11.1) (2022-08-01)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.0...v3.11.1)
|
||||||
|
|
||||||
- Regression: no matching literal operator for call to 'operator""\_json' [\#3645](https://github.com/nlohmann/json/issues/3645)
|
- Regression: no matching literal operator for call to 'operator""\_json' [\#3645](https://github.com/nlohmann/json/issues/3645)
|
||||||
- \_json operator""\(\) [\#3644](https://github.com/nlohmann/json/issues/3644)
|
- \_json operator""\(\) [\#3644](https://github.com/nlohmann/json/issues/3644)
|
||||||
@ -105,7 +476,7 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Fix warning [\#3634](https://github.com/nlohmann/json/pull/3634) ([nlohmann](https://github.com/nlohmann))
|
- Fix warning [\#3634](https://github.com/nlohmann/json/pull/3634) ([nlohmann](https://github.com/nlohmann))
|
||||||
- Add license header to new files [\#3633](https://github.com/nlohmann/json/pull/3633) ([nlohmann](https://github.com/nlohmann))
|
- Add license header to new files [\#3633](https://github.com/nlohmann/json/pull/3633) ([nlohmann](https://github.com/nlohmann))
|
||||||
- Add a unit test including windows.h [\#3631](https://github.com/nlohmann/json/pull/3631) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
- Add a unit test including windows.h [\#3631](https://github.com/nlohmann/json/pull/3631) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
- Fixed latest build error in msvc platform [\#3630](https://github.com/nlohmann/json/pull/3630) ([KsaNL](https://github.com/KsaNL))
|
- Fixed latest build error in msvc platform [\#3630](https://github.com/nlohmann/json/pull/3630) ([Lioncky](https://github.com/Lioncky))
|
||||||
- Add regression tests for \#3204 and \#3333 [\#3629](https://github.com/nlohmann/json/pull/3629) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
- Add regression tests for \#3204 and \#3333 [\#3629](https://github.com/nlohmann/json/pull/3629) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
- Fix patch::add creating nonexistent parents [\#3628](https://github.com/nlohmann/json/pull/3628) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
- Fix patch::add creating nonexistent parents [\#3628](https://github.com/nlohmann/json/pull/3628) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
- Adjust JSON Pointer examples [\#3622](https://github.com/nlohmann/json/pull/3622) ([nlohmann](https://github.com/nlohmann))
|
- Adjust JSON Pointer examples [\#3622](https://github.com/nlohmann/json/pull/3622) ([nlohmann](https://github.com/nlohmann))
|
||||||
@ -138,7 +509,7 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Use REUSE framework [\#3546](https://github.com/nlohmann/json/pull/3546) ([nlohmann](https://github.com/nlohmann))
|
- Use REUSE framework [\#3546](https://github.com/nlohmann/json/pull/3546) ([nlohmann](https://github.com/nlohmann))
|
||||||
- Use `std::iterator_traits` to extract `iterator_category` [\#3544](https://github.com/nlohmann/json/pull/3544) ([Mike-Leo-Smith](https://github.com/Mike-Leo-Smith))
|
- Use `std::iterator_traits` to extract `iterator_category` [\#3544](https://github.com/nlohmann/json/pull/3544) ([Mike-Leo-Smith](https://github.com/Mike-Leo-Smith))
|
||||||
- BJData dimension length can not be string\_t::npos, fix \#3541 [\#3543](https://github.com/nlohmann/json/pull/3543) ([fangq](https://github.com/fangq))
|
- BJData dimension length can not be string\_t::npos, fix \#3541 [\#3543](https://github.com/nlohmann/json/pull/3543) ([fangq](https://github.com/fangq))
|
||||||
- Allow disabling default enum conversions [\#3536](https://github.com/nlohmann/json/pull/3536) ([zxey](https://github.com/zxey))
|
- Allow disabling default enum conversions [\#3536](https://github.com/nlohmann/json/pull/3536) ([richardhozak](https://github.com/richardhozak))
|
||||||
- Add to\_json\(\) for std::vector\<bool\>::reference [\#3534](https://github.com/nlohmann/json/pull/3534) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
- Add to\_json\(\) for std::vector\<bool\>::reference [\#3534](https://github.com/nlohmann/json/pull/3534) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
- CI: Enable 32bit unit test \(3\) [\#3532](https://github.com/nlohmann/json/pull/3532) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
- CI: Enable 32bit unit test \(3\) [\#3532](https://github.com/nlohmann/json/pull/3532) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
- Use new CI image [\#3528](https://github.com/nlohmann/json/pull/3528) ([nlohmann](https://github.com/nlohmann))
|
- Use new CI image [\#3528](https://github.com/nlohmann/json/pull/3528) ([nlohmann](https://github.com/nlohmann))
|
||||||
@ -599,7 +970,6 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- array\_index possible out of range [\#2205](https://github.com/nlohmann/json/issues/2205)
|
- array\_index possible out of range [\#2205](https://github.com/nlohmann/json/issues/2205)
|
||||||
- Object deserialized as array [\#2204](https://github.com/nlohmann/json/issues/2204)
|
- Object deserialized as array [\#2204](https://github.com/nlohmann/json/issues/2204)
|
||||||
- Sending to a function a reference to a sub-branch [\#2200](https://github.com/nlohmann/json/issues/2200)
|
- Sending to a function a reference to a sub-branch [\#2200](https://github.com/nlohmann/json/issues/2200)
|
||||||
- How to Serialize derived class to JSON object? [\#2199](https://github.com/nlohmann/json/issues/2199)
|
|
||||||
- JSON incorrectly serialized [\#2198](https://github.com/nlohmann/json/issues/2198)
|
- JSON incorrectly serialized [\#2198](https://github.com/nlohmann/json/issues/2198)
|
||||||
- Exception Unhandled out\_of\_range error [\#2197](https://github.com/nlohmann/json/issues/2197)
|
- Exception Unhandled out\_of\_range error [\#2197](https://github.com/nlohmann/json/issues/2197)
|
||||||
- msgpack serialisation : float is treated as 64bit float, not 32bit float. [\#2196](https://github.com/nlohmann/json/issues/2196)
|
- msgpack serialisation : float is treated as 64bit float, not 32bit float. [\#2196](https://github.com/nlohmann/json/issues/2196)
|
||||||
@ -632,7 +1002,6 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Compilation failure using Clang on Windows [\#1898](https://github.com/nlohmann/json/issues/1898)
|
- Compilation failure using Clang on Windows [\#1898](https://github.com/nlohmann/json/issues/1898)
|
||||||
- Fail to build when including json.hpp as a system include [\#1818](https://github.com/nlohmann/json/issues/1818)
|
- Fail to build when including json.hpp as a system include [\#1818](https://github.com/nlohmann/json/issues/1818)
|
||||||
- Parsing string into json doesn't preserve the order correctly. [\#1817](https://github.com/nlohmann/json/issues/1817)
|
- Parsing string into json doesn't preserve the order correctly. [\#1817](https://github.com/nlohmann/json/issues/1817)
|
||||||
- \[C++17\] Allow std::optional to convert to nlohmann::json [\#1749](https://github.com/nlohmann/json/issues/1749)
|
|
||||||
- How can I save json object in file in order? [\#1717](https://github.com/nlohmann/json/issues/1717)
|
- How can I save json object in file in order? [\#1717](https://github.com/nlohmann/json/issues/1717)
|
||||||
- Support for Comments [\#1513](https://github.com/nlohmann/json/issues/1513)
|
- Support for Comments [\#1513](https://github.com/nlohmann/json/issues/1513)
|
||||||
- clang compiler: error : unknown type name 'not' [\#1119](https://github.com/nlohmann/json/issues/1119)
|
- clang compiler: error : unknown type name 'not' [\#1119](https://github.com/nlohmann/json/issues/1119)
|
||||||
@ -1652,7 +2021,7 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Use a version check to provide backwards comatible CMake imported target names [\#1245](https://github.com/nlohmann/json/pull/1245) ([chuckatkins](https://github.com/chuckatkins))
|
- Use a version check to provide backwards comatible CMake imported target names [\#1245](https://github.com/nlohmann/json/pull/1245) ([chuckatkins](https://github.com/chuckatkins))
|
||||||
- Fix issue \#1237 [\#1238](https://github.com/nlohmann/json/pull/1238) ([theodelrieu](https://github.com/theodelrieu))
|
- Fix issue \#1237 [\#1238](https://github.com/nlohmann/json/pull/1238) ([theodelrieu](https://github.com/theodelrieu))
|
||||||
- Add a get overload taking a parameter. [\#1231](https://github.com/nlohmann/json/pull/1231) ([theodelrieu](https://github.com/theodelrieu))
|
- Add a get overload taking a parameter. [\#1231](https://github.com/nlohmann/json/pull/1231) ([theodelrieu](https://github.com/theodelrieu))
|
||||||
- Move lambda out of unevaluated context [\#1230](https://github.com/nlohmann/json/pull/1230) ([mandreyel](https://github.com/mandreyel))
|
- Move lambda out of unevaluated context [\#1230](https://github.com/nlohmann/json/pull/1230) ([vimpunk](https://github.com/vimpunk))
|
||||||
- Remove static asserts [\#1228](https://github.com/nlohmann/json/pull/1228) ([theodelrieu](https://github.com/theodelrieu))
|
- Remove static asserts [\#1228](https://github.com/nlohmann/json/pull/1228) ([theodelrieu](https://github.com/theodelrieu))
|
||||||
- Better error 305 [\#1221](https://github.com/nlohmann/json/pull/1221) ([rivertam](https://github.com/rivertam))
|
- Better error 305 [\#1221](https://github.com/nlohmann/json/pull/1221) ([rivertam](https://github.com/rivertam))
|
||||||
- Fix \#1213 [\#1214](https://github.com/nlohmann/json/pull/1214) ([simnalamburt](https://github.com/simnalamburt))
|
- Fix \#1213 [\#1214](https://github.com/nlohmann/json/pull/1214) ([simnalamburt](https://github.com/simnalamburt))
|
||||||
@ -1819,8 +2188,8 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Fix unit tests that were silently skipped or crashed \(depending on the compiler\) [\#1176](https://github.com/nlohmann/json/pull/1176) ([grembo](https://github.com/grembo))
|
- Fix unit tests that were silently skipped or crashed \(depending on the compiler\) [\#1176](https://github.com/nlohmann/json/pull/1176) ([grembo](https://github.com/grembo))
|
||||||
- Refactor/no virtual sax [\#1153](https://github.com/nlohmann/json/pull/1153) ([theodelrieu](https://github.com/theodelrieu))
|
- Refactor/no virtual sax [\#1153](https://github.com/nlohmann/json/pull/1153) ([theodelrieu](https://github.com/theodelrieu))
|
||||||
- Fixed compiler error in VS 2015 for debug mode [\#1151](https://github.com/nlohmann/json/pull/1151) ([sonulohani](https://github.com/sonulohani))
|
- Fixed compiler error in VS 2015 for debug mode [\#1151](https://github.com/nlohmann/json/pull/1151) ([sonulohani](https://github.com/sonulohani))
|
||||||
- Fix links to cppreference named requirements \(formerly concepts\) [\#1144](https://github.com/nlohmann/json/pull/1144) ([jrakow](https://github.com/jrakow))
|
- Fix links to cppreference named requirements \(formerly concepts\) [\#1144](https://github.com/nlohmann/json/pull/1144) ([ghost](https://github.com/ghost))
|
||||||
- meson: fix include directory [\#1142](https://github.com/nlohmann/json/pull/1142) ([jrakow](https://github.com/jrakow))
|
- meson: fix include directory [\#1142](https://github.com/nlohmann/json/pull/1142) ([ghost](https://github.com/ghost))
|
||||||
- Feature/unordered map conversion [\#1138](https://github.com/nlohmann/json/pull/1138) ([theodelrieu](https://github.com/theodelrieu))
|
- Feature/unordered map conversion [\#1138](https://github.com/nlohmann/json/pull/1138) ([theodelrieu](https://github.com/theodelrieu))
|
||||||
- fixed compile error for \#1045 [\#1134](https://github.com/nlohmann/json/pull/1134) ([Daniel599](https://github.com/Daniel599))
|
- fixed compile error for \#1045 [\#1134](https://github.com/nlohmann/json/pull/1134) ([Daniel599](https://github.com/Daniel599))
|
||||||
- test \(non\)equality for alt\_string implementation [\#1130](https://github.com/nlohmann/json/pull/1130) ([agrianius](https://github.com/agrianius))
|
- test \(non\)equality for alt\_string implementation [\#1130](https://github.com/nlohmann/json/pull/1130) ([agrianius](https://github.com/agrianius))
|
||||||
@ -1829,7 +2198,7 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- fix typo in README [\#1078](https://github.com/nlohmann/json/pull/1078) ([martin-mfg](https://github.com/martin-mfg))
|
- fix typo in README [\#1078](https://github.com/nlohmann/json/pull/1078) ([martin-mfg](https://github.com/martin-mfg))
|
||||||
- Fix typo [\#1058](https://github.com/nlohmann/json/pull/1058) ([dns13](https://github.com/dns13))
|
- Fix typo [\#1058](https://github.com/nlohmann/json/pull/1058) ([dns13](https://github.com/dns13))
|
||||||
- Misc cmake packaging enhancements [\#1048](https://github.com/nlohmann/json/pull/1048) ([chuckatkins](https://github.com/chuckatkins))
|
- Misc cmake packaging enhancements [\#1048](https://github.com/nlohmann/json/pull/1048) ([chuckatkins](https://github.com/chuckatkins))
|
||||||
- Fixed incorrect LLVM version number in README [\#1047](https://github.com/nlohmann/json/pull/1047) ([jammehcow](https://github.com/jammehcow))
|
- Fixed incorrect LLVM version number in README [\#1047](https://github.com/nlohmann/json/pull/1047) ([jupjohn](https://github.com/jupjohn))
|
||||||
- Fix trivial typo in comment. [\#1043](https://github.com/nlohmann/json/pull/1043) ([coryan](https://github.com/coryan))
|
- Fix trivial typo in comment. [\#1043](https://github.com/nlohmann/json/pull/1043) ([coryan](https://github.com/coryan))
|
||||||
- Package Manager: Spack [\#1041](https://github.com/nlohmann/json/pull/1041) ([ax3l](https://github.com/ax3l))
|
- Package Manager: Spack [\#1041](https://github.com/nlohmann/json/pull/1041) ([ax3l](https://github.com/ax3l))
|
||||||
- CMake: 3.8+ is Sufficient [\#1040](https://github.com/nlohmann/json/pull/1040) ([ax3l](https://github.com/ax3l))
|
- CMake: 3.8+ is Sufficient [\#1040](https://github.com/nlohmann/json/pull/1040) ([ax3l](https://github.com/ax3l))
|
||||||
@ -2358,7 +2727,7 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Fix "not constraint" grammar in docs [\#674](https://github.com/nlohmann/json/pull/674) ([wincent](https://github.com/wincent))
|
- Fix "not constraint" grammar in docs [\#674](https://github.com/nlohmann/json/pull/674) ([wincent](https://github.com/wincent))
|
||||||
- Add documentation for integration with CMake and hunter [\#671](https://github.com/nlohmann/json/pull/671) ([dan-42](https://github.com/dan-42))
|
- Add documentation for integration with CMake and hunter [\#671](https://github.com/nlohmann/json/pull/671) ([dan-42](https://github.com/dan-42))
|
||||||
- REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse [\#669](https://github.com/nlohmann/json/pull/669) ([dan-42](https://github.com/dan-42))
|
- REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse [\#669](https://github.com/nlohmann/json/pull/669) ([dan-42](https://github.com/dan-42))
|
||||||
- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([effolkronium](https://github.com/effolkronium))
|
- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([ilqvya](https://github.com/ilqvya))
|
||||||
- Support moving from rvalues in std::initializer\_list [\#663](https://github.com/nlohmann/json/pull/663) ([himikof](https://github.com/himikof))
|
- Support moving from rvalues in std::initializer\_list [\#663](https://github.com/nlohmann/json/pull/663) ([himikof](https://github.com/himikof))
|
||||||
- add ensure\_ascii parameter to dump. \#330 [\#654](https://github.com/nlohmann/json/pull/654) ([ryanjmulder](https://github.com/ryanjmulder))
|
- add ensure\_ascii parameter to dump. \#330 [\#654](https://github.com/nlohmann/json/pull/654) ([ryanjmulder](https://github.com/ryanjmulder))
|
||||||
- Rename BuildTests to JSON\_BuildTests [\#652](https://github.com/nlohmann/json/pull/652) ([olegendo](https://github.com/olegendo))
|
- Rename BuildTests to JSON\_BuildTests [\#652](https://github.com/nlohmann/json/pull/652) ([olegendo](https://github.com/olegendo))
|
||||||
@ -2877,11 +3246,11 @@ All notable changes to this project will be documented in this file. This projec
|
|||||||
- Keyword 'inline' is useless when member functions are defined in headers [\#87](https://github.com/nlohmann/json/pull/87) ([ahamez](https://github.com/ahamez))
|
- Keyword 'inline' is useless when member functions are defined in headers [\#87](https://github.com/nlohmann/json/pull/87) ([ahamez](https://github.com/ahamez))
|
||||||
- Remove useless typename [\#86](https://github.com/nlohmann/json/pull/86) ([ahamez](https://github.com/ahamez))
|
- Remove useless typename [\#86](https://github.com/nlohmann/json/pull/86) ([ahamez](https://github.com/ahamez))
|
||||||
- Avoid warning with Xcode's clang [\#85](https://github.com/nlohmann/json/pull/85) ([ahamez](https://github.com/ahamez))
|
- Avoid warning with Xcode's clang [\#85](https://github.com/nlohmann/json/pull/85) ([ahamez](https://github.com/ahamez))
|
||||||
- Fix typos [\#73](https://github.com/nlohmann/json/pull/73) ([aqnouch](https://github.com/aqnouch))
|
- Fix typos [\#73](https://github.com/nlohmann/json/pull/73) ([maqnouch](https://github.com/maqnouch))
|
||||||
- Replace `default_callback` function with `nullptr` and check for null… [\#72](https://github.com/nlohmann/json/pull/72) ([aburgh](https://github.com/aburgh))
|
- Replace `default_callback` function with `nullptr` and check for null… [\#72](https://github.com/nlohmann/json/pull/72) ([aburgh](https://github.com/aburgh))
|
||||||
- support enum [\#71](https://github.com/nlohmann/json/pull/71) ([likebeta](https://github.com/likebeta))
|
- support enum [\#71](https://github.com/nlohmann/json/pull/71) ([likebeta](https://github.com/likebeta))
|
||||||
- Fix performance regression introduced with the parsing callback feature. [\#69](https://github.com/nlohmann/json/pull/69) ([aburgh](https://github.com/aburgh))
|
- Fix performance regression introduced with the parsing callback feature. [\#69](https://github.com/nlohmann/json/pull/69) ([aburgh](https://github.com/aburgh))
|
||||||
- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Florianjw](https://github.com/Florianjw))
|
- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Fiona-J-W](https://github.com/Fiona-J-W))
|
||||||
- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek))
|
- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek))
|
||||||
- Parse streams incrementally. [\#40](https://github.com/nlohmann/json/pull/40) ([aburgh](https://github.com/aburgh))
|
- Parse streams incrementally. [\#40](https://github.com/nlohmann/json/pull/40) ([aburgh](https://github.com/aburgh))
|
||||||
- Feature/small float serialization [\#38](https://github.com/nlohmann/json/pull/38) ([jrandall](https://github.com/jrandall))
|
- Feature/small float serialization [\#38](https://github.com/nlohmann/json/pull/38) ([jrandall](https://github.com/jrandall))
|
||||||
|
239
FILES.md
Normal file
239
FILES.md
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
# Supporting files
|
||||||
|
|
||||||
|
This file describes the source for supporting files; that is, files that are not part of the library, but define the infrastructure and other aspects of the project.
|
||||||
|
|
||||||
|
- [Continuous Integration](#continuous-integration)
|
||||||
|
- [GitHub](#github)
|
||||||
|
- [REUSE](#reuse)
|
||||||
|
- [Package Managers](#package-managers)
|
||||||
|
|
||||||
|
## Continuous Integration
|
||||||
|
|
||||||
|
### `.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`
|
||||||
|
|
||||||
|
Configuration for the pipelines at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json).
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [appveyor.yml reference](https://www.appveyor.com/docs/appveyor-yml/)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The filename can be freely configured in the AppVeyor project.
|
||||||
|
|
||||||
|
## GitHub
|
||||||
|
|
||||||
|
### `CITATION.cff`
|
||||||
|
|
||||||
|
A file to configure the citation for the repository which is displayed in the sidebar of the project.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [About CITATION files](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `CITATION.cff` and position (root of the repository) are predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/CODE_OF_CONDUCT.md`
|
||||||
|
|
||||||
|
The code of conduct for the project. This is the Markdown version of the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). The code of conduct is linked on the [Community Standards](https://github.com/nlohmann/json/community) page and is mentioned by the Sentiment Bot.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Adding a code of conduct to your project](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/CODE_OF_CONDUCT.md` is predetermined by GitHub.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/code_of_conduct.md`.
|
||||||
|
|
||||||
|
### `.github/CODEOWNERS`
|
||||||
|
|
||||||
|
The code owners file for the project which is used to select reviewers for new pull requests.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/CODEOWNERS` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/config.yml`
|
||||||
|
|
||||||
|
Configuration file for [probot](https://probot.github.io/apps/), in particular the [Sentiment Bot](https://probot.github.io/apps/sentiment-bot/) and the [Request Info](https://probot.github.io/apps/request-info/).
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/config.yml` is predetermined by probot.
|
||||||
|
|
||||||
|
### `.github/CONTRIBUTING.md`
|
||||||
|
|
||||||
|
The contribution guidelines which are linked in the [Community Standards](https://github.com/nlohmann/json/community) and at <https://github.com/nlohmann/json/contribute>.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Setting guidelines for repository contributors](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/CONTRIBUTING.md` is predetermined by GitHub.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/contribution_guidelines.md`.
|
||||||
|
|
||||||
|
### `.github/dependabot.yml`
|
||||||
|
|
||||||
|
The configuration of [dependabot](https://github.com/dependabot) which ensures the dependencies (GitHub actions and Python packages used in the CI) remain up to date.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Configuring Dependabot security updates](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/dependabot.yml` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/FUNDING.yml`
|
||||||
|
|
||||||
|
A file to configure the sponsor button of the repository which is displayed in the sidebar of the project.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Displaying a sponsor button in your repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/FUNDING.yml` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/ISSUE_TEMPLATE/bug.yaml`
|
||||||
|
|
||||||
|
Issue form template for bugs.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Configuring issue templates for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The folder `.github/ISSUE_TEMPLATE` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/ISSUE_TEMPLATE/config.yaml`
|
||||||
|
|
||||||
|
Issue template chooser configuration. The file is used to configure the dialog when a new issue is created.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Configuring issue templates for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/ISSUE_TEMPLATE/config.yaml` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/labeler.yml`
|
||||||
|
|
||||||
|
Configuration file for the "Pull Request Labeler" workflow defined in `workflows/labeler.yml`. This file defines rules how labels are assigned to pull requests based on which files are changed.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Label manager for PRs and issues based on configurable conditions](https://github.com/srvaroa/labeler)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The filename defaults to `.github/labeler.yml` and can be configured in the workflow.
|
||||||
|
|
||||||
|
### `.github/PULL_REQUEST_TEMPLATE.md`
|
||||||
|
|
||||||
|
The pull request template which prefills new pull requests.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Creating a pull request template for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/PULL_REQUEST_TEMPLATE.md` is predetermined by GitHub.
|
||||||
|
|
||||||
|
### `.github/SECURITY.md`
|
||||||
|
|
||||||
|
The goal is to describe how to securely report security vulnerabilities for this repository. The security policy is linked at <https://github.com/nlohmann/json/security/policy>.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Adding a security policy to your repository](https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.github/SECURITY.yml` is predetermined by GitHub.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/security_policy.md`.
|
||||||
|
|
||||||
|
### `LICENSE.MIT`
|
||||||
|
|
||||||
|
The license of the project.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [Adding a license to a repository](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `LICENSE.MIT` is partly predetermined by GitHub. The root filename must be `LICENSE`.
|
||||||
|
|
||||||
|
## REUSE
|
||||||
|
|
||||||
|
### `.reuse/dep5`
|
||||||
|
|
||||||
|
The file defines the licenses of certain third-party components in the repository. The root `Makefile` contains a target `reuse` that checks for compliance.
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [DEP5](https://reuse.software/spec-3.2/#dep5-deprecated)
|
||||||
|
- [reuse command-line tool](https://pypi.org/project/reuse/)
|
||||||
|
- [documentation of linting](https://reuse.readthedocs.io/en/stable/man/reuse-lint.html)
|
||||||
|
- [REUSE](http://reuse.software)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The filename `.reuse/dep5` is predetermined by REUSE. Alternatively, a `REUSE.toml` file can be used.
|
||||||
|
|
||||||
|
### `.reuse/templates`
|
||||||
|
|
||||||
|
Copyright header templates for source files. The root `Makefile` contains a target `reuse` that updates copyright headers with the templates.
|
||||||
|
|
||||||
|
Further information:
|
||||||
|
|
||||||
|
- [reuse command-line tool](https://pypi.org/project/reuse/)
|
||||||
|
- [documentation on templates](https://reuse.readthedocs.io/en/stable/man/reuse-annotate.html#cmdoption-t)
|
||||||
|
- [REUSE](http://reuse.software)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The folder name `.reuse/templates` is predetermined by REUSE.
|
||||||
|
|
||||||
|
### `LICENSES`
|
||||||
|
|
||||||
|
A folder that contains every license of all license files (library and third-party code).
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
|
||||||
|
- [REUSE specification](https://reuse.software/spec-3.3/)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The folder name `LICENSES` is predetermined by REUSE.
|
||||||
|
|
||||||
|
|
||||||
|
## Package Managers
|
||||||
|
|
||||||
|
### `BUILD.bazel`
|
||||||
|
|
||||||
|
The file can be updated by calling
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make BUILD.bazel
|
||||||
|
```
|
||||||
|
|
||||||
|
### `meson.build`
|
||||||
|
|
||||||
|
### `Package.swift`
|
||||||
|
|
||||||
|
### `WORKSPACE.bazel`
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2013-2022 Niels Lohmann
|
Copyright (c) 2013-2025 Niels Lohmann
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
7
MODULE.bazel
Normal file
7
MODULE.bazel
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module(
|
||||||
|
name = "nlohmann_json",
|
||||||
|
compatibility_level = 1,
|
||||||
|
)
|
||||||
|
|
||||||
|
bazel_dep(name = "rules_cc", version = "0.0.17")
|
||||||
|
bazel_dep(name = "rules_license", version = "1.0.0")
|
84
Makefile
84
Makefile
@ -18,8 +18,9 @@ SRCS=$(shell find include -type f | sort)
|
|||||||
# the list of sources in the tests folder
|
# the list of sources in the tests folder
|
||||||
TESTS_SRCS=$(shell find tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
TESTS_SRCS=$(shell find tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||||
|
|
||||||
# the single header (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
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -28,7 +29,7 @@ AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
|||||||
|
|
||||||
# main target
|
# main target
|
||||||
all:
|
all:
|
||||||
@echo "amalgamate - amalgamate file single_include/nlohmann/json.hpp from the include/nlohmann sources"
|
@echo "amalgamate - amalgamate files single_include/nlohmann/json{,_fwd}.hpp 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"
|
@echo "check-amalgamation - check whether sources have been amalgamated"
|
||||||
@echo "clean - remove built files"
|
@echo "clean - remove built files"
|
||||||
@ -42,15 +43,6 @@ all:
|
|||||||
@echo "run_benchmarks - build and run benchmarks"
|
@echo "run_benchmarks - build and run benchmarks"
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# documentation tests
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# compile example files and check output
|
|
||||||
doctest:
|
|
||||||
$(MAKE) check_output -C docs
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# benchmarks
|
# benchmarks
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -141,49 +133,46 @@ pvs_studio:
|
|||||||
# Code format and source amalgamation
|
# Code format and source amalgamation
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
ASTYLE=tools/astyle/venv/bin/astyle
|
||||||
|
|
||||||
|
install_astyle:
|
||||||
|
@test -d tools/astyle/venv || python3 -mvenv tools/astyle/venv ; tools/astyle/venv/bin/pip3 install --quiet --upgrade pip
|
||||||
|
@test -f $(ASTYLE) || tools/astyle/venv/bin/pip3 install --quiet -r tools/astyle/requirements.txt
|
||||||
|
@$(ASTYLE) --version
|
||||||
|
|
||||||
# call the Artistic Style pretty printer on all source files
|
# call the Artistic Style pretty printer on all source files
|
||||||
pretty:
|
pretty: install_astyle
|
||||||
astyle \
|
$(ASTYLE) --project=tools/astyle/.astylerc $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/mkdocs/docs/examples/*.cpp
|
||||||
--style=allman \
|
|
||||||
--indent=spaces=4 \
|
|
||||||
--indent-modifiers \
|
|
||||||
--indent-switches \
|
|
||||||
--indent-preproc-block \
|
|
||||||
--indent-preproc-define \
|
|
||||||
--indent-col1-comments \
|
|
||||||
--pad-oper \
|
|
||||||
--pad-header \
|
|
||||||
--align-pointer=type \
|
|
||||||
--align-reference=type \
|
|
||||||
--add-brackets \
|
|
||||||
--convert-tabs \
|
|
||||||
--close-templates \
|
|
||||||
--lineend=linux \
|
|
||||||
--preserve-date \
|
|
||||||
--suffix=none \
|
|
||||||
--formatted \
|
|
||||||
$(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/examples/*.cpp
|
|
||||||
|
|
||||||
# call the Clang-Format on all source files
|
# call the Clang-Format on all source files
|
||||||
pretty_format:
|
pretty_format:
|
||||||
for FILE in $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
for FILE in $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/mkdocs/docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
||||||
|
|
||||||
# create single header file
|
# create single header files and pretty print
|
||||||
amalgamate: $(AMALGAMATED_FILE)
|
amalgamate: $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE)
|
||||||
|
|
||||||
# call the amalgamation tool and pretty print
|
|
||||||
$(AMALGAMATED_FILE): $(SRCS)
|
|
||||||
tools/amalgamate/amalgamate.py -c tools/amalgamate/config.json -s . --verbose=yes
|
|
||||||
$(MAKE) pretty
|
$(MAKE) pretty
|
||||||
|
|
||||||
|
# call the amalgamation tool for json.hpp
|
||||||
|
$(AMALGAMATED_FILE): $(SRCS)
|
||||||
|
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json.json -s . --verbose=yes
|
||||||
|
|
||||||
|
# call the amalgamation tool for json_fwd.hpp
|
||||||
|
$(AMALGAMATED_FWD_FILE): $(SRCS)
|
||||||
|
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json_fwd.json -s . --verbose=yes
|
||||||
|
|
||||||
# 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
|
# 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)~
|
||||||
@$(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)
|
||||||
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
||||||
|
@mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE)
|
||||||
|
|
||||||
|
BUILD.bazel: $(SRCS)
|
||||||
|
cmake -P cmake/scripts/gen_bazel_build_file.cmake
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# ChangeLog
|
# ChangeLog
|
||||||
@ -205,7 +194,7 @@ ChangeLog.md:
|
|||||||
# Release files
|
# Release files
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# Create a tar.gz archive that contains sufficient files to be used as CMake project (e.g., using FetchContent). The
|
# Create a tar.xz archive that contains sufficient files to be used as CMake project (e.g., using FetchContent). The
|
||||||
# archive is created according to the advices of <https://reproducible-builds.org/docs/archives/>.
|
# archive is created according to the advices of <https://reproducible-builds.org/docs/archives/>.
|
||||||
json.tar.xz:
|
json.tar.xz:
|
||||||
mkdir json
|
mkdir json
|
||||||
@ -215,8 +204,8 @@ 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:
|
include.zip: BUILD.bazel
|
||||||
zip -9 --recurse-paths -X include.zip $(SRCS) $(AMALGAMATED_FILE) meson.build LICENSE.MIT
|
zip -9 --recurse-paths -X include.zip $(SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) BUILD.bazel WORKSPACE.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
|
||||||
@ -224,9 +213,11 @@ release: include.zip json.tar.xz
|
|||||||
mkdir release_files
|
mkdir release_files
|
||||||
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 json.tar.xz
|
gpg --armor --detach-sig json.tar.xz
|
||||||
cp $(AMALGAMATED_FILE) release_files
|
cp $(AMALGAMATED_FILE) release_files
|
||||||
mv $(AMALGAMATED_FILE).asc json.tar.xz json.tar.xz.asc include.zip include.zip.asc release_files
|
cp $(AMALGAMATED_FWD_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
|
||||||
cd release_files ; shasum -a 256 json.hpp include.zip json.tar.xz > hashes.txt
|
cd release_files ; shasum -a 256 json.hpp include.zip json.tar.xz > hashes.txt
|
||||||
|
|
||||||
|
|
||||||
@ -267,6 +258,9 @@ serve_header:
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
reuse:
|
reuse:
|
||||||
pipx run reuse addheader --recursive single_include include -tjson --license MIT --copyright "Niels Lohmann <https://nlohmann.me>" --year "2013-2022"
|
pipx run reuse annotate --recursive single_include include -tjson --license MIT --copyright "Niels Lohmann <https://nlohmann.me>" --year "2013-2025" --merge-copyrights
|
||||||
pipx run reuse addheader $(TESTS_SRCS) --style=c -tjson_support --license MIT --copyright "Niels Lohmann <https://nlohmann.me>" --year "2013-2022"
|
pipx run reuse annotate $(TESTS_SRCS) -tjson_support --license MIT --copyright "Niels Lohmann <https://nlohmann.me>" --year "2013-2025" --merge-copyrights
|
||||||
pipx run reuse lint
|
pipx run reuse lint
|
||||||
|
|
||||||
|
spdx:
|
||||||
|
pipx run reuse spdx --output nlohmann_json.spdx --creator-person "Niels Lohmann" --add-license-concluded
|
||||||
|
22
Package.swift
Normal file
22
Package.swift
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// swift-tools-version: 5.9
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "nlohmann-json",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v4), .visionOS(.v1)
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
.library(name: "json", targets: ["json"])
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "json",
|
||||||
|
path: "single_include/nlohmann",
|
||||||
|
publicHeadersPath: "."
|
||||||
|
)
|
||||||
|
],
|
||||||
|
cxxLanguageStandard: .cxx11
|
||||||
|
)
|
549
cmake/ci.cmake
549
cmake/ci.cmake
@ -8,34 +8,24 @@ set(N 10)
|
|||||||
include(FindPython3)
|
include(FindPython3)
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
find_program(ASTYLE_TOOL NAMES astyle)
|
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 ${ASTYLE_TOOL} --version OUTPUT_VARIABLE ASTYLE_TOOL_VERSION ERROR_VARIABLE ASTYLE_TOOL_VERSION)
|
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" ASTYLE_TOOL_VERSION "${ASTYLE_TOOL_VERSION}")
|
|
||||||
message(STATUS "🔖 Artistic Style ${ASTYLE_TOOL_VERSION} (${ASTYLE_TOOL})")
|
|
||||||
|
|
||||||
find_program(CLANG_TOOL NAMES clang++-HEAD 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-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(CPPCHECK_TOOL NAMES cppcheck)
|
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 ${CPPCHECK_TOOL} --version OUTPUT_VARIABLE CPPCHECK_TOOL_VERSION ERROR_VARIABLE CPPCHECK_TOOL_VERSION)
|
|
||||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CPPCHECK_TOOL_VERSION "${CPPCHECK_TOOL_VERSION}")
|
|
||||||
message(STATUS "🔖 Cppcheck ${CPPCHECK_TOOL_VERSION} (${CPPCHECK_TOOL})")
|
|
||||||
|
|
||||||
find_program(GCC_TOOL NAMES g++-latest g++-HEAD 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-11 gcov-10 gcov)
|
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})")
|
||||||
@ -88,330 +78,8 @@ file(GLOB_RECURSE SRC_FILES ${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp)
|
|||||||
# Thorough check with recent compilers
|
# Thorough check with recent compilers
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Ignored Clang warnings:
|
include(clang_flags)
|
||||||
# -Wno-c++98-compat The library targets C++11.
|
include(gcc_flags)
|
||||||
# -Wno-c++98-compat-pedantic The library targets C++11.
|
|
||||||
# -Wno-deprecated-declarations The library contains annotations for deprecated functions.
|
|
||||||
# -Wno-extra-semi-stmt The library uses std::assert which triggers this warning.
|
|
||||||
# -Wno-padded We do not care about padding warnings.
|
|
||||||
# -Wno-covered-switch-default All switches list all cases and a default case.
|
|
||||||
# -Wno-weak-vtables The library is header-only.
|
|
||||||
# -Wreserved-identifier See https://github.com/onqtam/doctest/issues/536.
|
|
||||||
|
|
||||||
set(CLANG_CXXFLAGS
|
|
||||||
-Werror
|
|
||||||
-Weverything
|
|
||||||
-Wno-c++98-compat
|
|
||||||
-Wno-c++98-compat-pedantic
|
|
||||||
-Wno-deprecated-declarations
|
|
||||||
-Wno-extra-semi-stmt
|
|
||||||
-Wno-padded
|
|
||||||
-Wno-covered-switch-default
|
|
||||||
-Wno-weak-vtables
|
|
||||||
-Wno-reserved-identifier
|
|
||||||
)
|
|
||||||
|
|
||||||
# Warning flags determined for GCC 13.0 (experimental) with https://github.com/nlohmann/gcc_flags:
|
|
||||||
# Ignored GCC warnings:
|
|
||||||
# -Wno-abi-tag We do not care about ABI tags.
|
|
||||||
# -Wno-aggregate-return The library uses aggregate returns.
|
|
||||||
# -Wno-long-long The library uses the long long type to interface with system functions.
|
|
||||||
# -Wno-namespaces The library uses namespaces.
|
|
||||||
# -Wno-padded We do not care about padding warnings.
|
|
||||||
# -Wno-system-headers We do not care about warnings in system headers.
|
|
||||||
# -Wno-templates The library uses templates.
|
|
||||||
|
|
||||||
set(GCC_CXXFLAGS
|
|
||||||
-pedantic
|
|
||||||
-Werror
|
|
||||||
--all-warnings
|
|
||||||
--extra-warnings
|
|
||||||
-W
|
|
||||||
-WNSObject-attribute
|
|
||||||
-Wno-abi-tag
|
|
||||||
-Waddress
|
|
||||||
-Waddress-of-packed-member
|
|
||||||
-Wno-aggregate-return
|
|
||||||
-Waggressive-loop-optimizations
|
|
||||||
-Waligned-new=all
|
|
||||||
-Wall
|
|
||||||
-Walloc-zero
|
|
||||||
-Walloca
|
|
||||||
-Wanalyzer-double-fclose
|
|
||||||
-Wanalyzer-double-free
|
|
||||||
-Wanalyzer-exposure-through-output-file
|
|
||||||
-Wanalyzer-file-leak
|
|
||||||
-Wanalyzer-free-of-non-heap
|
|
||||||
-Wanalyzer-malloc-leak
|
|
||||||
-Wanalyzer-mismatching-deallocation
|
|
||||||
-Wanalyzer-null-argument
|
|
||||||
-Wanalyzer-null-dereference
|
|
||||||
-Wanalyzer-possible-null-argument
|
|
||||||
-Wanalyzer-possible-null-dereference
|
|
||||||
-Wanalyzer-shift-count-negative
|
|
||||||
-Wanalyzer-shift-count-overflow
|
|
||||||
-Wanalyzer-stale-setjmp-buffer
|
|
||||||
-Wanalyzer-tainted-allocation-size
|
|
||||||
-Wanalyzer-tainted-array-index
|
|
||||||
-Wanalyzer-tainted-divisor
|
|
||||||
-Wanalyzer-tainted-offset
|
|
||||||
-Wanalyzer-tainted-size
|
|
||||||
-Wanalyzer-too-complex
|
|
||||||
-Wanalyzer-unsafe-call-within-signal-handler
|
|
||||||
-Wanalyzer-use-after-free
|
|
||||||
-Wanalyzer-use-of-pointer-in-stale-stack-frame
|
|
||||||
-Wanalyzer-use-of-uninitialized-value
|
|
||||||
-Wanalyzer-va-arg-type-mismatch
|
|
||||||
-Wanalyzer-va-list-exhausted
|
|
||||||
-Wanalyzer-va-list-leak
|
|
||||||
-Wanalyzer-va-list-use-after-va-end
|
|
||||||
-Wanalyzer-write-to-const
|
|
||||||
-Wanalyzer-write-to-string-literal
|
|
||||||
-Warith-conversion
|
|
||||||
-Warray-bounds=2
|
|
||||||
-Warray-compare
|
|
||||||
-Warray-parameter=2
|
|
||||||
-Wattribute-alias=2
|
|
||||||
-Wattribute-warning
|
|
||||||
-Wattributes
|
|
||||||
-Wbool-compare
|
|
||||||
-Wbool-operation
|
|
||||||
-Wbuiltin-declaration-mismatch
|
|
||||||
-Wbuiltin-macro-redefined
|
|
||||||
-Wc++0x-compat
|
|
||||||
-Wc++11-compat
|
|
||||||
-Wc++11-extensions
|
|
||||||
-Wc++14-compat
|
|
||||||
-Wc++14-extensions
|
|
||||||
-Wc++17-compat
|
|
||||||
-Wc++17-extensions
|
|
||||||
-Wc++1z-compat
|
|
||||||
-Wc++20-compat
|
|
||||||
-Wc++20-extensions
|
|
||||||
-Wc++23-extensions
|
|
||||||
-Wc++2a-compat
|
|
||||||
-Wcannot-profile
|
|
||||||
-Wcast-align
|
|
||||||
-Wcast-align=strict
|
|
||||||
-Wcast-function-type
|
|
||||||
-Wcast-qual
|
|
||||||
-Wcatch-value=3
|
|
||||||
-Wchar-subscripts
|
|
||||||
-Wclass-conversion
|
|
||||||
-Wclass-memaccess
|
|
||||||
-Wclobbered
|
|
||||||
-Wcomma-subscript
|
|
||||||
-Wcomment
|
|
||||||
-Wcomments
|
|
||||||
-Wconditionally-supported
|
|
||||||
-Wconversion
|
|
||||||
-Wconversion-null
|
|
||||||
-Wcoverage-invalid-line-number
|
|
||||||
-Wcoverage-mismatch
|
|
||||||
-Wcpp
|
|
||||||
-Wctad-maybe-unsupported
|
|
||||||
-Wctor-dtor-privacy
|
|
||||||
-Wdangling-else
|
|
||||||
-Wdangling-pointer=2
|
|
||||||
-Wdate-time
|
|
||||||
-Wdelete-incomplete
|
|
||||||
-Wdelete-non-virtual-dtor
|
|
||||||
-Wdeprecated
|
|
||||||
-Wdeprecated-copy
|
|
||||||
-Wdeprecated-copy-dtor
|
|
||||||
-Wdeprecated-declarations
|
|
||||||
-Wdeprecated-enum-enum-conversion
|
|
||||||
-Wdeprecated-enum-float-conversion
|
|
||||||
-Wdisabled-optimization
|
|
||||||
-Wdiv-by-zero
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Wduplicated-branches
|
|
||||||
-Wduplicated-cond
|
|
||||||
-Weffc++
|
|
||||||
-Wempty-body
|
|
||||||
-Wendif-labels
|
|
||||||
-Wenum-compare
|
|
||||||
-Wenum-conversion
|
|
||||||
-Wexceptions
|
|
||||||
-Wexpansion-to-defined
|
|
||||||
-Wextra
|
|
||||||
-Wextra-semi
|
|
||||||
-Wfloat-conversion
|
|
||||||
-Wfloat-equal
|
|
||||||
-Wformat-diag
|
|
||||||
-Wformat-overflow=2
|
|
||||||
-Wformat-signedness
|
|
||||||
-Wformat-truncation=2
|
|
||||||
-Wformat=2
|
|
||||||
-Wframe-address
|
|
||||||
-Wfree-nonheap-object
|
|
||||||
-Whsa
|
|
||||||
-Wif-not-aligned
|
|
||||||
-Wignored-attributes
|
|
||||||
-Wignored-qualifiers
|
|
||||||
-Wimplicit-fallthrough=5
|
|
||||||
-Winaccessible-base
|
|
||||||
-Winfinite-recursion
|
|
||||||
-Winherited-variadic-ctor
|
|
||||||
-Winit-list-lifetime
|
|
||||||
-Winit-self
|
|
||||||
-Winline
|
|
||||||
-Wint-in-bool-context
|
|
||||||
-Wint-to-pointer-cast
|
|
||||||
-Winterference-size
|
|
||||||
-Winvalid-imported-macros
|
|
||||||
-Winvalid-memory-model
|
|
||||||
-Winvalid-offsetof
|
|
||||||
-Winvalid-pch
|
|
||||||
-Wliteral-suffix
|
|
||||||
-Wlogical-not-parentheses
|
|
||||||
-Wlogical-op
|
|
||||||
-Wno-long-long
|
|
||||||
-Wlto-type-mismatch
|
|
||||||
-Wmain
|
|
||||||
-Wmaybe-uninitialized
|
|
||||||
-Wmemset-elt-size
|
|
||||||
-Wmemset-transposed-args
|
|
||||||
-Wmisleading-indentation
|
|
||||||
-Wmismatched-dealloc
|
|
||||||
-Wmismatched-new-delete
|
|
||||||
-Wmismatched-tags
|
|
||||||
-Wmissing-attributes
|
|
||||||
-Wmissing-braces
|
|
||||||
-Wmissing-declarations
|
|
||||||
-Wmissing-field-initializers
|
|
||||||
-Wmissing-include-dirs
|
|
||||||
-Wmissing-profile
|
|
||||||
-Wmissing-requires
|
|
||||||
-Wmissing-template-keyword
|
|
||||||
-Wmultichar
|
|
||||||
-Wmultiple-inheritance
|
|
||||||
-Wmultistatement-macros
|
|
||||||
-Wno-namespaces
|
|
||||||
-Wnarrowing
|
|
||||||
-Wnoexcept
|
|
||||||
-Wnoexcept-type
|
|
||||||
-Wnon-template-friend
|
|
||||||
-Wnon-virtual-dtor
|
|
||||||
-Wnonnull
|
|
||||||
-Wnonnull-compare
|
|
||||||
-Wnormalized=nfkc
|
|
||||||
-Wnull-dereference
|
|
||||||
-Wodr
|
|
||||||
-Wold-style-cast
|
|
||||||
-Wopenacc-parallelism
|
|
||||||
-Wopenmp-simd
|
|
||||||
-Woverflow
|
|
||||||
-Woverlength-strings
|
|
||||||
-Woverloaded-virtual
|
|
||||||
-Wpacked
|
|
||||||
-Wpacked-bitfield-compat
|
|
||||||
-Wpacked-not-aligned
|
|
||||||
-Wno-padded
|
|
||||||
-Wparentheses
|
|
||||||
-Wpedantic
|
|
||||||
-Wpessimizing-move
|
|
||||||
-Wplacement-new=2
|
|
||||||
-Wpmf-conversions
|
|
||||||
-Wpointer-arith
|
|
||||||
-Wpointer-compare
|
|
||||||
-Wpragmas
|
|
||||||
-Wprio-ctor-dtor
|
|
||||||
-Wpsabi
|
|
||||||
-Wrange-loop-construct
|
|
||||||
-Wredundant-decls
|
|
||||||
-Wredundant-move
|
|
||||||
-Wredundant-tags
|
|
||||||
-Wregister
|
|
||||||
-Wreorder
|
|
||||||
-Wrestrict
|
|
||||||
-Wreturn-local-addr
|
|
||||||
-Wreturn-type
|
|
||||||
-Wscalar-storage-order
|
|
||||||
-Wsequence-point
|
|
||||||
-Wshadow=compatible-local
|
|
||||||
-Wshadow=global
|
|
||||||
-Wshadow=local
|
|
||||||
-Wshift-count-negative
|
|
||||||
-Wshift-count-overflow
|
|
||||||
-Wshift-negative-value
|
|
||||||
-Wshift-overflow=2
|
|
||||||
-Wsign-compare
|
|
||||||
-Wsign-conversion
|
|
||||||
-Wsign-promo
|
|
||||||
-Wsized-deallocation
|
|
||||||
-Wsizeof-array-argument
|
|
||||||
-Wsizeof-array-div
|
|
||||||
-Wsizeof-pointer-div
|
|
||||||
-Wsizeof-pointer-memaccess
|
|
||||||
-Wstack-protector
|
|
||||||
-Wstrict-aliasing=3
|
|
||||||
-Wstrict-null-sentinel
|
|
||||||
-Wno-strict-overflow
|
|
||||||
-Wstring-compare
|
|
||||||
-Wstringop-overflow=4
|
|
||||||
-Wstringop-overread
|
|
||||||
-Wstringop-truncation
|
|
||||||
-Wsubobject-linkage
|
|
||||||
-Wsuggest-attribute=cold
|
|
||||||
-Wsuggest-attribute=const
|
|
||||||
-Wsuggest-attribute=format
|
|
||||||
-Wsuggest-attribute=malloc
|
|
||||||
-Wsuggest-attribute=noreturn
|
|
||||||
-Wsuggest-attribute=pure
|
|
||||||
-Wsuggest-final-methods
|
|
||||||
-Wsuggest-final-types
|
|
||||||
-Wsuggest-override
|
|
||||||
-Wswitch
|
|
||||||
-Wswitch-bool
|
|
||||||
-Wswitch-default
|
|
||||||
-Wswitch-enum
|
|
||||||
-Wswitch-outside-range
|
|
||||||
-Wswitch-unreachable
|
|
||||||
-Wsync-nand
|
|
||||||
-Wsynth
|
|
||||||
-Wno-system-headers
|
|
||||||
-Wtautological-compare
|
|
||||||
-Wno-templates
|
|
||||||
-Wterminate
|
|
||||||
-Wtrampolines
|
|
||||||
-Wtrigraphs
|
|
||||||
-Wtrivial-auto-var-init
|
|
||||||
-Wtsan
|
|
||||||
-Wtype-limits
|
|
||||||
-Wundef
|
|
||||||
-Wuninitialized
|
|
||||||
-Wunknown-pragmas
|
|
||||||
-Wunreachable-code
|
|
||||||
-Wunsafe-loop-optimizations
|
|
||||||
-Wunused
|
|
||||||
-Wunused-but-set-parameter
|
|
||||||
-Wunused-but-set-variable
|
|
||||||
-Wunused-const-variable=2
|
|
||||||
-Wunused-function
|
|
||||||
-Wunused-label
|
|
||||||
-Wunused-local-typedefs
|
|
||||||
-Wunused-macros
|
|
||||||
-Wunused-parameter
|
|
||||||
-Wunused-result
|
|
||||||
-Wunused-value
|
|
||||||
-Wunused-variable
|
|
||||||
-Wuse-after-free=3
|
|
||||||
-Wuseless-cast
|
|
||||||
-Wvarargs
|
|
||||||
-Wvariadic-macros
|
|
||||||
-Wvector-operation-performance
|
|
||||||
-Wvexing-parse
|
|
||||||
-Wvirtual-inheritance
|
|
||||||
-Wvirtual-move-assign
|
|
||||||
-Wvla
|
|
||||||
-Wvla-parameter
|
|
||||||
-Wvolatile
|
|
||||||
-Wvolatile-register-var
|
|
||||||
-Wwrite-strings
|
|
||||||
-Wzero-as-null-pointer-constant
|
|
||||||
-Wzero-length-bounds
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(ci_test_gcc
|
add_custom_target(ci_test_gcc
|
||||||
COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
|
COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
|
||||||
@ -437,7 +105,7 @@ add_custom_target(ci_test_clang
|
|||||||
# Different C++ Standards.
|
# Different C++ Standards.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
foreach(CXX_STANDARD 11 14 17 20)
|
foreach(CXX_STANDARD 11 14 17 20 23 26)
|
||||||
add_custom_target(ci_test_gcc_cxx${CXX_STANDARD}
|
add_custom_target(ci_test_gcc_cxx${CXX_STANDARD}
|
||||||
COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
|
COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
@ -459,6 +127,19 @@ foreach(CXX_STANDARD 11 14 17 20)
|
|||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_clang_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}"
|
COMMENT "Compile and test with Clang for C++${CXX_STANDARD}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_custom_target(ci_test_clang_libcxx_cxx${CXX_STANDARD}
|
||||||
|
COMMAND CXX=${CLANG_TOOL} CXXFLAGS="${CLANG_CXXFLAGS}" ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
|
-DJSON_TestStandards=${CXX_STANDARD}
|
||||||
|
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang_cxx${CXX_STANDARD}
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_clang_cxx${CXX_STANDARD}
|
||||||
|
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++)"
|
||||||
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -466,7 +147,7 @@ endforeach()
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_noexceptions
|
add_custom_target(ci_test_noexceptions
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DCMAKE_CXX_FLAGS=-DJSON_NOEXCEPTION -DDOCTEST_TEST_FILTER=--no-throw
|
-DJSON_BuildTests=ON -DCMAKE_CXX_FLAGS=-DJSON_NOEXCEPTION -DDOCTEST_TEST_FILTER=--no-throw
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noexceptions
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noexceptions
|
||||||
@ -480,7 +161,7 @@ add_custom_target(ci_test_noexceptions
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_noimplicitconversions
|
add_custom_target(ci_test_noimplicitconversions
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_ImplicitConversions=OFF
|
-DJSON_BuildTests=ON -DJSON_ImplicitConversions=OFF
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noimplicitconversions
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_noimplicitconversions
|
||||||
@ -494,7 +175,7 @@ add_custom_target(ci_test_noimplicitconversions
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_diagnostics
|
add_custom_target(ci_test_diagnostics
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_Diagnostics=ON
|
-DJSON_BuildTests=ON -DJSON_Diagnostics=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_diagnostics
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_diagnostics
|
||||||
@ -503,12 +184,26 @@ add_custom_target(ci_test_diagnostics
|
|||||||
COMMENT "Compile and test with improved diagnostics enabled"
|
COMMENT "Compile and test with improved diagnostics enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Enable diagnostic positions support.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
add_custom_target(ci_test_diagnostic_positions
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
|
-DJSON_BuildTests=ON -DJSON_Diagnostic_Positions=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_diagnostic_positions
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_diagnostic_positions
|
||||||
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_diagnostic_positions && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||||
|
COMMENT "Compile and test with diagnostic positions enabled"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Enable legacy discarded value comparison.
|
# Enable legacy discarded value comparison.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_legacycomparison
|
add_custom_target(ci_test_legacycomparison
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_LegacyDiscardedValueComparison=ON
|
-DJSON_BuildTests=ON -DJSON_LegacyDiscardedValueComparison=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_legacycomparison
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_legacycomparison
|
||||||
@ -522,7 +217,7 @@ add_custom_target(ci_test_legacycomparison
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_noglobaludls
|
add_custom_target(ci_test_noglobaludls
|
||||||
COMMAND CXX=${CLANG_TOOL} ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_GlobalUDLs=OFF
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_GlobalUDLs=OFF
|
||||||
-DCMAKE_CXX_FLAGS=-DJSON_TEST_NO_GLOBAL_UDLS
|
-DCMAKE_CXX_FLAGS=-DJSON_TEST_NO_GLOBAL_UDLS
|
||||||
@ -551,8 +246,8 @@ add_custom_target(ci_test_coverage
|
|||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_coverage32
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_coverage32
|
||||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_coverage32 && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_coverage32 && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||||
|
|
||||||
COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc lcov_branch_coverage=1
|
COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch --ignore-errors unused
|
||||||
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc lcov_branch_coverage=1
|
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc branch_coverage=1 --ignore-errors unused
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
|
||||||
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
|
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
|
||||||
|
|
||||||
@ -579,8 +274,6 @@ 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.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
set(ASTYLE_FLAGS --style=allman --indent=spaces=4 --indent-modifiers --indent-switches --indent-preproc-block --indent-preproc-define --indent-col1-comments --pad-oper --pad-header --align-pointer=type --align-reference=type --add-brackets --convert-tabs --close-templates --lineend=linux --preserve-date --formatted)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE INDENT_FILES
|
file(GLOB_RECURSE INDENT_FILES
|
||||||
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
|
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
|
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
|
||||||
@ -589,15 +282,26 @@ file(GLOB_RECURSE INDENT_FILES
|
|||||||
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(include_dir ${PROJECT_SOURCE_DIR}/single_include/nlohmann)
|
||||||
|
set(tool_dir ${PROJECT_SOURCE_DIR}/tools/amalgamate)
|
||||||
add_custom_target(ci_test_amalgamation
|
add_custom_target(ci_test_amalgamation
|
||||||
COMMAND rm -fr ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
|
COMMAND rm -fr ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND cp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
|
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
||||||
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/amalgamate/amalgamate.py -c ${PROJECT_SOURCE_DIR}/tools/amalgamate/config.json -s .
|
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} --suffix=none --quiet ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
|
|
||||||
COMMAND diff ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~ ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
|
|
||||||
|
|
||||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} ${INDENT_FILES}
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv_astyle
|
||||||
COMMAND cd ${PROJECT_SOURCE_DIR} && for FILE in `find . -name '*.orig'`\; do false \; done
|
COMMAND venv_astyle/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/tools/astyle/requirements.txt
|
||||||
|
COMMAND venv_astyle/bin/astyle --version
|
||||||
|
|
||||||
|
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 venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp
|
||||||
|
|
||||||
|
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||||
|
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
||||||
|
|
||||||
|
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=orig ${INDENT_FILES}
|
||||||
|
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
||||||
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
COMMENT "Check amalgamation and indentation"
|
COMMENT "Check amalgamation and indentation"
|
||||||
@ -608,7 +312,7 @@ add_custom_target(ci_test_amalgamation
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_single_header
|
add_custom_target(ci_test_single_header
|
||||||
COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
-DJSON_BuildTests=ON -DJSON_MultipleHeaders=OFF -DJSON_FastTests=ON
|
-DJSON_BuildTests=ON -DJSON_MultipleHeaders=OFF -DJSON_FastTests=ON
|
||||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_single_header
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_single_header
|
||||||
@ -651,7 +355,16 @@ add_custom_target(ci_clang_analyze
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_cppcheck
|
add_custom_target(ci_cppcheck
|
||||||
COMMAND ${CPPCHECK_TOOL} --enable=warning --suppress=missingReturn --inline-suppr --inconclusive --force --std=c++11 ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp --error-exitcode=1
|
COMMAND mkdir -p cppcheck
|
||||||
|
COMMAND clang -dM -E -x c++ -std=c++11 ${CMAKE_SOURCE_DIR}/include/nlohmann/thirdparty/hedley/hedley.hpp > default_defines.hpp 2> /dev/null
|
||||||
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv_cppcheck
|
||||||
|
COMMAND venv_cppcheck/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/cmake/requirements/requirements-cppcheck.txt
|
||||||
|
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
|
||||||
|
--error-exitcode=1 --relative-paths=${PROJECT_SOURCE_DIR} -j ${N} --include=default_defines.hpp
|
||||||
|
--cppcheck-build-dir=cppcheck --check-level=exhaustive
|
||||||
|
-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
|
||||||
COMMENT "Check code with Cppcheck"
|
COMMENT "Check code with Cppcheck"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -660,8 +373,11 @@ add_custom_target(ci_cppcheck
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_cpplint
|
add_custom_target(ci_cpplint
|
||||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv_cpplint
|
||||||
|
COMMAND venv_cpplint/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/cmake/requirements/requirements-cpplint.txt
|
||||||
|
COMMAND venv_cpplint/bin/cpplint --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
|
||||||
COMMENT "Check code with cpplint"
|
COMMENT "Check code with cpplint"
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -825,43 +541,42 @@ add_custom_target(ci_benchmarks
|
|||||||
# CMake flags
|
# CMake flags
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# we test the project with different CMake versions:
|
||||||
|
# - CMake 3.5 (the earliest supported)
|
||||||
|
# - CMake 3.31.6 (the latest 3.x release)
|
||||||
|
# - CMake 4.0.0 (the latest release)
|
||||||
|
|
||||||
function(ci_get_cmake version var)
|
function(ci_get_cmake version var)
|
||||||
if (APPLE)
|
set(${var} ${PROJECT_BINARY_DIR}/cmake-${version}/bin/cmake)
|
||||||
set(${var} ${PROJECT_BINARY_DIR}/cmake-${version}-Darwin64/CMake.app/Contents/bin/cmake)
|
add_custom_command(
|
||||||
add_custom_command(
|
OUTPUT ${${var}}
|
||||||
OUTPUT ${${var}}
|
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}.tar.gz
|
||||||
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Darwin64.tar.gz
|
COMMAND tar xfz cmake-${version}.tar.gz
|
||||||
COMMAND tar xfz cmake-${version}-Darwin64.tar.gz
|
COMMAND rm cmake-${version}.tar.gz
|
||||||
COMMAND rm cmake-${version}-Darwin64.tar.gz
|
# -DCMAKE_POLICY_VERSION_MINIMUM=3.5 required to compile older CMake versions with CMake 4.0.0
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
COMMAND cmake -S cmake-${version} -B cmake-${version} -DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||||
COMMENT "Download CMake ${version}"
|
COMMAND cmake --build cmake-${version} --parallel 10
|
||||||
)
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
else()
|
COMMENT "Download CMake ${version}"
|
||||||
set(${var} ${PROJECT_BINARY_DIR}/cmake-${version}-Linux-x86_64/bin/cmake)
|
)
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${${var}}
|
|
||||||
COMMAND wget -nc https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Linux-x86_64.tar.gz
|
|
||||||
COMMAND tar xfz cmake-${version}-Linux-x86_64.tar.gz
|
|
||||||
COMMAND rm cmake-${version}-Linux-x86_64.tar.gz
|
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
|
||||||
COMMENT "Download CMake ${version}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set(${var} ${${var}} PARENT_SCOPE)
|
set(${var} ${${var}} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
ci_get_cmake(3.1.0 CMAKE_3_1_0_BINARY)
|
ci_get_cmake(3.5.0 CMAKE_3_5_0_BINARY)
|
||||||
ci_get_cmake(3.13.0 CMAKE_3_13_0_BINARY)
|
ci_get_cmake(3.31.6 CMAKE_3_31_6_BINARY)
|
||||||
|
ci_get_cmake(4.0.0 CMAKE_4_0_0_BINARY)
|
||||||
|
|
||||||
set(JSON_CMAKE_FLAGS_3_1_0 JSON_Diagnostics JSON_GlobalUDLs JSON_ImplicitConversions JSON_DisableEnumSerialization
|
# 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
|
||||||
JSON_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind)
|
JSON_LegacyDiscardedValueComparison JSON_Install JSON_MultipleHeaders JSON_SystemInclude JSON_Valgrind)
|
||||||
set(JSON_CMAKE_FLAGS_3_13_0 JSON_BuildTests)
|
set(JSON_CMAKE_FLAGS_3_31_6 JSON_BuildTests ${JSON_CMAKE_FLAGS_3_31_6})
|
||||||
|
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}
|
add_custom_target(${flag_target}_${min_version}_2
|
||||||
COMMENT "Check CMake flag ${flag} (CMake ${CMAKE_VERSION})"
|
COMMENT "Check CMake flag ${flag} (CMake ${CMAKE_VERSION})"
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-Werror=dev
|
-Werror=dev
|
||||||
@ -881,12 +596,16 @@ function(ci_add_cmake_flags_targets flag min_version)
|
|||||||
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()
|
||||||
|
|
||||||
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_3_1_0})
|
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_3_5_0})
|
||||||
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 3.1.0)
|
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 3.5.0)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_3_13_0})
|
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_3_31_6})
|
||||||
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 3.13.0)
|
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 3.31.6)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(JSON_CMAKE_FLAG ${JSON_CMAKE_FLAGS_4_0_0})
|
||||||
|
ci_add_cmake_flags_targets(${JSON_CMAKE_FLAG} 4.0.0)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_target(ci_cmake_flags
|
add_custom_target(ci_cmake_flags
|
||||||
@ -898,15 +617,10 @@ add_custom_target(ci_cmake_flags
|
|||||||
# Use more installed compilers.
|
# Use more installed compilers.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14)
|
foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14 clang++-15 clang++-16 clang++-17 clang++-18 clang++-19 clang++-20)
|
||||||
find_program(COMPILER_TOOL NAMES ${COMPILER})
|
find_program(COMPILER_TOOL NAMES ${COMPILER})
|
||||||
if (COMPILER_TOOL)
|
if (COMPILER_TOOL)
|
||||||
if ("${COMPILER}" STREQUAL "clang++-9")
|
unset(ADDITIONAL_FLAGS)
|
||||||
# fix for https://github.com/nlohmann/json/pull/3101#issuecomment-998788786 / https://stackoverflow.com/a/64051725/266378
|
|
||||||
set(ADDITIONAL_FLAGS "-DCMAKE_CXX_FLAGS=--gcc-toolchain=/root/gcc/9")
|
|
||||||
else()
|
|
||||||
unset(ADDITIONAL_FLAGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_target(ci_test_compiler_${COMPILER}
|
add_custom_target(ci_test_compiler_${COMPILER}
|
||||||
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}
|
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}
|
||||||
@ -922,6 +636,17 @@ foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 cla
|
|||||||
unset(COMPILER_TOOL CACHE)
|
unset(COMPILER_TOOL CACHE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
add_custom_target(ci_test_compiler_default
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_default
|
||||||
|
${ADDITIONAL_FLAGS}
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_default --parallel ${N}
|
||||||
|
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_default && ${CMAKE_CTEST_COMMAND} --parallel ${N} --exclude-regex "test-unicode" -LE git_required --output-on-failure
|
||||||
|
COMMENT "Compile and test with default C++ compiler"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# CUDA example
|
# CUDA example
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -934,6 +659,17 @@ add_custom_target(ci_cuda_example
|
|||||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_cuda_example
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_cuda_example
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# C++ 20 modules
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
add_custom_target(ci_module_cpp20
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
|
-S${PROJECT_SOURCE_DIR}/tests/module_cpp20 -B${PROJECT_BINARY_DIR}/ci_module_cpp20
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/ci_module_cpp20
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Intel C++ Compiler
|
# Intel C++ Compiler
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -949,21 +685,40 @@ add_custom_target(ci_icpc
|
|||||||
COMMENT "Compile and test with ICPC"
|
COMMENT "Compile and test with ICPC"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# REUSE
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
add_custom_target(ci_reuse_compliance
|
||||||
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv_reuse
|
||||||
|
COMMAND venv_reuse/bin/pip3 --quiet install -r ${PROJECT_SOURCE_DIR}/cmake/requirements/requirements-reuse.txt
|
||||||
|
COMMAND venv_reuse/bin/reuse --root ${PROJECT_SOURCE_DIR} lint
|
||||||
|
COMMENT "Check REUSE specification compliance"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# test documentation
|
# test documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_documentation
|
add_custom_target(ci_test_examples
|
||||||
COMMAND make CXX="${GCC_TOOL}" check_output_portable -j8
|
COMMAND make CXX="${GCC_TOOL}" check_output_portable -j8
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
|
||||||
COMMENT "Check that all examples compile and create the desired output"
|
COMMENT "Check that all examples compile and create the desired output"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_custom_target(ci_test_build_documentation
|
||||||
|
COMMAND ${Python3_EXECUTABLE} -mvenv venv
|
||||||
|
COMMAND venv/bin/pip3 --quiet install -r requirements.txt
|
||||||
|
COMMAND make build
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs/mkdocs
|
||||||
|
COMMENT "Build 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_* cmake-3.1.0-Darwin64 ${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"
|
||||||
)
|
)
|
||||||
|
20
cmake/clang_flags.cmake
Normal file
20
cmake/clang_flags.cmake
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Ignored Clang warnings:
|
||||||
|
# -Wno-c++98-compat 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-extra-semi-stmt The library uses assert which triggers this warning.
|
||||||
|
# -Wno-padded We do not care about padding warnings.
|
||||||
|
# -Wno-covered-switch-default All switches list all cases and a default case.
|
||||||
|
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile.
|
||||||
|
|
||||||
|
set(CLANG_CXXFLAGS
|
||||||
|
-Werror
|
||||||
|
-Weverything
|
||||||
|
-Wno-c++98-compat
|
||||||
|
-Wno-c++98-compat-pedantic
|
||||||
|
-Wno-deprecated-declarations
|
||||||
|
-Wno-extra-semi-stmt
|
||||||
|
-Wno-padded
|
||||||
|
-Wno-covered-switch-default
|
||||||
|
-Wno-unsafe-buffer-usage
|
||||||
|
)
|
31
cmake/detect_libcpp_version.cpp
Normal file
31
cmake/detect_libcpp_version.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Detect used C++ Standard Library
|
||||||
|
*
|
||||||
|
* This file is compiled and run via try_run in download_test_data.cmake.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
// see https://en.cppreference.com/w/cpp/header/ciso646
|
||||||
|
#if __cplusplus >= 202002L
|
||||||
|
#include <version>
|
||||||
|
#else
|
||||||
|
#include <ciso646>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#if defined(_LIBCPP_VERSION)
|
||||||
|
std::printf("LLVM C++ Standard Library (libc++), _LIBCPP_VERSION=%d", _LIBCPP_VERSION);
|
||||||
|
#elif defined(__GLIBCXX__)
|
||||||
|
std::printf("GNU C++ Standard Library (libstdc++), __GLIBCXX__=%d", __GLIBCXX__);
|
||||||
|
#elif defined(_MSVC_STL_VERSION)
|
||||||
|
std::printf("Microsoft C++ Standard Library (MSVC STL), _MSVC_STL_VERSION=%d", _MSVC_STL_VERSION);
|
||||||
|
#elif defined(_LIBCUDACXX_VERSION)
|
||||||
|
std::printf("NVIDIA C++ Standard Library (libcudacxx), _LIBCUDACXX_VERSION=%d", _LIBCUDACXX_VERSION);
|
||||||
|
#elif defined(EASTL_VERSION)
|
||||||
|
std::printf("Electronic Arts Standard Template Library (EASTL), EASTL_VERSION=%d", EASTL_VERSION);
|
||||||
|
#else
|
||||||
|
std::printf("unknown");
|
||||||
|
#endif
|
||||||
|
}
|
@ -54,3 +54,18 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}")
|
string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}")
|
||||||
message(STATUS "Compiler: ${CXX_VERSION_RESULT}")
|
message(STATUS "Compiler: ${CXX_VERSION_RESULT}")
|
||||||
|
|
||||||
|
# determine used C++ standard library (for debug and support purposes)
|
||||||
|
if(NOT DEFINED LIBCPP_VERSION_OUTPUT_CACHED)
|
||||||
|
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||||
|
"${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/cmake/detect_libcpp_version.cpp"
|
||||||
|
RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT
|
||||||
|
)
|
||||||
|
if(NOT LIBCPP_VERSION_OUTPUT)
|
||||||
|
set(LIBCPP_VERSION_OUTPUT "Unknown")
|
||||||
|
message(AUTHOR_WARNING "Failed to compile cmake/detect_libcpp_version to detect the used C++ standard library. This does not affect the library or the test cases. Please still create an issue at https://github.com/nlohmann/json to investigate this.\n${LIBCPP_VERSION_COMPILE_OUTPUT}")
|
||||||
|
endif()
|
||||||
|
set(LIBCPP_VERSION_OUTPUT_CACHED "${LIBCPP_VERSION_OUTPUT}" CACHE STRING "Detected C++ standard library version")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "C++ standard library: ${LIBCPP_VERSION_OUTPUT_CACHED}")
|
||||||
|
363
cmake/gcc_flags.cmake
Normal file
363
cmake/gcc_flags.cmake
Normal file
@ -0,0 +1,363 @@
|
|||||||
|
# Warning flags determined for GCC 15.1.0 with https://github.com/nlohmann/gcc_flags:
|
||||||
|
# Ignored GCC warnings:
|
||||||
|
# -Wno-abi-tag We do not care about ABI tags.
|
||||||
|
# -Wno-aggregate-return The library uses aggregate returns.
|
||||||
|
# -Wno-long-long The library uses the long long type to interface with system functions.
|
||||||
|
# -Wno-namespaces The library uses namespaces.
|
||||||
|
# -Wno-nrvo Doctest triggers this warning.
|
||||||
|
# -Wno-padded We do not care about padding warnings.
|
||||||
|
# -Wno-system-headers We do not care about warnings in system headers.
|
||||||
|
# -Wno-templates The library uses templates.
|
||||||
|
|
||||||
|
set(GCC_CXXFLAGS
|
||||||
|
-pedantic
|
||||||
|
-Werror
|
||||||
|
--all-warnings
|
||||||
|
--extra-warnings
|
||||||
|
-W
|
||||||
|
-WNSObject-attribute
|
||||||
|
-Wno-abi-tag
|
||||||
|
-Waddress
|
||||||
|
-Waddress-of-packed-member
|
||||||
|
-Wno-aggregate-return
|
||||||
|
-Waggressive-loop-optimizations
|
||||||
|
-Waligned-new=all
|
||||||
|
-Wall
|
||||||
|
-Walloc-size
|
||||||
|
-Walloc-zero
|
||||||
|
-Walloca
|
||||||
|
-Wanalyzer-allocation-size
|
||||||
|
-Wanalyzer-deref-before-check
|
||||||
|
-Wanalyzer-double-fclose
|
||||||
|
-Wanalyzer-double-free
|
||||||
|
-Wanalyzer-exposure-through-output-file
|
||||||
|
-Wanalyzer-exposure-through-uninit-copy
|
||||||
|
-Wanalyzer-fd-access-mode-mismatch
|
||||||
|
-Wanalyzer-fd-double-close
|
||||||
|
-Wanalyzer-fd-leak
|
||||||
|
-Wanalyzer-fd-phase-mismatch
|
||||||
|
-Wanalyzer-fd-type-mismatch
|
||||||
|
-Wanalyzer-fd-use-after-close
|
||||||
|
-Wanalyzer-fd-use-without-check
|
||||||
|
-Wanalyzer-file-leak
|
||||||
|
-Wanalyzer-free-of-non-heap
|
||||||
|
-Wanalyzer-imprecise-fp-arithmetic
|
||||||
|
-Wanalyzer-infinite-loop
|
||||||
|
-Wanalyzer-infinite-recursion
|
||||||
|
-Wanalyzer-jump-through-null
|
||||||
|
-Wanalyzer-malloc-leak
|
||||||
|
-Wanalyzer-mismatching-deallocation
|
||||||
|
-Wanalyzer-null-argument
|
||||||
|
-Wanalyzer-null-dereference
|
||||||
|
-Wanalyzer-out-of-bounds
|
||||||
|
-Wanalyzer-overlapping-buffers
|
||||||
|
-Wanalyzer-possible-null-argument
|
||||||
|
-Wanalyzer-possible-null-dereference
|
||||||
|
-Wanalyzer-putenv-of-auto-var
|
||||||
|
-Wanalyzer-shift-count-negative
|
||||||
|
-Wanalyzer-shift-count-overflow
|
||||||
|
-Wanalyzer-stale-setjmp-buffer
|
||||||
|
-Wanalyzer-symbol-too-complex
|
||||||
|
-Wanalyzer-tainted-allocation-size
|
||||||
|
-Wanalyzer-tainted-array-index
|
||||||
|
-Wanalyzer-tainted-assertion
|
||||||
|
-Wanalyzer-tainted-divisor
|
||||||
|
-Wanalyzer-tainted-offset
|
||||||
|
-Wanalyzer-tainted-size
|
||||||
|
-Wanalyzer-too-complex
|
||||||
|
-Wanalyzer-undefined-behavior-ptrdiff
|
||||||
|
-Wanalyzer-undefined-behavior-strtok
|
||||||
|
-Wanalyzer-unsafe-call-within-signal-handler
|
||||||
|
-Wanalyzer-use-after-free
|
||||||
|
-Wanalyzer-use-of-pointer-in-stale-stack-frame
|
||||||
|
-Wanalyzer-use-of-uninitialized-value
|
||||||
|
-Wanalyzer-va-arg-type-mismatch
|
||||||
|
-Wanalyzer-va-list-exhausted
|
||||||
|
-Wanalyzer-va-list-leak
|
||||||
|
-Wanalyzer-va-list-use-after-va-end
|
||||||
|
-Wanalyzer-write-to-const
|
||||||
|
-Wanalyzer-write-to-string-literal
|
||||||
|
-Warith-conversion
|
||||||
|
-Warray-bounds=2
|
||||||
|
-Warray-compare
|
||||||
|
-Warray-parameter=2
|
||||||
|
-Wattribute-alias=2
|
||||||
|
-Wattribute-warning
|
||||||
|
-Wattributes
|
||||||
|
-Wbool-compare
|
||||||
|
-Wbool-operation
|
||||||
|
-Wbuiltin-declaration-mismatch
|
||||||
|
-Wbuiltin-macro-redefined
|
||||||
|
-Wc++0x-compat
|
||||||
|
-Wc++11-compat
|
||||||
|
-Wc++11-extensions
|
||||||
|
-Wc++14-compat
|
||||||
|
-Wc++14-extensions
|
||||||
|
-Wc++17-compat
|
||||||
|
-Wc++17-extensions
|
||||||
|
-Wc++1z-compat
|
||||||
|
-Wc++20-compat
|
||||||
|
-Wc++20-extensions
|
||||||
|
-Wc++23-extensions
|
||||||
|
-Wc++26-extensions
|
||||||
|
-Wc++2a-compat
|
||||||
|
-Wcalloc-transposed-args
|
||||||
|
-Wcannot-profile
|
||||||
|
-Wcast-align
|
||||||
|
-Wcast-align=strict
|
||||||
|
-Wcast-function-type
|
||||||
|
-Wcast-qual
|
||||||
|
-Wcast-user-defined
|
||||||
|
-Wcatch-value=3
|
||||||
|
-Wchanges-meaning
|
||||||
|
-Wchar-subscripts
|
||||||
|
-Wclass-conversion
|
||||||
|
-Wclass-memaccess
|
||||||
|
-Wclobbered
|
||||||
|
-Wcomma-subscript
|
||||||
|
-Wcomment
|
||||||
|
-Wcomments
|
||||||
|
-Wcomplain-wrong-lang
|
||||||
|
-Wconditionally-supported
|
||||||
|
-Wconversion
|
||||||
|
-Wconversion-null
|
||||||
|
-Wcoverage-invalid-line-number
|
||||||
|
-Wcoverage-mismatch
|
||||||
|
-Wcoverage-too-many-conditions
|
||||||
|
-Wcoverage-too-many-paths
|
||||||
|
-Wcpp
|
||||||
|
-Wctad-maybe-unsupported
|
||||||
|
-Wctor-dtor-privacy
|
||||||
|
-Wdangling-else
|
||||||
|
-Wdangling-pointer=2
|
||||||
|
-Wdangling-reference
|
||||||
|
-Wdate-time
|
||||||
|
-Wdefaulted-function-deleted
|
||||||
|
-Wdelete-incomplete
|
||||||
|
-Wdelete-non-virtual-dtor
|
||||||
|
-Wdeprecated
|
||||||
|
-Wdeprecated-copy
|
||||||
|
-Wdeprecated-copy-dtor
|
||||||
|
-Wdeprecated-declarations
|
||||||
|
-Wdeprecated-enum-enum-conversion
|
||||||
|
-Wdeprecated-enum-float-conversion
|
||||||
|
-Wdeprecated-literal-operator
|
||||||
|
-Wdeprecated-variadic-comma-omission
|
||||||
|
-Wdisabled-optimization
|
||||||
|
-Wdiv-by-zero
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wduplicated-branches
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Weffc++
|
||||||
|
-Welaborated-enum-base
|
||||||
|
-Wempty-body
|
||||||
|
-Wendif-labels
|
||||||
|
-Wenum-compare
|
||||||
|
-Wenum-conversion
|
||||||
|
-Wexceptions
|
||||||
|
-Wexpansion-to-defined
|
||||||
|
-Wextra
|
||||||
|
-Wextra-semi
|
||||||
|
-Wflex-array-member-not-at-end
|
||||||
|
-Wfloat-conversion
|
||||||
|
-Wfloat-equal
|
||||||
|
-Wformat -Wformat-contains-nul
|
||||||
|
-Wformat -Wformat-diag
|
||||||
|
-Wformat -Wformat-extra-args
|
||||||
|
-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
|
||||||
|
-Wframe-address
|
||||||
|
-Wfree-nonheap-object
|
||||||
|
-Wglobal-module
|
||||||
|
-Whardened
|
||||||
|
-Wheader-guard
|
||||||
|
-Whsa
|
||||||
|
-Wif-not-aligned
|
||||||
|
-Wignored-attributes
|
||||||
|
-Wignored-qualifiers
|
||||||
|
-Wimplicit-fallthrough=5
|
||||||
|
-Winaccessible-base
|
||||||
|
-Winfinite-recursion
|
||||||
|
-Winherited-variadic-ctor
|
||||||
|
-Winit-list-lifetime
|
||||||
|
-Winit-self
|
||||||
|
-Winline
|
||||||
|
-Wint-in-bool-context
|
||||||
|
-Wint-to-pointer-cast
|
||||||
|
-Winterference-size
|
||||||
|
-Winvalid-constexpr
|
||||||
|
-Winvalid-imported-macros
|
||||||
|
-Winvalid-memory-model
|
||||||
|
-Winvalid-offsetof
|
||||||
|
-Winvalid-pch
|
||||||
|
-Winvalid-utf8
|
||||||
|
-Wliteral-suffix
|
||||||
|
-Wlogical-not-parentheses
|
||||||
|
-Wlogical-op
|
||||||
|
-Wno-long-long
|
||||||
|
-Wlto-type-mismatch
|
||||||
|
-Wmain
|
||||||
|
-Wmaybe-musttail-local-addr
|
||||||
|
-Wmaybe-uninitialized
|
||||||
|
-Wmemset-elt-size
|
||||||
|
-Wmemset-transposed-args
|
||||||
|
-Wmisleading-indentation
|
||||||
|
-Wmismatched-dealloc
|
||||||
|
-Wmismatched-new-delete
|
||||||
|
-Wmismatched-tags
|
||||||
|
-Wmissing-attributes
|
||||||
|
-Wmissing-braces
|
||||||
|
-Wmissing-declarations
|
||||||
|
-Wmissing-field-initializers
|
||||||
|
-Wmissing-include-dirs
|
||||||
|
-Wmissing-profile
|
||||||
|
-Wmissing-requires
|
||||||
|
-Wmissing-template-keyword
|
||||||
|
-Wmultichar
|
||||||
|
-Wmultiple-inheritance
|
||||||
|
-Wmultistatement-macros
|
||||||
|
-Wmusttail-local-addr
|
||||||
|
-Wno-namespaces
|
||||||
|
-Wnarrowing
|
||||||
|
-Wnoexcept
|
||||||
|
-Wnoexcept-type
|
||||||
|
-Wnon-template-friend
|
||||||
|
-Wnon-virtual-dtor
|
||||||
|
-Wnonnull
|
||||||
|
-Wnonnull-compare
|
||||||
|
-Wnormalized=nfkc
|
||||||
|
-Wno-nrvo
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wodr
|
||||||
|
-Wold-style-cast
|
||||||
|
-Wopenacc-parallelism
|
||||||
|
-Wopenmp
|
||||||
|
-Wopenmp-simd
|
||||||
|
-Woverflow
|
||||||
|
-Woverlength-strings
|
||||||
|
-Woverloaded-virtual=2
|
||||||
|
-Wpacked
|
||||||
|
-Wpacked-bitfield-compat
|
||||||
|
-Wpacked-not-aligned
|
||||||
|
-Wno-padded
|
||||||
|
-Wparentheses
|
||||||
|
-Wpedantic
|
||||||
|
-Wpessimizing-move
|
||||||
|
-Wplacement-new=2
|
||||||
|
-Wpmf-conversions
|
||||||
|
-Wpointer-arith
|
||||||
|
-Wpointer-compare
|
||||||
|
-Wpragma-once-outside-header
|
||||||
|
-Wpragmas
|
||||||
|
-Wprio-ctor-dtor
|
||||||
|
-Wpsabi
|
||||||
|
-Wrange-loop-construct
|
||||||
|
-Wredundant-decls
|
||||||
|
-Wredundant-move
|
||||||
|
-Wredundant-tags
|
||||||
|
-Wregister
|
||||||
|
-Wreorder
|
||||||
|
-Wrestrict
|
||||||
|
-Wreturn-local-addr
|
||||||
|
-Wreturn-type
|
||||||
|
-Wscalar-storage-order
|
||||||
|
-Wself-move
|
||||||
|
-Wsequence-point
|
||||||
|
-Wshadow=compatible-local
|
||||||
|
-Wshadow=global
|
||||||
|
-Wshadow=local
|
||||||
|
-Wshift-count-negative
|
||||||
|
-Wshift-count-overflow
|
||||||
|
-Wshift-negative-value
|
||||||
|
-Wshift-overflow=2
|
||||||
|
-Wsign-compare
|
||||||
|
-Wsign-conversion
|
||||||
|
-Wsign-promo
|
||||||
|
-Wsized-deallocation
|
||||||
|
-Wsizeof-array-argument
|
||||||
|
-Wsizeof-array-div
|
||||||
|
-Wsizeof-pointer-div
|
||||||
|
-Wsizeof-pointer-memaccess
|
||||||
|
-Wstack-protector
|
||||||
|
-Wstrict-aliasing
|
||||||
|
-Wstrict-aliasing=3
|
||||||
|
-Wstrict-null-sentinel
|
||||||
|
-Wstrict-overflow
|
||||||
|
-Wstring-compare
|
||||||
|
-Wstringop-overflow
|
||||||
|
-Wstringop-overflow=4
|
||||||
|
-Wstringop-overread
|
||||||
|
-Wstringop-truncation
|
||||||
|
-Wsubobject-linkage
|
||||||
|
-Wsuggest-attribute=cold
|
||||||
|
-Wsuggest-attribute=const
|
||||||
|
-Wsuggest-attribute=format
|
||||||
|
-Wsuggest-attribute=malloc
|
||||||
|
-Wsuggest-attribute=noreturn
|
||||||
|
-Wsuggest-attribute=pure
|
||||||
|
-Wsuggest-attribute=returns_nonnull
|
||||||
|
-Wsuggest-final-methods
|
||||||
|
-Wsuggest-final-types
|
||||||
|
-Wsuggest-override
|
||||||
|
-Wswitch
|
||||||
|
-Wswitch-bool
|
||||||
|
-Wswitch-default
|
||||||
|
-Wswitch-enum
|
||||||
|
-Wswitch-outside-range
|
||||||
|
-Wswitch-unreachable
|
||||||
|
-Wsync-nand
|
||||||
|
-Wsynth
|
||||||
|
-Wno-system-headers
|
||||||
|
-Wtautological-compare
|
||||||
|
-Wtemplate-body
|
||||||
|
-Wtemplate-id-cdtor
|
||||||
|
-Wtemplate-names-tu-local
|
||||||
|
-Wno-templates
|
||||||
|
-Wterminate
|
||||||
|
-Wtrailing-whitespace
|
||||||
|
-Wtrampolines
|
||||||
|
-Wtrigraphs
|
||||||
|
-Wtrivial-auto-var-init
|
||||||
|
-Wtsan
|
||||||
|
-Wtype-limits
|
||||||
|
-Wundef
|
||||||
|
-Wunicode
|
||||||
|
-Wuninitialized
|
||||||
|
-Wunknown-pragmas
|
||||||
|
-Wunreachable-code
|
||||||
|
-Wunsafe-loop-optimizations
|
||||||
|
-Wunused
|
||||||
|
-Wunused-but-set-parameter
|
||||||
|
-Wunused-but-set-variable
|
||||||
|
-Wunused-const-variable=2
|
||||||
|
-Wunused-function
|
||||||
|
-Wunused-label
|
||||||
|
-Wunused-local-typedefs
|
||||||
|
-Wunused-macros
|
||||||
|
-Wunused-parameter
|
||||||
|
-Wunused-result
|
||||||
|
-Wunused-value
|
||||||
|
-Wunused-variable
|
||||||
|
-Wuse-after-free=3
|
||||||
|
-Wuseless-cast
|
||||||
|
-Wvarargs
|
||||||
|
-Wvariadic-macros
|
||||||
|
-Wvector-operation-performance
|
||||||
|
-Wvexing-parse
|
||||||
|
-Wvirtual-inheritance
|
||||||
|
-Wvirtual-move-assign
|
||||||
|
-Wvla
|
||||||
|
-Wvla-parameter
|
||||||
|
-Wvolatile
|
||||||
|
-Wvolatile-register-var
|
||||||
|
-Wwrite-strings
|
||||||
|
-Wxor-used-as-pow
|
||||||
|
-Wzero-as-null-pointer-constant
|
||||||
|
-Wzero-length-bounds
|
||||||
|
)
|
@ -1,4 +1,7 @@
|
|||||||
Name: ${PROJECT_NAME}
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||||
|
|
||||||
|
Name: @PROJECT_NAME@
|
||||||
Description: JSON for Modern C++
|
Description: JSON for Modern C++
|
||||||
Version: ${PROJECT_VERSION}
|
Version: @PROJECT_VERSION@
|
||||||
Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
Cflags: -I${includedir}
|
||||||
|
1
cmake/requirements/requirements-cppcheck.txt
Normal file
1
cmake/requirements/requirements-cppcheck.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
cppcheck==1.5.0
|
1
cmake/requirements/requirements-cpplint.txt
Normal file
1
cmake/requirements/requirements-cpplint.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
cpplint==2.0.2
|
1
cmake/requirements/requirements-reuse.txt
Normal file
1
cmake/requirements/requirements-reuse.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
reuse==5.0.2
|
24
cmake/scripts/gen_bazel_build_file.cmake
Normal file
24
cmake/scripts/gen_bazel_build_file.cmake
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# generate Bazel BUILD file
|
||||||
|
|
||||||
|
set(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")
|
||||||
|
set(BUILD_FILE "${PROJECT_ROOT}/BUILD.bazel")
|
||||||
|
|
||||||
|
file(GLOB_RECURSE HEADERS LIST_DIRECTORIES false RELATIVE "${PROJECT_ROOT}" "include/*.hpp")
|
||||||
|
|
||||||
|
file(WRITE "${BUILD_FILE}" [=[
|
||||||
|
cc_library(
|
||||||
|
name = "json",
|
||||||
|
hdrs = [
|
||||||
|
]=])
|
||||||
|
|
||||||
|
foreach(header ${HEADERS})
|
||||||
|
file(APPEND "${BUILD_FILE}" " \"${header}\",\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(APPEND "${BUILD_FILE}" [=[
|
||||||
|
],
|
||||||
|
includes = ["include"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
alwayslink = True,
|
||||||
|
)
|
||||||
|
]=])
|
@ -259,7 +259,7 @@ function(json_test_should_build_32bit_test build_32bit_var build_32bit_only_var
|
|||||||
# check if compiler is targeting 32bit by default
|
# check if compiler is targeting 32bit by default
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
check_type_size("size_t" sizeof_size_t LANGUAGE CXX)
|
check_type_size("size_t" sizeof_size_t LANGUAGE CXX)
|
||||||
if(sizeof_size_t AND ${sizeof_size_t} EQUAL 4)
|
if(${sizeof_size_t} AND ${sizeof_size_t} EQUAL 4)
|
||||||
message(STATUS "Auto-enabling 32bit unit test.")
|
message(STATUS "Auto-enabling 32bit unit test.")
|
||||||
set(${build_32bit_var} ON)
|
set(${build_32bit_var} ON)
|
||||||
else()
|
else()
|
||||||
|
@ -7,7 +7,7 @@ all: create_output
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# where are the example cpp files
|
# where are the example cpp files
|
||||||
EXAMPLES = $(wildcard examples/*.cpp)
|
EXAMPLES = $(wildcard mkdocs/docs/examples/*.cpp)
|
||||||
|
|
||||||
cxx_standard = $(lastword c++11 $(filter c++%, $(subst ., ,$1)))
|
cxx_standard = $(lastword c++11 $(filter c++%, $(subst ., ,$1)))
|
||||||
|
|
||||||
@ -37,9 +37,8 @@ check_output: $(EXAMPLES:.cpp=.test)
|
|||||||
|
|
||||||
# check output of all stand-alone example files (exclude files with platform-dependent output.)
|
# check output of all stand-alone example files (exclude files with platform-dependent output.)
|
||||||
# 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 examples/meta.test examples/max_size.test examples/std_hash.test examples/basic_json__CompatibleType.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=)
|
||||||
$(MAKE) clean -C docset
|
$(MAKE) clean -C docset
|
||||||
$(MAKE) clean -C mkdocs
|
|
||||||
|
BIN
docs/avatars.png
BIN
docs/avatars.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.6 MiB |
@ -1,3 +1,4 @@
|
|||||||
|
SHELL=/usr/bin/env bash
|
||||||
SED ?= $(shell which gsed 2>/dev/null || which sed)
|
SED ?= $(shell which gsed 2>/dev/null || which sed)
|
||||||
|
|
||||||
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
|
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
|
||||||
@ -15,6 +16,7 @@ JSON_for_Modern_C++.docset: Info.plist docSet.dsidx
|
|||||||
cp icon*.png JSON_for_Modern_C++.docset
|
cp icon*.png JSON_for_Modern_C++.docset
|
||||||
cp Info.plist JSON_for_Modern_C++.docset/Contents
|
cp Info.plist JSON_for_Modern_C++.docset/Contents
|
||||||
# build and copy documentation
|
# build and copy documentation
|
||||||
|
$(MAKE) install_venv -C ../mkdocs
|
||||||
$(MAKE) build -C ../mkdocs
|
$(MAKE) build -C ../mkdocs
|
||||||
cp -r ../mkdocs/site/* JSON_for_Modern_C++.docset/Contents/Resources/Documents
|
cp -r ../mkdocs/site/* JSON_for_Modern_C++.docset/Contents/Resources/Documents
|
||||||
# patch CSS to hide navigation items
|
# patch CSS to hide navigation items
|
||||||
|
@ -38,6 +38,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::emplace', 'Method
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::emplace_back', 'Method', 'api/basic_json/emplace_back/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::emplace_back', 'Method', 'api/basic_json/emplace_back/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::empty', 'Method', 'api/basic_json/empty/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::empty', 'Method', 'api/basic_json/empty/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::end', 'Method', 'api/basic_json/end/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::end', 'Method', 'api/basic_json/end/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::end_pos', 'Method', 'api/basic_json/end_pos/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::erase', 'Method', 'api/basic_json/erase/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::erase', 'Method', 'api/basic_json/erase/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::error_handler_t', 'Enum', 'api/basic_json/error_handler_t/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::error_handler_t', 'Enum', 'api/basic_json/error_handler_t/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::exception', 'Class', 'api/basic_json/exception/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::exception', 'Class', 'api/basic_json/exception/index.html');
|
||||||
@ -72,6 +73,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_primitive', 'M
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_string', 'Method', 'api/basic_json/is_string/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_string', 'Method', 'api/basic_json/is_string/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_structured', 'Method', 'api/basic_json/is_structured/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::is_structured', 'Method', 'api/basic_json/is_structured/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::items', 'Method', 'api/basic_json/items/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::items', 'Method', 'api/basic_json/items/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_base_class_t', 'Type', 'api/basic_json/json_base_class_t/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_serializer', 'Class', 'api/basic_json/json_serializer/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::json_serializer', 'Class', 'api/basic_json/json_serializer/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::max_size', 'Method', 'api/basic_json/max_size/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::max_size', 'Method', 'api/basic_json/max_size/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::merge_patch', 'Method', 'api/basic_json/merge_patch/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::merge_patch', 'Method', 'api/basic_json/merge_patch/index.html');
|
||||||
@ -107,6 +109,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::rbegin', 'Method'
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::rend', 'Method', 'api/basic_json/rend/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::rend', 'Method', 'api/basic_json/rend/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::sax_parse', 'Function', 'api/basic_json/sax_parse/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::sax_parse', 'Function', 'api/basic_json/sax_parse/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::size', 'Method', 'api/basic_json/size/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::size', 'Method', 'api/basic_json/size/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::start_pos', 'Method', 'api/basic_json/start_pos/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::string_t', 'Type', 'api/basic_json/string_t/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::string_t', 'Type', 'api/basic_json/string_t/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::swap', 'Method', 'api/basic_json/swap/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::swap', 'Method', 'api/basic_json/swap/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::type', 'Method', 'api/basic_json/type/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('basic_json::type', 'Method', 'api/basic_json/type/index.html');
|
||||||
@ -128,6 +131,8 @@ INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer', 'Class', 'api/
|
|||||||
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::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_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');
|
||||||
@ -173,6 +178,8 @@ INSERT INTO searchIndex(name, type, path) VALUES ('Element Access', 'Guide', 'fe
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Access with default value: value', 'Guide', 'features/element_access/default_value/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Access with default value: value', 'Guide', 'features/element_access/default_value/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Checked access: at', 'Guide', 'features/element_access/checked_access/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Checked access: at', 'Guide', 'features/element_access/checked_access/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Unchecked access: operator[]', 'Guide', 'features/element_access/unchecked_access/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Element Access: Unchecked access: operator[]', 'Guide', 'features/element_access/unchecked_access/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Exceptions', 'Guide', 'home/exceptions/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Migration Guide', 'Guide', 'integration/migration_guide/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: CMake', 'Guide', 'integration/cmake/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: CMake', 'Guide', 'integration/cmake/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Header only', 'Guide', 'integration/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Header only', 'Guide', 'integration/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Package Managers', 'Guide', 'integration/package_managers/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Integration: Package Managers', 'Guide', 'integration/package_managers/index.html');
|
||||||
@ -181,6 +188,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('Iterators', 'Guide', 'feature
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('nlohmann Namespace', 'Guide', 'features/namespace/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Types', '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');
|
||||||
@ -197,6 +205,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('Supported Macros', 'Guide', '
|
|||||||
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_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_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_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');
|
||||||
@ -205,6 +214,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_20', 'Macro', 'a
|
|||||||
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_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_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');
|
||||||
@ -216,6 +226,10 @@ INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_GLOBAL_UDLS', 'Macro
|
|||||||
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 ('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_WITH_DEFAULT', '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_WITH_DEFAULT', 'Macro', 'api/macros/nlohmann_define_derived_type/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_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_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');
|
||||||
@ -223,6 +237,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTR
|
|||||||
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_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_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');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "JSON for Modern C++",
|
"name": "JSON for Modern C++",
|
||||||
"version": "3.11.1",
|
"version": "3.12.0",
|
||||||
"archive": "JSON_for_Modern_C++.tgz",
|
"archive": "JSON_for_Modern_C++.tgz",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Niels Lohmann",
|
"name": "Niels Lohmann",
|
||||||
|
@ -1 +0,0 @@
|
|||||||
JSON for Modern C++ version 3.11.1
|
|
BIN
docs/json.gif
BIN
docs/json.gif
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
@ -1,36 +1,45 @@
|
|||||||
# serve the site locally
|
# serve the site locally
|
||||||
serve: prepare_files style_check
|
serve: style_check
|
||||||
venv/bin/mkdocs serve
|
venv/bin/mkdocs serve
|
||||||
|
|
||||||
serve_dirty: prepare_files style_check
|
serve_dirty: style_check
|
||||||
venv/bin/mkdocs serve --dirtyreload
|
venv/bin/mkdocs serve --dirtyreload
|
||||||
|
|
||||||
build: prepare_files style_check
|
# This target is used in the CI (ci_test_build_documentation).
|
||||||
|
# This target is used by the docset Makefile.
|
||||||
|
build: style_check
|
||||||
venv/bin/mkdocs build
|
venv/bin/mkdocs build
|
||||||
|
|
||||||
# create files that are not versioned inside the mkdocs folder (images, examples)
|
|
||||||
prepare_files: clean
|
|
||||||
mkdir docs/examples
|
|
||||||
cp -r ../json.gif docs/images
|
|
||||||
cp -r ../examples/*.cpp ../examples/*.output docs/examples
|
|
||||||
|
|
||||||
style_check:
|
style_check:
|
||||||
@cd docs ; python3 ../scripts/check_structure.py
|
@cd docs ; ../venv/bin/python3 ../scripts/check_structure.py
|
||||||
|
|
||||||
# clean subfolders
|
# check the links in the documentation files in docs/mkdocs
|
||||||
clean:
|
link_check:
|
||||||
rm -fr docs/images/json.gif docs/examples
|
ENABLED_HTMLPROOFER=true venv/bin/mkdocs build
|
||||||
|
|
||||||
# publish site to GitHub pages
|
# check the links in all other Markdown files
|
||||||
publish: prepare_files
|
link_check_markdowns:
|
||||||
|
npx markdown-link-check --progress --alive 200,429 ../../README.md ../../FILES.md ../../.github/*.md
|
||||||
|
|
||||||
|
# publish site to GitHub pages (not working in GitHub Actions; need special action)
|
||||||
|
publish:
|
||||||
venv/bin/mkdocs gh-deploy --clean --force
|
venv/bin/mkdocs gh-deploy --clean --force
|
||||||
|
|
||||||
# install a Python virtual environment
|
# install a Python virtual environment
|
||||||
|
# This target is used by the docset Makefile.
|
||||||
install_venv: requirements.txt
|
install_venv: requirements.txt
|
||||||
python3 -mvenv venv
|
python3 -mvenv venv
|
||||||
venv/bin/pip install wheel
|
venv/bin/pip install --upgrade pip
|
||||||
venv/bin/pip install -r requirements.txt
|
venv/bin/pip install -r requirements.txt
|
||||||
|
|
||||||
# uninstall the virtual environment
|
# uninstall the virtual environment
|
||||||
uninstall_venv: clean
|
uninstall_venv:
|
||||||
rm -fr venv
|
rm -fr venv
|
||||||
|
|
||||||
|
update_requirements:
|
||||||
|
rm -fr venv_small
|
||||||
|
python3 -mvenv venv_small
|
||||||
|
venv_small/bin/pip3 install pur
|
||||||
|
venv_small/bin/pur -r requirements.txt
|
||||||
|
rm -fr venv_small venv
|
||||||
|
make install_venv
|
||||||
|
@ -14,8 +14,8 @@ noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_
|
|||||||
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
|
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
|
||||||
```
|
```
|
||||||
|
|
||||||
This function is usually called by the [`get()`](../basic_json/get.md) function of the
|
This function is usually called by the [`get()`](../basic_json/get.md) function of the [basic_json](../basic_json/index.md)
|
||||||
[basic_json](../basic_json) class (either explicit or via conversion operators).
|
class (either explicitly or via the conversion operators).
|
||||||
|
|
||||||
1. This function is chosen for default-constructible value types.
|
1. This function is chosen for default-constructible value types.
|
||||||
2. This function is chosen for value types which are not default-constructible.
|
2. This function is chosen for value types which are not default-constructible.
|
||||||
@ -32,9 +32,41 @@ This function is usually called by the [`get()`](../basic_json/get.md) function
|
|||||||
|
|
||||||
Copy of the JSON value, converted to `ValueType`
|
Copy of the JSON value, converted to `ValueType`
|
||||||
|
|
||||||
!!! note
|
## Examples
|
||||||
|
|
||||||
This documentation page is a stub.
|
??? example "Example: (1) Default-constructible type"
|
||||||
|
|
||||||
|
The example below shows how a `from_json` function can be implemented for a user-defined type. This function is
|
||||||
|
called by the `adl_serializer` when `template get<ns::person>()` is called.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/from_json__default_constructible.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/from_json__default_constructible.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
??? example "Example: (2) Non-default-constructible type"
|
||||||
|
|
||||||
|
The example below shows how a `from_json` is implemented as part of a specialization of the `adl_serializer` to
|
||||||
|
realize the conversion of a non-default-constructible type.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [to_json](to_json.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ struct adl_serializer;
|
|||||||
Serializer that uses ADL ([Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)) to choose
|
Serializer that uses ADL ([Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)) to choose
|
||||||
`to_json`/`from_json` functions from the types' namespaces.
|
`to_json`/`from_json` functions from the types' namespaces.
|
||||||
|
|
||||||
It is implemented similar to
|
It is implemented similarly to
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
|
@ -7,7 +7,7 @@ static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
|
|||||||
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
|
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
|
||||||
```
|
```
|
||||||
|
|
||||||
This function is usually called by the constructors of the [basic_json](../basic_json) class.
|
This function is usually called by the constructors of the [basic_json](../basic_json/index.md) class.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@ -17,9 +17,26 @@ This function is usually called by the constructors of the [basic_json](../basic
|
|||||||
`val` (in)
|
`val` (in)
|
||||||
: value to read from
|
: value to read from
|
||||||
|
|
||||||
!!! note
|
## Examples
|
||||||
|
|
||||||
This documentation page is a stub.
|
??? example
|
||||||
|
|
||||||
|
The example below shows how a `to_json` function can be implemented for a user-defined type. This function is called
|
||||||
|
by the `adl_serializer` when the constructor `basic_json(ns::person)` is called.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/to_json.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/to_json.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [from_json](from_json.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -4,12 +4,14 @@
|
|||||||
// (1)
|
// (1)
|
||||||
template<typename InputType>
|
template<typename InputType>
|
||||||
static bool accept(InputType&& i,
|
static bool accept(InputType&& i,
|
||||||
const bool ignore_comments = false);
|
const bool ignore_comments = false,
|
||||||
|
const bool ignore_trailing_commas = false);
|
||||||
|
|
||||||
// (2)
|
// (2)
|
||||||
template<typename IteratorType>
|
template<typename IteratorType>
|
||||||
static bool accept(IteratorType first, IteratorType last,
|
static bool accept(IteratorType first, IteratorType last,
|
||||||
const bool ignore_comments = false);
|
const bool ignore_comments = false,
|
||||||
|
const bool ignore_trailing_commas = false);
|
||||||
```
|
```
|
||||||
|
|
||||||
Checks whether the input is valid JSON.
|
Checks whether the input is valid JSON.
|
||||||
@ -17,10 +19,10 @@ Checks whether the input is valid JSON.
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from a pair of character iterators
|
2. Reads from a pair of character iterators
|
||||||
|
|
||||||
The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted
|
The value_type of the iterator must be an integral type with a size of 1, 2, or 4 bytes, which will be interpreted
|
||||||
respectively as UTF-8, UTF-16 and UTF-32.
|
respectively as UTF-8, UTF-16, and UTF-32.
|
||||||
|
|
||||||
Unlike the [`parse`](parse.md) function, this function neither throws an exception in case of invalid JSON input
|
Unlike the [`parse()`](parse.md) function, this function neither throws an exception in case of invalid JSON input
|
||||||
(i.e., a parse error) nor creates diagnostic information.
|
(i.e., a parse error) nor creates diagnostic information.
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
@ -29,9 +31,9 @@ Unlike the [`parse`](parse.md) function, this function neither throws an excepti
|
|||||||
: A compatible input, for instance:
|
: A compatible input, for instance:
|
||||||
|
|
||||||
- an `std::istream` object
|
- an `std::istream` object
|
||||||
- a `FILE` pointer (must not be null)
|
- a `#!c FILE` pointer (throws if null)
|
||||||
- a C-style array of characters
|
- a C-style array of characters
|
||||||
- a pointer to a null-terminated string of single byte characters
|
- a pointer to a null-terminated string of single byte characters (throws if null)
|
||||||
- a `std::string`
|
- a `std::string`
|
||||||
- an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators.
|
- an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators.
|
||||||
|
|
||||||
@ -50,11 +52,15 @@ Unlike the [`parse`](parse.md) function, this function neither throws an excepti
|
|||||||
: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
||||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||||
|
|
||||||
|
`ignore_trailing_commas` (in)
|
||||||
|
: whether trailing commas in arrays or objects should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
||||||
|
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of character range
|
: iterator to the start of the character range
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of character range
|
: iterator to the end of the character range
|
||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
@ -64,18 +70,17 @@ Whether the input is valid JSON.
|
|||||||
|
|
||||||
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
|
||||||
|
|
||||||
|
## Exceptions
|
||||||
|
|
||||||
|
Throws [`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101) in case of an empty input like a null `#!c FILE*` or `#!c char*` pointer.
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the length of the input. The parser is a predictive LL(1) parser.
|
Linear in the length of the input. The parser is a predictive LL(1) parser.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
(1) A UTF-8 byte order mark is silently ignored.
|
A UTF-8 byte order mark is silently ignored.
|
||||||
|
|
||||||
!!! danger "Runtime assertion"
|
|
||||||
|
|
||||||
The precondition that a passed `#!cpp FILE` pointer must not be null is enforced with a
|
|
||||||
[runtime assertion](../../features/assertions.md).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@ -102,6 +107,8 @@ Linear in the length of the input. The parser is a predictive LL(1) parser.
|
|||||||
|
|
||||||
- Added in version 3.0.0.
|
- Added in version 3.0.0.
|
||||||
- Ignoring comments via `ignore_comments` added in version 3.9.0.
|
- Ignoring comments via `ignore_comments` added in version 3.9.0.
|
||||||
|
- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.12.0.
|
||||||
|
- Added `ignore_trailing_commas` in version 3.12.1.
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
|
@ -59,29 +59,29 @@ 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.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an array;
|
- Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an array;
|
||||||
in this case, calling `at` with an index makes no sense. See example below.
|
in this case, calling `at` with an index makes no sense. See the example below.
|
||||||
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if the index `idx` is out of
|
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if the index `idx` is out of
|
||||||
range of the array; that is, `idx >= size()`. See example below.
|
range of the array; that is, `idx >= size()`. See the example below.
|
||||||
2. The function can throw the following exceptions:
|
2. The function can throw the following exceptions:
|
||||||
- Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an object;
|
- Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an object;
|
||||||
in this case, calling `at` with a key makes no sense. See example below.
|
in this case, calling `at` with a key makes no sense. See the example below.
|
||||||
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the key `key` is not
|
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the key `key` is not
|
||||||
stored in the object; that is, `find(key) == end()`. See example below.
|
stored in the object; that is, `find(key) == end()`. See the example below.
|
||||||
3. See 2.
|
3. See 2.
|
||||||
4. The function can throw the following exceptions:
|
4. The function can throw the following exceptions:
|
||||||
- Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed
|
- Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed
|
||||||
JSON pointer `ptr` begins with '0'. See example below.
|
JSON pointer `ptr` begins with '0'. See the example below.
|
||||||
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed
|
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed
|
||||||
JSON pointer `ptr` is not a number. See example below.
|
JSON pointer `ptr` is not a number. See the example below.
|
||||||
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index in the passed
|
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index in the passed
|
||||||
JSON pointer `ptr` is out of range. See example below.
|
JSON pointer `ptr` is out of range. See the example below.
|
||||||
- Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used
|
- Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used
|
||||||
in the passed JSON pointer `ptr`. As `at` provides checked access (and no elements are implicitly inserted), the
|
in the passed JSON pointer `ptr`. As `at` provides checked access (and no elements are implicitly inserted), the
|
||||||
index '-' is always invalid. See example below.
|
index '-' is always invalid. See the example below.
|
||||||
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the JSON pointer describes a
|
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the JSON pointer describes a
|
||||||
key of an object which cannot be found. See example below.
|
key of an object which cannot be found. See the example below.
|
||||||
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
|
||||||
not be resolved. See example below.
|
not be resolved. See the example below.
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
@ -215,8 +215,8 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
## See also
|
## See also
|
||||||
|
|
||||||
- documentation on [checked access](../../features/element_access/checked_access.md)
|
- documentation on [checked access](../../features/element_access/checked_access.md)
|
||||||
- see [`operator[]`](operator%5B%5D.md) for unchecked access by reference
|
- [`operator[]`](operator%5B%5D.md) for unchecked access by reference
|
||||||
- see [`value`](value.md) for access with default value
|
- [`value`](value.md) for access with default value
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ return *tmp;
|
|||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
In case of a structured type (array or object), a reference to the last element is returned. In case of number, string,
|
In the case of a structured type (array or object), a reference to the last element is returned. In the case of number,
|
||||||
boolean, or binary values, a reference to the value is returned.
|
string, boolean, or binary values, a reference to the value is returned.
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
- **boolean**: `boolean_t` / `bool` can be used.
|
- **boolean**: `boolean_t` / `bool` can be used.
|
||||||
- **binary**: `binary_t` / `std::vector<uint8_t>` may be used; unfortunately because string literals cannot be
|
- **binary**: `binary_t` / `std::vector<uint8_t>` may be used; unfortunately because string literals cannot be
|
||||||
distinguished from binary character arrays by the C++ type system, all types compatible with `const char*` will be
|
distinguished from binary character arrays by the C++ type system, all types compatible with `const char*` will be
|
||||||
directed to the string constructor instead. This is both for backwards compatibility, and due to the fact that a
|
directed to the string constructor instead. This is both for backwards compatibility and due to the fact that a
|
||||||
binary type is not a standard JSON type.
|
binary type is not a standard JSON type.
|
||||||
|
|
||||||
See the examples below.
|
See the examples below.
|
||||||
@ -99,8 +99,8 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be
|
2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be
|
||||||
of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an
|
of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an
|
||||||
object.
|
object.
|
||||||
3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON
|
3. In all other cases, the initializer list could not be interpreted as a JSON object type, so interpreting it as a
|
||||||
array type is safe.
|
JSON array type is safe.
|
||||||
|
|
||||||
With the rules described above, the following JSON values cannot be expressed by an initializer list:
|
With the rules described above, the following JSON values cannot be expressed by an initializer list:
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is
|
6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is
|
||||||
created.
|
created.
|
||||||
|
|
||||||
7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depends on the different
|
7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depend on the different
|
||||||
types a JSON value can have:
|
types a JSON value can have:
|
||||||
|
|
||||||
- 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)
|
||||||
@ -175,10 +175,10 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
: the number of JSON copies of `val` to create
|
: the number of JSON copies of `val` to create
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: begin of the range to copy from (included)
|
: the beginning of the range to copy from (included)
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: end of the range to copy from (excluded)
|
: the end of the range to copy from (excluded)
|
||||||
|
|
||||||
`other` (in)
|
`other` (in)
|
||||||
: the JSON value to copy/move
|
: the JSON value to copy/move
|
||||||
@ -188,10 +188,10 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
2. No-throw guarantee: this constructor never throws exceptions.
|
2. No-throw guarantee: this constructor never throws exceptions.
|
||||||
3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
||||||
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
`to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any
|
||||||
JSON value.
|
JSON value.
|
||||||
4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
|
||||||
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
|
`to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any
|
||||||
JSON value.
|
JSON value.
|
||||||
5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
|
||||||
@ -217,7 +217,7 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
`[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, or string), but `first` does not point to the first
|
and `last` belong to a primitive type (number, boolean, or string), but `first` does not point to the first
|
||||||
element anymore. In this case, the range `[first, last)` is undefined. See 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)
|
||||||
@ -333,7 +333,7 @@ basic_json(basic_json&& other) noexcept;
|
|||||||
--8<-- "examples/basic_json__list_init_t.output"
|
--8<-- "examples/basic_json__list_init_t.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
??? example "Example: (6) construct an array with count copies of given value"
|
??? example "Example: (6) construct an array with count copies of a given value"
|
||||||
|
|
||||||
The following code shows examples for creating arrays with several copies of a given value.
|
The following code shows examples for creating arrays with several copies of a given value.
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ create a value for serialization to those formats.
|
|||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`init` (in)
|
`init` (in)
|
||||||
: container containing bytes to use as binary type
|
: container containing bytes to use as a binary type
|
||||||
|
|
||||||
`subtype` (in)
|
`subtype` (in)
|
||||||
: subtype to use in CBOR, MessagePack, and BSON
|
: subtype to use in CBOR, MessagePack, and BSON
|
||||||
@ -42,8 +42,8 @@ Linear in the size of `init`; constant for `typename binary_t::container_type&&
|
|||||||
|
|
||||||
Note, this function exists because of the difficulty in correctly specifying the correct template overload in the
|
Note, this function exists because of the difficulty in correctly specifying the correct template overload in the
|
||||||
standard value ctor, as both JSON arrays and JSON binary arrays are backed with some form of a `std::vector`. Because
|
standard value ctor, as both JSON arrays and JSON binary arrays are backed with some form of a `std::vector`. Because
|
||||||
JSON binary arrays are a non-standard extension it was decided that it would be best to prevent automatic initialization
|
JSON binary arrays are a non-standard extension, it was decided that it would be best to prevent automatic
|
||||||
of a binary array type, for backwards compatibility and so it does not happen on accident.
|
initialization of a binary array type, for backwards compatibility and so it does not happen on accident.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ type `#!cpp binary_t*` must be dereferenced.
|
|||||||
- MessagePack
|
- MessagePack
|
||||||
- If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1,
|
- If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1,
|
||||||
fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is
|
fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is
|
||||||
then added as signed 8-bit integer.
|
then added as a signed 8-bit integer.
|
||||||
- If no subtype is given, the bin family (bin8, bin16, bin32) is used.
|
- If no subtype is given, the bin family (bin8, bin16, bin32) is used.
|
||||||
|
|
||||||
- BSON
|
- BSON
|
||||||
- If a subtype is given, it is used and added as unsigned 8-bit integer.
|
- If a subtype is given, it is used and added as an unsigned 8-bit integer.
|
||||||
- If no subtype is given, the generic binary subtype 0x00 is used.
|
- If no subtype is given, the generic binary subtype 0x00 is used.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@ -86,4 +86,4 @@ type `#!cpp binary_t*` must be dereferenced.
|
|||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.8.0. Changed 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.
|
||||||
|
@ -6,8 +6,8 @@ using boolean_t = BooleanType;
|
|||||||
|
|
||||||
The type used to store JSON booleans.
|
The type used to store JSON booleans.
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two literals
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two
|
||||||
`#!json true` and `#!json false`.
|
literals `#!json true` and `#!json false`.
|
||||||
|
|
||||||
To store objects in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
To store objects in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ Linear in the size of the JSON value.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
All iterators, pointers and references related to this container are invalidated.
|
All iterators, pointers, and references related to this container are invalidated.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ bool contains(const json_pointer& ptr) const;
|
|||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
1. `#!cpp true` if an element with specified `key` exists. If no such element with such key is found or the JSON value
|
1. `#!cpp true` if an element with specified `key` exists. If no such element with such a key is found or the JSON value
|
||||||
is not an object, `#!cpp false` is returned.
|
is not an object, `#!cpp false` is returned.
|
||||||
2. See 1.
|
2. See 1.
|
||||||
3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise.
|
3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise.
|
||||||
|
@ -8,7 +8,7 @@ string_t dump(const int indent = -1,
|
|||||||
```
|
```
|
||||||
|
|
||||||
Serialization function for JSON values. The function tries to mimic Python's
|
Serialization function for JSON values. The function tries to mimic Python's
|
||||||
[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent`
|
[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent`
|
||||||
and `ensure_ascii` parameters.
|
and `ensure_ascii` parameters.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -49,7 +49,7 @@ Linear.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
Binary values are serialized as object containing two keys:
|
Binary values are serialized as an object containing two keys:
|
||||||
|
|
||||||
- "bytes": an array of bytes as integers
|
- "bytes": an array of bytes as integers
|
||||||
- "subtype": the subtype as integer or `#!json null` if the binary has no subtype
|
- "subtype": the subtype as integer or `#!json null` if the binary has no subtype
|
||||||
|
@ -14,6 +14,11 @@ created from `args`.
|
|||||||
`Args`
|
`Args`
|
||||||
: compatible types to create a `basic_json` object
|
: compatible types to create a `basic_json` object
|
||||||
|
|
||||||
|
## Iterator invalidation
|
||||||
|
|
||||||
|
For [`ordered_json`](../ordered_json.md), adding a value to an object can yield a reallocation, in which case all
|
||||||
|
iterators (including the `end()` iterator) and all references to the elements are invalidated.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`args` (in)
|
`args` (in)
|
||||||
|
@ -13,6 +13,12 @@ Creates a JSON value from the passed parameters `args` to the end of the JSON va
|
|||||||
`Args`
|
`Args`
|
||||||
: compatible types to create a `basic_json` object
|
: compatible types to create a `basic_json` object
|
||||||
|
|
||||||
|
## Iterator invalidation
|
||||||
|
|
||||||
|
By adding an element to the end of the array, a reallocation can happen, in which case all iterators (including the
|
||||||
|
[`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the [`end()`](end.md)
|
||||||
|
iterator is invalidated.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`args` (in)
|
`args` (in)
|
||||||
@ -48,6 +54,11 @@ Amortized constant.
|
|||||||
--8<-- "examples/emplace_back.output"
|
--8<-- "examples/emplace_back.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [operator+=](operator+=.md) add a value to an array/object
|
||||||
|
- [push_back](push_back.md) add a value to an array/object
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Since version 2.0.8.
|
- Since version 2.0.8.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
bool empty() const noexcept;
|
bool empty() const noexcept;
|
||||||
```
|
```
|
||||||
|
|
||||||
Checks if a JSON value has no elements (i.e. whether its [`size()`](size.md) is `0`).
|
Checks if a JSON value has no elements (i.e., whether its [`size()`](size.md) is `0`).
|
||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
|
68
docs/mkdocs/docs/api/basic_json/end_pos.md
Normal file
68
docs/mkdocs/docs/api/basic_json/end_pos.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# <small>nlohmann::basic_json::</small>end_pos
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#if JSON_DIAGNOSTIC_POSITIONS
|
||||||
|
constexpr std::size_t end_pos() const noexcept;
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the position immediately following the last character of the JSON string from which the value was parsed from.
|
||||||
|
|
||||||
|
| JSON type | return value |
|
||||||
|
|-----------|-----------------------------------|
|
||||||
|
| object | position after the closing `}` |
|
||||||
|
| array | position after the closing `]` |
|
||||||
|
| string | position after the closing `"` |
|
||||||
|
| number | position after the last character |
|
||||||
|
| boolean | position after `e` |
|
||||||
|
| null | position after `l` |
|
||||||
|
|
||||||
|
## Return value
|
||||||
|
|
||||||
|
the position of the character _following_ the last character of the given value in the parsed JSON string, if the
|
||||||
|
value was created by the [`parse`](parse.md) function, or `std::string::npos` if the value was constructed otherwise
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
No-throw guarantee: this member function never throws exceptions.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
!!! note "Note"
|
||||||
|
|
||||||
|
The function is only available if macro [`JSON_DIAGNOSTIC_POSITIONS`](../macros/json_diagnostic_positions.md) has
|
||||||
|
been defined to `#!cpp 1` before including the library header.
|
||||||
|
|
||||||
|
!!! warning "Invalidation"
|
||||||
|
|
||||||
|
The returned positions are only valid as long as the JSON value is not changed. The positions are *not* updated
|
||||||
|
when the JSON value is changed.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example "Example"
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/diagnostic_positions.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/diagnostic_positions.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
The output shows the start/end positions of all the objects and fields in the JSON string.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [start_pos](start_pos.md) to access the start position
|
||||||
|
- [JSON_DIAGNOSTIC_POSITIONS](../macros/json_diagnostic_positions.md) for an overview of the diagnostic positions
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.12.0.
|
@ -8,24 +8,36 @@ This class is an extension of [`std::exception`](https://en.cppreference.com/w/c
|
|||||||
member `id` for exception ids. It is used as the base class for all exceptions thrown by the `basic_json` class. This
|
member `id` for exception ids. It is used as the base class for all exceptions thrown by the `basic_json` class. This
|
||||||
class can hence be used as "wildcard" to catch exceptions, see example below.
|
class can hence be used as "wildcard" to catch exceptions, see example below.
|
||||||
|
|
||||||
```plantuml
|
```mermaid
|
||||||
std::exception <|-- basic_json::exception
|
classDiagram
|
||||||
basic_json::exception <|-- basic_json::parse_error
|
direction LR
|
||||||
basic_json::exception <|-- basic_json::invalid_iterator
|
|
||||||
basic_json::exception <|-- basic_json::type_error
|
class std_exception ["std::exception"] {
|
||||||
basic_json::exception <|-- basic_json::out_of_range
|
<<interface>>
|
||||||
basic_json::exception <|-- basic_json::other_error
|
}
|
||||||
|
|
||||||
interface std::exception {}
|
class json_exception ["basic_json::exception"] {
|
||||||
|
+const int id
|
||||||
|
+const char* what() const
|
||||||
|
}
|
||||||
|
|
||||||
|
class json_parse_error ["basic_json::parse_error"] {
|
||||||
|
+const std::size_t byte
|
||||||
|
}
|
||||||
|
|
||||||
class basic_json::exception #FFFF00 {
|
class json_invalid_iterator ["basic_json::invalid_iterator"]
|
||||||
+ const int id
|
class json_type_error ["basic_json::type_error"]
|
||||||
+ const char* what() const
|
class json_out_of_range ["basic_json::out_of_range"]
|
||||||
}
|
class json_other_error ["basic_json::other_error"]
|
||||||
|
|
||||||
class basic_json::parse_error {
|
std_exception <|-- json_exception
|
||||||
+ const std::size_t byte
|
json_exception <|-- json_parse_error
|
||||||
}
|
json_exception <|-- json_invalid_iterator
|
||||||
|
json_exception <|-- json_type_error
|
||||||
|
json_exception <|-- json_out_of_range
|
||||||
|
json_exception <|-- json_other_error
|
||||||
|
|
||||||
|
style json_exception fill:#CCCCFF
|
||||||
```
|
```
|
||||||
|
|
||||||
Subclasses:
|
Subclasses:
|
||||||
@ -68,7 +80,7 @@ constructor.
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
[List of exceptions](127.0.0.1:8000/home/exceptions/)
|
[List of exceptions](../../home/exceptions.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|
||||||
Linear in the size the JSON value.
|
Linear in the size of the JSON value.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the BJData (Binary JData) seria
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from an iterator range.
|
2. Reads from an iterator range.
|
||||||
|
|
||||||
The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bjdata.md).
|
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bjdata.md).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
: an input in BJData format convertible to an input adapter
|
: an input in BJData format convertible to an input adapter
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of the input
|
: iterator to the start of the input
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of the input
|
: iterator to the end of the input
|
||||||
|
|
||||||
`strict` (in)
|
`strict` (in)
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
||||||
@ -63,7 +63,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
the end of 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 a parse error occurs
|
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs
|
||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
||||||
successfully
|
successfully
|
||||||
|
@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the BSON (Binary JSON) serializ
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from an iterator range.
|
2. Reads from an iterator range.
|
||||||
|
|
||||||
The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bson.md).
|
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bson.md).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
: an input in BSON format convertible to an input adapter
|
: an input in BSON format convertible to an input adapter
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of the input
|
: iterator to the start of the input
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of the input
|
: iterator to the end of the input
|
||||||
|
|
||||||
`strict` (in)
|
`strict` (in)
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
||||||
|
@ -21,7 +21,7 @@ Deserializes a given input to a JSON value using the CBOR (Concise Binary Object
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from an iterator range.
|
2. Reads from an iterator range.
|
||||||
|
|
||||||
The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/cbor.md).
|
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/cbor.md).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@ -43,10 +43,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
: an input in CBOR format convertible to an input adapter
|
: an input in CBOR format convertible to an input adapter
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of the input
|
: iterator to the start of the input
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of the input
|
: iterator to the end of the input
|
||||||
|
|
||||||
`strict` (in)
|
`strict` (in)
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
||||||
@ -70,10 +70,10 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
the end of 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 string was expected as map key,
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key,
|
||||||
but not found
|
but not found
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the MessagePack serialization f
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from an iterator range.
|
2. Reads from an iterator range.
|
||||||
|
|
||||||
The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/messagepack.md).
|
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/messagepack.md).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
: an input in MessagePack format convertible to an input adapter
|
: an input in MessagePack format convertible to an input adapter
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of the input
|
: iterator to the start of the input
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of the input
|
: iterator to the end of the input
|
||||||
|
|
||||||
`strict` (in)
|
`strict` (in)
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
||||||
@ -54,7 +54,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be
|
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).
|
`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md).
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
@ -63,10 +63,10 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
the end of 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 string was expected as map key,
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key,
|
||||||
but not found
|
but not found
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the UBJSON (Universal Binary JS
|
|||||||
1. Reads from a compatible input.
|
1. Reads from a compatible input.
|
||||||
2. Reads from an iterator range.
|
2. Reads from an iterator range.
|
||||||
|
|
||||||
The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/ubjson.md).
|
The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/ubjson.md).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
|
|||||||
: an input in UBJSON format convertible to an input adapter
|
: an input in UBJSON format convertible to an input adapter
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: iterator to start of the input
|
: iterator to the start of the input
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: iterator to end of the input
|
: iterator to the end of the input
|
||||||
|
|
||||||
`strict` (in)
|
`strict` (in)
|
||||||
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
: whether to expect the input to be consumed until EOF (`#!cpp true` by default)
|
||||||
@ -63,7 +63,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or
|
||||||
the end of 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 a parse error occurs
|
- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs
|
||||||
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed
|
||||||
successfully
|
successfully
|
||||||
|
@ -10,8 +10,8 @@ Returns a reference to the first element in the container. For a JSON container
|
|||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
In case of a structured type (array or object), a reference to the first element is returned. In case of number, string,
|
In the case of a structured type (array or object), a reference to the first element is returned. In the case of number,
|
||||||
boolean, or binary values, a reference to the value is returned.
|
string, boolean, or binary values, a reference to the value is returned.
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
|
@ -35,7 +35,37 @@ Constant.
|
|||||||
|
|
||||||
!!! danger "Undefined behavior"
|
!!! danger "Undefined behavior"
|
||||||
|
|
||||||
Writing data to the pointee of the result yields an undefined state.
|
The pointer becomes invalid if the underlying JSON object changes.
|
||||||
|
|
||||||
|
Consider the following example code where the pointer `ptr` changes after the array is resized. As a result,
|
||||||
|
reading or writing to `ptr` after the array change would be undefined behavior. The address of the first array
|
||||||
|
element changes, because the underlying `std::vector` is resized after adding a fifth element.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
json j = {1, 2, 3, 4};
|
||||||
|
auto* ptr = j[0].get_ptr<std::int64_t*>();
|
||||||
|
std::cout << "value at " << ptr << " is " << *ptr << std::endl;
|
||||||
|
|
||||||
|
j.push_back(5);
|
||||||
|
|
||||||
|
ptr = j[0].get_ptr<std::int64_t*>();
|
||||||
|
std::cout << "value at " << ptr << " is " << *ptr << std::endl;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
value at 0x6000012fc1c8 is 1
|
||||||
|
value at 0x6000029fc088 is 1
|
||||||
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@ -54,6 +84,10 @@ Constant.
|
|||||||
--8<-- "examples/get_ptr.output"
|
--8<-- "examples/get_ptr.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [get_ref()](get_ref.md) get a reference value
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
@ -40,7 +40,7 @@ Constant.
|
|||||||
|
|
||||||
!!! danger "Undefined behavior"
|
!!! danger "Undefined behavior"
|
||||||
|
|
||||||
Writing data to the referee of the result yields an undefined state.
|
The reference becomes invalid if the underlying JSON object changes.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@ -58,6 +58,10 @@ Constant.
|
|||||||
--8<-- "examples/get_ref.output"
|
--8<-- "examples/get_ref.output"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [get_ptr()](get_ptr.md) get a pointer value
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.1.0.
|
- Added in version 1.1.0.
|
||||||
|
@ -13,7 +13,8 @@ template<
|
|||||||
class NumberFloatType = double,
|
class NumberFloatType = double,
|
||||||
template<typename U> class AllocatorType = std::allocator,
|
template<typename U> class AllocatorType = std::allocator,
|
||||||
template<typename T, typename SFINAE = void> class JSONSerializer = adl_serializer,
|
template<typename T, typename SFINAE = void> class JSONSerializer = adl_serializer,
|
||||||
class BinaryType = std::vector<std::uint8_t>
|
class BinaryType = std::vector<std::uint8_t>,
|
||||||
|
class CustomBaseClass = void
|
||||||
>
|
>
|
||||||
class basic_json;
|
class basic_json;
|
||||||
```
|
```
|
||||||
@ -32,15 +33,24 @@ class basic_json;
|
|||||||
| `AllocatorType` | type of the allocator to use | |
|
| `AllocatorType` | type of the allocator to use | |
|
||||||
| `JSONSerializer` | the serializer to resolve internal calls to `to_json()` and `from_json()` | [`json_serializer`](json_serializer.md) |
|
| `JSONSerializer` | the serializer to resolve internal calls to `to_json()` and `from_json()` | [`json_serializer`](json_serializer.md) |
|
||||||
| `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) |
|
||||||
|
|
||||||
## Specializations
|
## Specializations
|
||||||
|
|
||||||
- [**json**](../json.md) - default specialization
|
- [**json**](../json.md) - default specialization
|
||||||
- [**ordered_json**](../ordered_json.md) - specialization that maintains the insertion order of object keys
|
- [**ordered_json**](../ordered_json.md) - a specialization that maintains the insertion order of object keys
|
||||||
|
|
||||||
## Iterator invalidation
|
## Iterator invalidation
|
||||||
|
|
||||||
Todo
|
All operations that add values to an **array** ([`push_back`](push_back.md) , [`operator+=`](operator+=.md),
|
||||||
|
[`emplace_back`](emplace_back.md), [`insert`](insert.md), and [`operator[]`](operator%5B%5D.md) for a non-existing
|
||||||
|
index) can yield a reallocation, in which case all iterators (including the [`end()`](end.md) iterator) and all
|
||||||
|
references to the elements are invalidated.
|
||||||
|
|
||||||
|
For [`ordered_json`](../ordered_json.md), also all operations that add a value to an **object**
|
||||||
|
([`push_back`](push_back.md), [`operator+=`](operator+=.md), [`emplace`](emplace.md), [`insert`](insert.md),
|
||||||
|
[`update`](update.md), and [`operator[]`](operator%5B%5D.md) for a non-existing key) can yield a reallocation, in
|
||||||
|
which case all iterators (including the [`end()`](end.md) iterator) and all references to the elements are invalidated.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -48,8 +58,8 @@ The class satisfies the following concept requirements:
|
|||||||
|
|
||||||
### Basic
|
### Basic
|
||||||
|
|
||||||
- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be default
|
- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be
|
||||||
constructed. The result will be a JSON null value.
|
default-constructed. The result will be a JSON null value.
|
||||||
- [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): A JSON value can be constructed
|
- [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): A JSON value can be constructed
|
||||||
from an rvalue argument.
|
from an rvalue argument.
|
||||||
- [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): A JSON value can be
|
- [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): A JSON value can be
|
||||||
@ -71,7 +81,7 @@ The class satisfies the following concept requirements:
|
|||||||
- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with
|
- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with
|
||||||
`==`, see [`operator==`](operator_eq.md).
|
`==`, see [`operator==`](operator_eq.md).
|
||||||
- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with
|
- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with
|
||||||
`<`, see [`operator<`](operator_le).
|
`<`, see [`operator<`](operator_le.md).
|
||||||
- [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with
|
- [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with
|
||||||
any lvalue or rvalue of other compatible types, using unqualified function `swap`.
|
any lvalue or rvalue of other compatible types, using unqualified function `swap`.
|
||||||
- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against
|
- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against
|
||||||
@ -86,7 +96,7 @@ The class satisfies the following concept requirements:
|
|||||||
|
|
||||||
## Member types
|
## Member types
|
||||||
|
|
||||||
- [**adl_serializer**](../adl_serializer) - the default serializer
|
- [**adl_serializer**](../adl_serializer/index.md) - the default serializer
|
||||||
- [**value_t**](value_t.md) - the JSON type enumeration
|
- [**value_t**](value_t.md) - the JSON type enumeration
|
||||||
- [**json_pointer**](../json_pointer/index.md) - JSON Pointer implementation
|
- [**json_pointer**](../json_pointer/index.md) - JSON Pointer implementation
|
||||||
- [**json_serializer**](json_serializer.md) - type of the serializer to for conversions from/to JSON
|
- [**json_serializer**](json_serializer.md) - type of the serializer to for conversions from/to JSON
|
||||||
@ -146,9 +156,9 @@ The class satisfies the following concept requirements:
|
|||||||
- [(constructor)](basic_json.md)
|
- [(constructor)](basic_json.md)
|
||||||
- [(destructor)](~basic_json.md)
|
- [(destructor)](~basic_json.md)
|
||||||
- [**operator=**](operator=.md) - copy assignment
|
- [**operator=**](operator=.md) - copy assignment
|
||||||
- [**array**](array_t.md) (_static_) - explicitly create an array
|
- [**array**](array.md) (_static_) - explicitly create an array
|
||||||
- [**binary**](binary.md) (_static_) - explicitly create a binary array
|
- [**binary**](binary.md) (_static_) - explicitly create a binary array
|
||||||
- [**object**](object_t.md) (_static_) - explicitly create an object
|
- [**object**](object.md) (_static_) - explicitly create an object
|
||||||
|
|
||||||
### Object inspection
|
### Object inspection
|
||||||
|
|
||||||
@ -157,19 +167,24 @@ Functions to inspect the type of a JSON value.
|
|||||||
- [**type**](type.md) - return the type of the JSON value
|
- [**type**](type.md) - return the type of the JSON value
|
||||||
- [**operator value_t**](operator_value_t.md) - return the type of the JSON value
|
- [**operator value_t**](operator_value_t.md) - return the type of the JSON value
|
||||||
- [**type_name**](type_name.md) - return the type as string
|
- [**type_name**](type_name.md) - return the type as string
|
||||||
- [**is_primitive**](is_primitive.md) - return whether type is primitive
|
- [**is_primitive**](is_primitive.md) - return whether the type is primitive
|
||||||
- [**is_structured**](is_structured.md) - return whether type is structured
|
- [**is_structured**](is_structured.md) - return whether the type is structured
|
||||||
- [**is_null**](is_null.md) - return whether value is null
|
- [**is_null**](is_null.md) - return whether the value is null
|
||||||
- [**is_boolean**](is_boolean.md) - return whether value is a boolean
|
- [**is_boolean**](is_boolean.md) - return whether the value is a boolean
|
||||||
- [**is_number**](is_number.md) - return whether value is a number
|
- [**is_number**](is_number.md) - return whether the value is a number
|
||||||
- [**is_number_integer**](is_number_integer.md) - return whether value is an integer number
|
- [**is_number_integer**](is_number_integer.md) - return whether the value is an integer number
|
||||||
- [**is_number_unsigned**](is_number_unsigned.md) - return whether value is an unsigned integer number
|
- [**is_number_unsigned**](is_number_unsigned.md) - return whether the value is an unsigned integer number
|
||||||
- [**is_number_float**](is_number_float.md) - return whether value is a floating-point number
|
- [**is_number_float**](is_number_float.md) - return whether the value is a floating-point number
|
||||||
- [**is_object**](is_object.md) - return whether value is an object
|
- [**is_object**](is_object.md) - return whether the value is an object
|
||||||
- [**is_array**](is_array.md) - return whether value is an array
|
- [**is_array**](is_array.md) - return whether the value is an array
|
||||||
- [**is_string**](is_string.md) - return whether value is a string
|
- [**is_string**](is_string.md) - return whether the value is a string
|
||||||
- [**is_binary**](is_binary.md) - return whether value is a binary array
|
- [**is_binary**](is_binary.md) - return whether the value is a binary array
|
||||||
- [**is_discarded**](is_discarded.md) - return whether value is discarded
|
- [**is_discarded**](is_discarded.md) - return whether the value is discarded
|
||||||
|
|
||||||
|
Optional functions to access the [diagnostic positions](../macros/json_diagnostic_positions.md).
|
||||||
|
|
||||||
|
- [**start_pos**](start_pos.md) - return the start position of the value
|
||||||
|
- [**end_pos**](end_pos.md) - return the one past the end position of the value
|
||||||
|
|
||||||
### Value access
|
### Value access
|
||||||
|
|
||||||
@ -222,7 +237,7 @@ Access to the JSON value
|
|||||||
- [**push_back**](push_back.md) - add a value to an array/object
|
- [**push_back**](push_back.md) - add a value to an array/object
|
||||||
- [**operator+=**](operator+=.md) - add a value to an array/object
|
- [**operator+=**](operator+=.md) - add a value to an array/object
|
||||||
- [**emplace_back**](emplace_back.md) - add a value to an array
|
- [**emplace_back**](emplace_back.md) - add a value to an array
|
||||||
- [**emplace**](emplace.md) - add a value to an object if key does not exist
|
- [**emplace**](emplace.md) - add a value to an object if a key does not exist
|
||||||
- [**erase**](erase.md) - remove elements
|
- [**erase**](erase.md) - remove elements
|
||||||
- [**insert**](insert.md) - inserts elements
|
- [**insert**](insert.md) - inserts elements
|
||||||
- [**update**](update.md) - updates a JSON object from another object, overwriting existing keys
|
- [**update**](update.md) - updates a JSON object from another object, overwriting existing keys
|
||||||
|
@ -18,11 +18,22 @@ iterator insert(const_iterator pos, initializer_list_t ilist);
|
|||||||
void insert(const_iterator first, const_iterator last);
|
void insert(const_iterator first, const_iterator last);
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Inserts element `val` into array before iterator `pos`.
|
1. Inserts element `val` into an array before iterator `pos`.
|
||||||
2. Inserts `cnt` copies of `val` into array before iterator `pos`.
|
2. Inserts `cnt` copies of `val` into an array before iterator `pos`.
|
||||||
3. Inserts elements from range `[first, last)` into array before iterator `pos`.
|
3. Inserts elements from range `[first, last)` into an array before iterator `pos`.
|
||||||
4. Inserts elements from initializer list `ilist` into array before iterator `pos`.
|
4. Inserts elements from initializer list `ilist` into an array before iterator `pos`.
|
||||||
5. Inserts elements from range `[first, last)` into object.
|
5. Inserts elements from range `[first, last)` into an object.
|
||||||
|
|
||||||
|
## Iterator invalidation
|
||||||
|
|
||||||
|
For all cases where an element is added to an **array**, a reallocation can happen, in which case all iterators
|
||||||
|
(including the [`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the
|
||||||
|
[`end()`](end.md) iterator is invalidated. Also, any iterator or reference after the insertion point will point to the
|
||||||
|
same index, which is now a different value.
|
||||||
|
|
||||||
|
For [`ordered_json`](../ordered_json.md), also adding an element to an **object** can yield a reallocation which again
|
||||||
|
invalidates all iterators and all references. Also, any iterator or reference after the insertion point will point to
|
||||||
|
the same index, which is now a different value.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@ -36,10 +47,10 @@ void insert(const_iterator first, const_iterator last);
|
|||||||
: number of copies of `val` to insert
|
: number of copies of `val` to insert
|
||||||
|
|
||||||
`first` (in)
|
`first` (in)
|
||||||
: begin of the range of elements to insert
|
: the start of the range of elements to insert
|
||||||
|
|
||||||
`last` (in)
|
`last` (in)
|
||||||
: end of the range of elements to insert
|
: the end of the range of elements to insert
|
||||||
|
|
||||||
`ilist` (in)
|
`ilist` (in)
|
||||||
: initializer list to insert the values from
|
: initializer list to insert the values from
|
||||||
@ -128,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 range of elements into 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.
|
||||||
|
|
||||||
@ -142,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 initializer list into 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.
|
||||||
|
|
||||||
@ -156,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 range of elements into 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.
|
||||||
|
|
||||||
|
@ -8,26 +8,36 @@ This exception is thrown if iterators passed to a library function do not match
|
|||||||
|
|
||||||
Exceptions have ids 2xx (see [list of iterator errors](../../home/exceptions.md#iterator-errors)).
|
Exceptions have ids 2xx (see [list of iterator errors](../../home/exceptions.md#iterator-errors)).
|
||||||
|
|
||||||
```plantuml
|
```mermaid
|
||||||
std::exception <|-- basic_json::exception
|
classDiagram
|
||||||
basic_json::exception <|-- basic_json::parse_error
|
direction LR
|
||||||
basic_json::exception <|-- basic_json::invalid_iterator
|
|
||||||
basic_json::exception <|-- basic_json::type_error
|
class std_exception ["std::exception"] {
|
||||||
basic_json::exception <|-- basic_json::out_of_range
|
<<interface>>
|
||||||
basic_json::exception <|-- basic_json::other_error
|
}
|
||||||
|
|
||||||
interface std::exception {}
|
class json_exception ["basic_json::exception"] {
|
||||||
|
+const int id
|
||||||
|
+const char* what() const
|
||||||
|
}
|
||||||
|
|
||||||
|
class json_parse_error ["basic_json::parse_error"] {
|
||||||
|
+const std::size_t byte
|
||||||
|
}
|
||||||
|
|
||||||
class basic_json::exception {
|
class json_invalid_iterator ["basic_json::invalid_iterator"]
|
||||||
+ const int id
|
class json_type_error ["basic_json::type_error"]
|
||||||
+ const char* what() const
|
class json_out_of_range ["basic_json::out_of_range"]
|
||||||
}
|
class json_other_error ["basic_json::other_error"]
|
||||||
|
|
||||||
class basic_json::parse_error {
|
std_exception <|-- json_exception
|
||||||
+ const std::size_t byte
|
json_exception <|-- json_parse_error
|
||||||
}
|
json_exception <|-- json_invalid_iterator
|
||||||
|
json_exception <|-- json_type_error
|
||||||
|
json_exception <|-- json_out_of_range
|
||||||
|
json_exception <|-- json_other_error
|
||||||
|
|
||||||
class basic_json::invalid_iterator #FFFF00 {}
|
style json_invalid_iterator fill:#CCCCFF
|
||||||
```
|
```
|
||||||
|
|
||||||
## Member functions
|
## Member functions
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
constexpr bool is_binary() const noexcept;
|
constexpr bool is_binary() const noexcept;
|
||||||
```
|
```
|
||||||
|
|
||||||
This function returns `#!cpp true` if and only if the JSON value is binary array.
|
This function returns `#!cpp true` if and only if the JSON value is a binary array.
|
||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ unsigned) and floating-point values.
|
|||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
`#!cpp true` if type is number (regardless whether integer, unsigned integer or floating-type), `#!cpp false` otherwise.
|
`#!cpp true` if type is number (regardless whether integer, unsigned integer, or floating-type), `#!cpp false` otherwise.
|
||||||
|
|
||||||
## Exception safety
|
## Exception safety
|
||||||
|
|
||||||
@ -46,9 +46,9 @@ constexpr bool is_number() const noexcept
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number
|
- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number
|
||||||
- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number
|
- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number
|
||||||
- [is_number_float()](is_number_float.md) check if value is a floating-point number
|
- [is_number_float()](is_number_float.md) check if the value is a floating-point number
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ Constant.
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_number()](is_number.md) check if value is a number
|
- [is_number()](is_number.md) check if the value is a number
|
||||||
- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number
|
- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number
|
||||||
- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number
|
- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ Constant.
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_number()](is_number.md) check if value is a number
|
- [is_number()](is_number.md) check if the value is a number
|
||||||
- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number
|
- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number
|
||||||
- [is_number_float()](is_number_float.md) check if value is a floating-point number
|
- [is_number_float()](is_number_float.md) check if the value is a floating-point number
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ Constant.
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_number()](is_number.md) check if value is a number
|
- [is_number()](is_number.md) check if the value is a number
|
||||||
- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number
|
- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number
|
||||||
- [is_number_float()](is_number_float.md) check if value is a floating-point number
|
- [is_number_float()](is_number_float.md) check if the value is a floating-point number
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ The term *primitive* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259):
|
|||||||
> JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and
|
> JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and
|
||||||
> arrays).
|
> arrays).
|
||||||
|
|
||||||
This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence,
|
This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence,
|
||||||
`is_primitive()` returns `#!cpp true` for binary values.
|
`is_primitive()` returns `#!cpp true` for binary values.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@ -56,12 +56,12 @@ This library extends primitive types to binary types, because binary types are
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_structured()](is_structured.md) returns whether JSON value is structured
|
- [is_structured()](is_structured.md) returns whether the JSON value is structured
|
||||||
- [is_null()](is_null.md) returns whether JSON value is `null`
|
- [is_null()](is_null.md) returns whether the JSON value is `null`
|
||||||
- [is_string()](is_string.md) returns whether JSON value is a string
|
- [is_string()](is_string.md) returns whether the JSON value is a string
|
||||||
- [is_boolean()](is_boolean.md) returns whether JSON value is a boolean
|
- [is_boolean()](is_boolean.md) returns whether the JSON value is a boolean
|
||||||
- [is_number()](is_number.md) returns whether JSON value is a number
|
- [is_number()](is_number.md) returns whether the JSON value is a number
|
||||||
- [is_binary()](is_binary.md) returns whether JSON value is a binary array
|
- [is_binary()](is_binary.md) returns whether the JSON value is a binary array
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Constant.
|
|||||||
## Possible implementation
|
## Possible implementation
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
constexpr bool is_primitive() const noexcept
|
constexpr bool is_structured() const noexcept
|
||||||
{
|
{
|
||||||
return is_array() || is_object();
|
return is_array() || is_object();
|
||||||
}
|
}
|
||||||
@ -55,8 +55,8 @@ Note that though strings are containers in C++, they are treated as primitive va
|
|||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [is_primitive()](is_primitive.md) returns whether JSON value is primitive
|
- [is_primitive()](is_primitive.md) returns whether JSON value is primitive
|
||||||
- [is_array()](is_array.md) returns whether value is an array
|
- [is_array()](is_array.md) returns whether the value is an array
|
||||||
- [is_object()](is_object.md) returns whether value is an object
|
- [is_object()](is_object.md) returns whether the value is an object
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ When iterating over an array, `key()` will return the index of the element as st
|
|||||||
!!! danger "Lifetime issues"
|
!!! danger "Lifetime issues"
|
||||||
|
|
||||||
Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See
|
Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See
|
||||||
<https://github.com/nlohmann/json/issues/2040> for more information.
|
[#2040](https://github.com/nlohmann/json/issues/2040) for more information.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
45
docs/mkdocs/docs/api/basic_json/json_base_class_t.md
Normal file
45
docs/mkdocs/docs/api/basic_json/json_base_class_t.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# <small>nlohmann::basic_json::</small>json_base_class_t
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using json_base_class_t = detail::json_base_class<CustomBaseClass>;
|
||||||
|
```
|
||||||
|
|
||||||
|
The base class used to inject custom functionality into each instance of `basic_json`.
|
||||||
|
Examples of such functionality might be metadata, additional member functions (e.g., visitors), or other application-specific code.
|
||||||
|
|
||||||
|
## Template parameters
|
||||||
|
|
||||||
|
`CustomBaseClass`
|
||||||
|
: the base class to be added to `basic_json`
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
#### Default type
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
#### Limitations
|
||||||
|
|
||||||
|
The type `CustomBaseClass` has to be a default-constructible class.
|
||||||
|
`basic_json` only supports copy/move construction/assignment if `CustomBaseClass` does so as well.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The following code shows how to inject custom data and methods for each node.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_base_class_t.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/json_base_class_t.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.12.0.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user