Commit graph

56 commits

Author SHA1 Message Date
Florian Albrechtskirchinger 9e1a7c85e3
Add json_pointer/string_t equality comparison operators (#3664) 2022-08-05 14:08:27 +02:00
Niels Lohmann f2020da0dd
🔖 set version to 3.11.1 2022-08-01 23:27:58 +02:00
Niels Lohmann ce0e13ccea
🔖 set version to 3.11.0 2022-07-31 23:19:06 +02:00
Florian Albrechtskirchinger d909f80960
Add versioned, ABI-tagged inline namespace and namespace macros (#3590)
* Add versioned inline namespace

Add a versioned inline namespace to prevent ABI issues when linking code
using multiple library versions.

* Add namespace macros

* Encode ABI information in inline namespace

Add _diag suffix to inline namespace if JSON_DIAGNOSTICS is enabled, and
_ldvcmp suffix if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON is enabled.

* Move ABI-affecting macros into abi_macros.hpp

* Move std_fs namespace definition into std_fs.hpp

* Remove std_fs namespace from unit test

* Format more files in tests directory

* Add unit tests

* Update documentation

* Fix GDB pretty printer

* fixup! Add namespace macros

* Derive ABI prefix from NLOHMANN_JSON_VERSION_*
2022-07-30 21:59:13 +02:00
Florian Albrechtskirchinger e3095f636f
Add operator<<(json_pointer) (#3601)
* Add operator<< for json_pointer

* Deprecate json_pointer::operator string_t()

* Update documentation

* Move operator<<(basic_json) example

* Add example

* Add mkdocs-redirects

* Move operator<< and operator>> doc pages out of basic_json/

* Rename JSON pointer operator_string to operator_string_t

* Add unit test
2022-07-28 22:12:23 +02:00
Niels Lohmann 527da54dcb
Use REUSE framework (#3546)
* 📄 add licenses

* 👷 add REUSE compliance check

* 📝 add badge for REUSE

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-20 12:38:07 +02:00
Florian Albrechtskirchinger 616caea27a
Re-template json_pointer on string type (#3415)
* Make exception context optional

Change exception context parameter to pointer and replace context with
nullptr where appropriate.

* Support escaping other string types

* Add string concatenation function

Add variadic concat() function for concatenating char *, char, and
string types.

* Replace string concatenations using + with concat()

* Template json_pointer on string type

Change json_pointer from being templated on basic_json to being
templated on string type.

* Add unit test for #3388

Closes #3388.

* Fix regression test for #2958

* Add backwards compatibility with json_pointer<basic_json>

* Update json_pointer docs

* Allow comparing different json_pointers

* Update version numbers
2022-04-12 14:18:16 +02:00
Niels Lohmann 29cd970b94
Consolidate documentation (#3071)
* 🔥 consolidate documentation
* ♻️ overwork std specializations
* 🚚 move images files to mkdocs
* ♻️ fix URLs
* 🔧 tweak MkDocs configuration
* 🔧 add namespaces
* 📝 document deprecations
* 📝 document documentation generation
* 🚸 improve search
* 🚸 add examples
* 🚧 start adding documentation for macros
* 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139
* 📝 overwork example handling
* 📝 fix Markdown tables
2021-12-29 13:41:01 +01:00
Ferry Huberts e7a69b8d31 Adjust more files after actually building like the CI
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2021-08-13 14:00:00 +02:00
Ferry Huberts 44d60f8d14 All: fix warnings when compiling with -Wswitch-enum
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2021-08-12 16:33:50 +02:00
Niels Lohmann 6f551930e5
🚨 add new CI and fix warnings (#2561)
* ⚗️ move CI targets to CMake
* ♻️ add target for cpplint
* ♻️ add target for self-contained binaries
* ♻️ add targets for iwyu and infer
* 🔊 add version output
* ♻️ add target for oclint
* 🚨 fix warnings
* ♻️ rename targets
* ♻️ use iwyu properly
* 🚨 fix warnings
* ♻️ use iwyu properly
* ♻️ add target for benchmarks
* ♻️ add target for CMake flags
* 👷 use GitHub Actions
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ add clang analyze target
* 🔥 remove Google Benchmark
* ⬆️ Google Benchmark 1.5.2
* 🔥 use fetchcontent
* 🐧 add target to download a Linux version of CMake
* 🔨 fix dependency
* 🚨 fix includes
* 🚨 fix comment
* 🔧 adjust flags for GCC 11.0.0 20210110 (experimental)
* 🐳 user Docker image to run CI
* 🔧 add target for Valgrind
* 👷 add target for Valgrind tests
* ⚗️ add Dart
*  remove Dart
* ⚗️ do not call ctest in test subdirectory
* ⚗️ download test data explicitly
* ⚗️ only execute Valgrind tests
* ⚗️ fix labels
* 🔥 remove unneeded jobs
* 🔨 cleanup
* 🐛 fix OCLint call
*  add targets for offline and git-independent tests
*  add targets for C++ language versions and reproducible tests
* 🔨 clean up
* 👷 add CI steps for cppcheck and cpplint
* 🚨 fix warnings from Clang-Tidy
* 👷 add CI steps for Clang-Tidy
* 🚨 fix warnings
* 🔧 select proper binary
* 🚨 fix warnings
* 🚨 suppress some unhelpful warnings
* 🚨 fix warnings
* 🎨 fix format
* 🚨 fix warnings
* 👷 add CI steps for Sanitizers
* 🚨 fix warnings
*  add optimization to sanitizer build
* 🚨 fix warnings
* 🚨 add missing header
* 🚨 fix warnings
* 👷 add CI step for coverage
* 👷 add CI steps for disabled exceptions and implicit conversions
* 🚨 fix warnings
* 👷 add CI steps for checking indentation
* 🐛 fix variable use
* 💚 fix build
*  remove CircleCI
* 👷 add CI step for diagnostics
* 🚨 fix warning
* 🔥 clean Travis
2021-03-24 07:15:18 +01:00
Niels Lohmann 74cc0ab470
♻️ remove diagnostics_t class 2021-01-25 13:47:50 +01:00
Niels Lohmann c190a72f3d
👌 apply suggestion
Co-authored-by: Alexander Karzhenkov <karzhenkov@mail.ru>
2021-01-24 17:45:08 +01:00
Niels Lohmann e9d641130d
🐛 proper JSON Pointer escape in diagnostic messages 2021-01-16 15:33:05 +01:00
Niels Lohmann e160749003
♻️ move diagnostic code in header 2021-01-09 19:21:18 +01:00
Niels Lohmann 9d726c25d5
♻️ remove "#define private public" 2020-08-12 13:30:06 +02:00
Niels Lohmann dc06f100be
Merge branch 'develop' of https://github.com/nlohmann/json into clang_windows
 Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	include/nlohmann/detail/input/json_sax.hpp
	include/nlohmann/detail/input/lexer.hpp
	include/nlohmann/detail/input/parser.hpp
	include/nlohmann/detail/json_pointer.hpp
	include/nlohmann/detail/output/serializer.hpp
	include/nlohmann/json.hpp
	single_include/nlohmann/json.hpp
2020-07-11 14:04:40 +02:00
Niels Lohmann 98b1c6d302
🚩 use JSON_ASSERT(x) instead of assert(x) 2020-07-06 12:22:31 +02:00
Niels Lohmann ac3922c7aa
Merge branch 'develop' of https://github.com/nlohmann/json into clang_windows
 Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	include/nlohmann/detail/input/input_adapters.hpp
	include/nlohmann/detail/input/lexer.hpp
	include/nlohmann/detail/output/binary_writer.hpp
	include/nlohmann/json.hpp
	single_include/nlohmann/json.hpp
2020-06-27 13:14:48 +02:00
Niels Lohmann fa9f4040df
🔥 remove unused typedefs #2221 2020-06-27 13:07:02 +02:00
Thomas Braun ecbb2756fd json_pointer::array_index: Use unsigned values for the array index when parsing
The current code uses std::stoi to convert the input string to an int
array_index. This limits the maximum addressable array size to ~2GB on
most platforms.

But all callers immediately convert the result of array_index to
BasicJsonType::size_type.

So let's parse it as unsigned long long, which allows us to have as
big arrays as available memory. And also makes the call sites nicer to
read.

One complication arises on platforms where size_type is smaller than
unsigned long long. We need to bail out on these if the parsed array
index does not fit into size_type.
2020-06-22 13:42:55 +02:00
Thomas Braun f0e73163f2 json_pointer.hpp: Mention more exception in documentation
Forgotten in dcd3a6c6 (move the catch of std::invalid_argument into
array_index(), 2020-03-23).
2020-06-20 15:27:22 +02:00
Niels Lohmann 0498202a03
🎨 replace alternative operators (and, not, or) 2020-06-03 14:20:36 +02:00
chenguoping 8bfc692602 update condition 2020-04-20 16:00:55 +08:00
chenguoping f5a487d1b4 fix issue1982: contains() exceptions are incorrectly raised 2020-04-13 19:41:13 +08:00
Niels Lohmann b7be613b6e
Merge pull request #1990 from dota17/json_pointer
catch exceptions for json_pointer : ..../+99
2020-04-13 13:29:33 +02:00
chenguoping 34cf7b7a48 just restart ci 2020-04-07 10:00:21 +08:00
chenguoping e07686f0c7 update array_index() and add testcases 2020-03-25 15:57:20 +08:00
chenguoping dcd3a6c62b move the catch of std::invalid_argument into array_index() 2020-03-23 17:24:47 +08:00
Sergey Linev 78e911b8c3
Use array_idx as methods args
Avoid mix-up with array_index member

Co-Authored-By: Niels Lohmann <niels.lohmann@gmail.com>
2020-03-19 11:52:40 +01:00
chenguoping bfc003cadf catch exceptions for json_point : /xx/+99 2020-03-17 20:49:28 +08:00
Sergey Linev 00049c20d0 Rename argument array_index to array_indx in json_pointer methods
Fixes gcc48 warning:

declaration of ‘array_index’ shadows a member of 'this' [-Wshadow]
2020-03-11 07:41:53 +01:00
Florian Pigorsch b93d414a35 Fix some spelling errors - mostly in comments & documentation.
I did not touch the Changelog file and any third party stuff.

additonal -> additional (1)
apppend -> append (2)
constuctor -> constructor (2)
contect -> context (2)
dobulequote -> doublequote (1)
elemnts -> elements (1)
exakt -> exact (2)
exluded -> exclude (1)
explicitely -> explicitly (2)
narcissic -> narcissistic (1)
ocurred -> occurred (1)
occuring -> occurring (2)
preceeds -> preceded (1)
ot -> to (2)
wehther -> whether (2)
2019-10-19 11:59:51 +02:00
christian 7476f5ee0c Make json_pointer::back const (resolves #1764) 2019-10-01 00:57:27 +02:00
Niels Lohmann cf8251eb54
🚑 fix compiler errors 2019-07-14 21:19:55 +02:00
Niels Lohmann a501365ea2
Merge branch 'feature/hedley' into develop 2019-07-14 20:58:08 +02:00
Niels Lohmann 90798caa62
🚚 rename Hedley macros 2019-07-01 22:37:30 +02:00
Niels Lohmann 897362191d
🔨 add NLOHMANN_JSON prefix and undef macros 2019-07-01 22:24:39 +02:00
Niels Lohmann 1720bfedd1
⚗️ add Hedley annotations 2019-06-30 22:14:02 +02:00
Niels Lohmann 258fa798f1
add contains function for JSON pointers 2019-06-30 10:03:08 +02:00
Niels Lohmann e07e8e7912
📝 updated documentation 2019-03-19 15:40:23 +01:00
Niels Lohmann 710f26f95c
📝 added documentation 2019-03-19 10:06:35 +01:00
Niels Lohmann 8d3f4f21bc
🔨 clean up 2019-03-18 13:53:48 +01:00
Niels Lohmann 22c733e6fe
📝 added documentation 2019-03-17 22:25:18 +01:00
Niels Lohmann b8451c236f
🚨 fixed warnings 2019-03-17 12:01:49 +01:00
Niels Lohmann 27011e3718
🚨 fixed warnings 2019-03-15 14:55:13 +01:00
garethsb-sony 08de9eeaca Add json_pointer::parent_pointer (cf. std::filesystem::path::parent_path) 2019-02-25 09:26:08 +00:00
garethsb-sony 164e0e54d9 Rename private json_pointer::is_root as public json_pointer::empty for consistency with std::filesystem::path 2019-02-25 09:26:07 +00:00
garethsb-sony c850e9d82d Add operator/= and operator/ to construct a JSON pointer by appending two JSON pointers, as well as convenience op/= and op= to append a single unescaped token or array index; inspired by std::filesystem::path 2019-01-31 19:15:50 +00:00
Patrick Boettcher a06e7f5d80 JSON-pointer: add operator+() returning a new json_pointer 2019-01-24 16:46:51 +01:00