Skip to content

Commit 3b2e5ed

Browse files
committed
Merge commit '3d640eac526ae6eb3145a09ba1632df4c1e7aaa1' as 'lib/json'
2 parents 033f3c9 + f7dde39 commit 3b2e5ed

File tree

952 files changed

+146889
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

952 files changed

+146889
-0
lines changed

lib/json/.clang-format

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#AccessModifierOffset: 2
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: false
4+
#AlignConsecutiveBitFields: false
5+
AlignConsecutiveDeclarations: false
6+
AlignConsecutiveMacros: false
7+
AlignEscapedNewlines: Right
8+
#AlignOperands: AlignAfterOperator
9+
AlignTrailingComments: true
10+
AllowAllArgumentsOnNextLine: false
11+
AllowAllConstructorInitializersOnNextLine: false
12+
AllowAllParametersOfDeclarationOnNextLine: false
13+
AllowShortBlocksOnASingleLine: Empty
14+
AllowShortCaseLabelsOnASingleLine: false
15+
#AllowShortEnumsOnASingleLine: true
16+
AllowShortFunctionsOnASingleLine: Empty
17+
AllowShortIfStatementsOnASingleLine: Never
18+
AllowShortLambdasOnASingleLine: Empty
19+
AllowShortLoopsOnASingleLine: false
20+
AlwaysBreakAfterReturnType: None
21+
AlwaysBreakBeforeMultilineStrings: false
22+
AlwaysBreakTemplateDeclarations: Yes
23+
BinPackArguments: false
24+
BinPackParameters: false
25+
#BitFieldColonSpacing: Both
26+
BreakBeforeBraces: Custom # or Allman
27+
BraceWrapping:
28+
AfterCaseLabel: true
29+
AfterClass: true
30+
AfterControlStatement: Always
31+
AfterEnum: true
32+
AfterFunction: true
33+
AfterNamespace: false
34+
AfterStruct: true
35+
AfterUnion: true
36+
AfterExternBlock: false
37+
BeforeCatch: true
38+
BeforeElse: true
39+
#BeforeLambdaBody: false
40+
#BeforeWhile: false
41+
SplitEmptyFunction: false
42+
SplitEmptyRecord: false
43+
SplitEmptyNamespace: false
44+
BreakBeforeTernaryOperators: true
45+
BreakConstructorInitializers: BeforeComma
46+
BreakStringLiterals: false
47+
ColumnLimit: 0
48+
CompactNamespaces: false
49+
ConstructorInitializerIndentWidth: 2
50+
Cpp11BracedListStyle: true
51+
PointerAlignment: Left
52+
FixNamespaceComments: true
53+
IncludeBlocks: Preserve
54+
#IndentCaseBlocks: false
55+
IndentCaseLabels: true
56+
IndentGotoLabels: false
57+
IndentPPDirectives: BeforeHash
58+
IndentWidth: 4
59+
KeepEmptyLinesAtTheStartOfBlocks: false
60+
MaxEmptyLinesToKeep: 1
61+
NamespaceIndentation: None
62+
ReflowComments: false
63+
SortIncludes: true
64+
SortUsingDeclarations: true
65+
SpaceAfterCStyleCast: false
66+
SpaceAfterLogicalNot: false
67+
SpaceAfterTemplateKeyword: false
68+
SpaceBeforeAssignmentOperators: true
69+
SpaceBeforeCpp11BracedList: false
70+
SpaceBeforeParens: ControlStatements
71+
SpaceBeforeRangeBasedForLoopColon: true
72+
SpaceBeforeSquareBrackets: false
73+
SpaceInEmptyBlock: false
74+
SpaceInEmptyParentheses: false
75+
SpacesBeforeTrailingComments: 2
76+
SpacesInAngles: false
77+
SpacesInCStyleCastParentheses: false
78+
SpacesInConditionalStatement: false
79+
SpacesInContainerLiterals: false
80+
SpacesInParentheses: false
81+
SpacesInSquareBrackets: false
82+
Standard: c++11
83+
TabWidth: 4
84+
UseTab: Never

