1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00
Commit Graph

85 Commits

Author SHA1 Message Date
2e928c39ae 🔀 merge develop 2024-11-17 07:45:45 +01:00
5e9bf559b1 # Conflicts:
#	.github/workflows/macos.yml
#	include/nlohmann/detail/input/parser.hpp
#	include/nlohmann/detail/meta/std_fs.hpp
#	include/nlohmann/json.hpp
#	single_include/nlohmann/json.hpp
2024-11-16 23:23:05 +01:00
ad552c41be 🚨 fix warning 2024-11-08 23:41:46 +01:00
c4ec5e0bc5 Merge branch 'develop' into clang-tidy 2024-11-08 22:49:30 +01:00
88318f9a77 🔀 merge develop 2024-11-08 22:40:55 +01:00
aff5a31d35 Add NLOHMANN_DEFINE_DERIVED_TYPE_* macros (#4033)
* Add NLOHMANN_DEFINE_DERIVED_TYPE_* macros

* Fix with amalgamate

* Add documentation

* Fix with amalgamate

* Fix with amalgamate

---------

Co-authored-by: Niccolò Iardella <niccolo.iardella@doriansrl.it>
2024-11-08 21:41:19 +01:00
fd968125e8 🚨 fix warning 2024-04-15 22:50:47 +02:00
751b93652f 🚨 fix warning 2024-04-15 21:44:33 +02:00
bb2468a52c 🚨 fix warning 2024-04-15 21:16:40 +02:00
e8cfe1f712 🚨 fix warning 2024-04-14 12:38:17 +02:00
97f0bdaf9a chore: fix some typos in comments (#4345)
chore: fix some typos in comments

Signed-off-by: laterlaugh <manziwenzhai@sina.cn>
2024-04-12 15:20:18 +02:00
8ef27594d1 🚨 fix warning 2024-03-26 17:25:26 +01:00
7b89d3ab29 🚨 fix warning 2024-03-15 17:32:27 +01:00
b131d285ed 🚨 fix warning 2024-03-15 17:27:37 +01:00
c35d260c2f Suppress Clang-Tidy warnings (#4276) 2024-01-28 14:04:07 +01:00
a259ecc51e Fix to_json for enums when the enum has an unsigned underlying type. (#4237)
* Enhance the UDT unit test to expose the issue

Add a new enum type with uint64_t as the underlying type.
Use it in the overall UDT. Not strictly needed, but it helps exercise its expected usage.
Create an object of this enum type with a large value (negative if cast to int64_t).
Perform several checks on this object as converted to `json`, which fail without the fix.

* Fix the issue in the relevant `to_json` overload.

Select the correct json type depending on the signedness of the enum's underlying type.
This fixes the new checks in the unit test.

* Add the fix to the single_include

I ran `make pretty` but that modified 20 files, performing a significant amount of indentation changes, none of them related to my change.
I ran `make amalgamate`, but that did nothing. Apparently, the make rule won't run if the single_include files have already been updated by `make pretty`.
I forced `make amalgamate` to do the work by touching the file with the fix.
I then decided to keep just the minimal needed change: the addition of the fix to the single_include file.

I just am not conversant enough in Linux to know whether I installed astyle correctly (had to clone the source from a beta branch and build, in order to get support for `--squeeze-lines`).

* Resolve CI errors and use qualified `std::uint64_t`

The fix was relying on implicit conversions in the non-taken branch.
- Ordinarily (work on a C++20 codebase) I would have used `if constexpr` here, sidestepping the issue, but that's not available on C++11 so I didn't bother.
- So instead of an `if` statement, I used a compile-time constant to select the correct overload.
- This is arguably better in this case, anyway.

I was using function-style casts for typed constants, which I consider superior for constants, but the CI checks disagree, so changed all to `static_cast`.
- For some reason, the CI checks didn't point at all of them, so I hope I caught them all myself.

Built with clang14 and all unit tests pass.

---------

Co-authored-by: Juan Carlos Arevalo Baeza (JCAB) <jcab@ntdev.microsoft.com>
2023-12-14 09:26:10 +01:00
9cca280a4d JSON for Modern C++ 3.11.3 (#4222) 2023-11-28 22:36:31 +01:00
f56c6e2e30 Update documentation for the next release (#4216) 2023-11-26 15:51:19 +01:00
360ce457f4 Add serialization-only user defined type macros (#3816) 2023-11-26 13:18:20 +01:00
5d931c59a3 Fix failing CI checks (#4215) 2023-11-25 18:04:59 +01:00
0261bc04d3 Fix CI (again) (#4196) 2023-11-01 21:23:55 +01:00
59da644db4 Add more specific error message when attempting to parse empty input (#4180) 2023-10-31 20:17:43 +01:00
6adae02ddd Fix spellcheck issue (#4173) 2023-10-04 15:24:38 +02:00
fac07e22c5 Accept NEW CMake policies up to CMake 3.14 (#4112)
Starting with CMake 3.27, deprecation warnings are issued
when asking for policy settings for CMake 3.4 or earlier.
The cmake_minimum_required() command accepts a version
range, which allows NEW policy settings up to the upper end
of that range to be used, but without raising the minimum
CMake version above the bottom of that range. This means
NEW policy settings will be used where available, without
requiring them. This change updates the project's
cmake_minimum_required() calls to use a version range to
extend the upper policy version to 3.14 where it wasn't already
at that version or higher. This prevents the deprecation warning
from CMake 3.27, and gives breathing space before a future
CMake release will start issuing similar deprecation warnings
again.
2023-09-25 09:31:26 +02:00
1ce29fa22f Fix CI (#4160) 2023-09-23 17:19:28 +02:00
836b7beca4 Fix CI, again (#4083) 2023-09-07 20:41:12 +02:00
788e5468e4 Fix typo in afl_driver.cpp (#4109) 2023-09-02 17:16:33 +02:00
793878898f Added to tests the file unit-algorithm.cpp (c++ 11) functions from algorithm library (#4044) 2023-06-11 09:59:57 +02:00
ab06fc9951 Fix Clang-Tidy warnings (#4047) 2023-06-08 18:46:48 +02:00
a0c1318830 Fix CI + new Doctest (#3985) 2023-05-21 17:23:18 +02:00
bbe337c3a3 Prevent memory leak when exception is thrown in adl_serializer::to_json (#3901)
Co-authored-by: barcode <barcode@example.com>
2023-03-08 13:43:45 +01:00
6cec5aefc9 custom allocators: define missing 'rebind' type (#3895) 2023-03-08 12:31:56 +01:00
660d0b5856 tests/unit-iterators2: use std::ranges::equals for range comparisons (#3950)
Closes https://github.com/nlohmann/json/issues/3927
2023-03-05 14:11:22 +01:00
233d233439 Fix CI issues (#3906)
Co-authored-by: barcode <barcode@example.com>
2023-01-31 19:23:37 +01:00
4b2c8ce6bc Fix some typos for n-dimensional arrays (#3767) 2022-09-26 06:23:18 +02:00
f4658de270 Fix 'declaration hides global declaration' warning (#3751) 2022-09-19 08:04:39 +02:00
3d1252bbff Replace limit macros with std::numeric_limits (#3723) 2022-09-19 08:02:50 +02:00
58bd97e2b1 Add clang-tools to required tools for ci_static_analysis_clang (#3724)
* 💚 add clang-tools to required tools for ci_static_analysis_clang

* 🚨 update Clang-Tidy warning selection

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings

* 🚨 fix Clang-Tidy warnings (#3738)

*  revert fix

*  revert fix

* 🚨 fix Clang-Tidy warnings (#3739)

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-09-13 12:58:26 +02:00
bed648ca55 Allow custom base class as node customization point (#3110)
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Co-authored-by: barcode <barcode@example.com>
2022-08-28 13:59:07 +02:00
f7973f46d6 Use official Clang/GCC containers (#3703) 2022-08-27 17:28:50 +02:00
9d69186291 🔖 set version to 3.11.2 2022-08-12 15:04:06 +02:00
0e61ee8b07 Restructure inline namespace and allow version component to be disabled (#3683) 2022-08-10 20:24:16 +02:00
31265dc69c Make json_pointer usable as map key (again) (#3685)
* Make json_pointer usable as map key

* Add unit tests
2022-08-07 14:35:40 +02:00
0c7a18374c Reimplement value() access functions (#3663)
* Reimplement value() access functions

* Merges the 'const char *' with the 'ValueType &&' overloads.
* Fixes ambiguities when default value is 0.
* Fixes 'no matching function' error when specifying ValueType template
  parameter.
* Fixes incorrect template parameter order in previous overloads.

* Add additional value() tests

* Make JSON_MultipleHeaders visible to unit tests

Define the macro JSON_TEST_USING_MULTIPLE_HEADERS to 0/1 depending on
JSON_MultipleHeaders.

* Add type_traits unit test

* Update documentation
2022-08-07 13:54:55 +02:00
8eee62d388 Miscellaneous small fixes (#3643)
* serve_header: suppress lgtm warning

* serve_header: fix exit code

* serve_header: replace deprecated ssl.wrap_socket()

* Add checks to unit test readme

* Add lgtm configuration file
2022-08-07 13:52:43 +02:00
f1e34070d2 Fix 'const' qualifier on bool& has no effect (#3678)
* Fix 'const' qualifier on bool& has no effect

Thanks, @georgthegreat, for pointing out this issue.

* Extend std::vector<bool> unit test
2022-08-07 13:50:08 +02:00
9e1a7c85e3 Add json_pointer/string_t equality comparison operators (#3664) 2022-08-05 14:08:27 +02:00
32242022f7 Minor BJData fixes (#3637)
* Replace vector/map LUTs in binary_reader with arrays

* Replace string_t::npos in binary_reader
2022-08-03 09:15:37 +02:00
f2020da0dd 🔖 set version to 3.11.1 2022-08-01 23:27:58 +02:00
cbaf1033be Fix global UDLs (#3646)
* Add ci_test_noglobaludls to CI

* Really default JSON_GLOBAL_UDLS to 1

* Test global UDLs

* Suppress warnings

* Clarify documentation
2022-08-01 22:42:35 +02:00