lib/json/.clang-tidy

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Checks: '*,
2+
-altera-struct-pack-align,
3+
-android-cloexec-fopen,
4+
-concurrency-mt-unsafe,
5+
-cppcoreguidelines-avoid-goto,
6+
-cppcoreguidelines-avoid-magic-numbers,
7+
-cppcoreguidelines-avoid-non-const-global-variables,
8+
-cppcoreguidelines-macro-usage,
9+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
10+
-cppcoreguidelines-pro-bounds-constant-array-index,
11+
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
12+
-cppcoreguidelines-pro-type-reinterpret-cast,
13+
-cppcoreguidelines-pro-type-union-access,
14+
-fuchsia-default-arguments-calls,
15+
-fuchsia-default-arguments-declarations,
16+
-fuchsia-overloaded-operator,
17+
-google-explicit-constructor,
18+
-google-readability-function-size,
19+
-google-runtime-int,
20+
-google-runtime-references,
21+
-hicpp-avoid-goto,
22+
-hicpp-explicit-conversions,
23+
-hicpp-function-size,
24+
-hicpp-no-array-decay,
25+
-hicpp-no-assembler,
26+
-hicpp-signed-bitwise,
27+
-hicpp-uppercase-literal-suffix,
28+
-llvm-header-guard,
29+
-llvm-include-order,
30+
-llvmlibc-*,
31+
-misc-no-recursion,
32+
-misc-non-private-member-variables-in-classes,
33+
-modernize-use-trailing-return-type,
34+
-readability-function-size,
35+
-readability-function-cognitive-complexity,
36+
-readability-magic-numbers,
37+
-readability-redundant-access-specifiers,
38+
-readability-uppercase-literal-suffix'
39+
40+
CheckOptions:
41+
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
42+
value: 1
43+
44+
WarningsAsErrors: '*'
45+
46+
#HeaderFilterRegex: '.*nlohmann.*'
47+
HeaderFilterRegex: '.*hpp$'

lib/json/.drone.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
kind: pipeline
2+
name: test-on-arm64
3+
4+
platform:
5+
arch: arm64
6+
7+
steps:
8+
- name: build
9+
image: gcc
10+
commands:
11+
- wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
12+
- tar xfz cmake-3.20.2.tar.gz
13+
- cd cmake-3.20.2
14+
- ./configure
15+
- make cmake ctest -j10
16+
- cd ..
17+
- mkdir build
18+
- cd build
19+
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
20+
- make -j10
21+
- cd test
22+
- ../../cmake-3.20.2/bin/ctest -j10

lib/json/.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# JSON for Modern C++ has been originally written by Niels Lohmann.
2+
# Since 2013 over 140 contributors have helped to improve the library.
3+
# This CODEOWNERS file is only to make sure that @nlohmann is requested
4+
# for a code review in case of a pull request.
5+
6+
* @nlohmann

lib/json/.github/CONTRIBUTING.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[![Issue Stats](http://issuestats.com/github/nlohmann/json/badge/pr?style=flat)](http://issuestats.com/github/nlohmann/json) [![Issue Stats](http://issuestats.com/github/nlohmann/json/badge/issue?style=flat)](http://issuestats.com/github/nlohmann/json)
2+
3+
# How to contribute
4+
5+
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.
6+
7+
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!
8+
9+
## Private reports
10+
11+
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>.
12+
13+
## Prerequisites
14+
15+
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.
16+
17+
## Describe your issue
18+
19+
Clearly describe the issue:
20+
21+
- 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.
22+
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
23+
- 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.
24+
25+
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.
26+
27+
## Files to change
28+
29+
: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`.
30+
31+
To make changes, you need to edit the following files:
32+
33+
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`.
34+
35+
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.
36+
37+
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
38+
39+
```sh
40+
$ mkdir build
41+
$ cd build
42+
$ cmake ..
43+
$ cmake --build .
44+
$ ctest
45+
```
46+
47+
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
48+
49+
50+
## Note
51+
52+
- 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.
53+
- 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.
54+
55+
## Please don't
56+
57+
- 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.
58+
- 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.
59+
- 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.
60+
- 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.
61+
- 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).
62+
63+
- Please do not open pull requests that address **multiple issues**.
64+
65+
## Wanted
66+
67+
The following areas really need contribution:
68+
69+
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions Clang.
70+
- 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.
71+
- 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.

lib/json/.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: nlohmann
2+
custom: http://paypal.me/nlohmann
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'kind: bug'
6+
assignees: ''
7+
8+
---
9+
10+
<!-- Provide a concise summary of the issue in the title above. -->
11+
12+
#### What is the issue you have?
13+
14+
<!-- Provide a detailed introduction to the issue itself, and why you consider it to be a bug. -->
15+
<!-- If possible, be specific and add stack traces, error messages, etc. Avoid vague terms like "crash" or "doesn't work". -->
16+
17+
#### Please describe the steps to reproduce the issue.
18+
19+
<!-- Provide a link to a live example, or an unambiguous set of steps to -->
20+
<!-- reproduce this bug. Include code to reproduce, if relevant -->
21+
22+
1.
23+
2.
24+
3.
25+
26+
#### Can you provide a small but working code example?
27+
28+
<!-- Please understand that we cannot analyze and debug large code bases. -->
29+
30+
#### What is the expected behavior?
31+
32+
<!-- Tell us what should happen -->
33+
34+
#### And what is the actual behavior instead?
35+
36+
<!-- Tell us what happens instead. -->
37+
38+
#### Which compiler and operating system are you using?
39+
40+
<!-- Include as many relevant details about the environment you experienced the bug in. -->
41+
<!-- Make sure you use a supported compiler, see https://github.com/nlohmann/json#supported-compilers. -->
42+
43+
- Compiler: ___
44+
- Operating system: ___
45+
46+
#### Which version of the library did you use?
47+
48+
<!-- Please add an `x` to the respective line. -->
49+
50+
- [ ] latest release version 3.10.4
51+
- [ ] other release - please state the version: ___
52+
- [ ] the `develop` branch
53+
54+
#### If you experience a compilation error: can you [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests)?
55+
56+
- [ ] yes
57+
- [ ] no - please copy/paste the error message below
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/nlohmann/json/discussions
5+
about: Ask questions and discuss with other community members
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
2+
3+
* * *
4+
5+
## Pull request checklist
6+
7+
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
8+
9+
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
10+
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
11+
- [ ] [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).
12+
- [ ] 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).
13+
14+
## Please don't
15+
16+
- 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.
17+
- 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.
18+
- 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.
19+
- Please do not open pull requests that address **multiple issues**.

lib/json/.github/SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
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.

lib/json/.github/config.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot
2+
3+
# *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic
4+
# Anything higher than this threshold will be marked as toxic and commented on
5+
sentimentBotToxicityThreshold: .7
6+
7+
# *Required* Comment to reply with
8+
sentimentBotReplyComment: >
9+
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
10+
11+
12+
# Configuration for request-info - https://github.com/behaviorbot/request-info
13+
14+
# *Required* Comment to reply with
15+
requestInfoReplyComment: >
16+
We would appreciate it if you could provide us with more info about this issue or pull request! Please check the [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) and the [pull request template](https://github.com/nlohmann/json/blob/develop/.github/PULL_REQUEST_TEMPLATE.md).
17+
18+
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
19+
requestInfoLabelToAdd: "state: needs more info"

lib/json/.github/stale.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 30
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: "state: stale"
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: false

0 commit comments

Comments
 (0)