Commit Graph

95 Commits

Author SHA1 Message Date
Florian Albrechtskirchinger
5352856f04
Implement support for string_view (attempt no. 3) (#3423)
* Add key_compare member to ordered_map

* Replace == with key_compare in ordered_map

* Expose the actual comparison function used by object_t

nlohmann::ordered_map uses a different comparison function than the one
provided via template parameter.
* Introduce a type trait to detect if object_t has a key_compare member.
* Rename object_comparator_t to default_object_comparator_t.
* Add object_comparator_t to be conditionally defined as
  object_t::key_compare, if available, or default_object_comparator_t
  otherwise.
* Update the documentation accordingly.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Add type traits to check if a type is usable as object key

Add type trait to check:
* if a type is a specialization of a template.
* if a type is a json_pointer.
* if a type is a basic_json::{const_,}iterator.
* if two types are comparable using a given comparison functor.
* if a type is comparable to basic_json::object_t::key_type.
* if a type has a member type is_transparent.
* if a type is usable as object key.
* if a type has an erase() function accepting a given KeyType.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Rework basic_json element access to accept more key types

Rework basic_json element access member functions and operators to
accept any type that meets the requirements defined by type trait
detail::is_usable_as_key_type.

Member functions and operators:
* at()
* operator[]
* value()
* erase()
* find()
* count()
* contains()

Update documentation to reflect these changes.

Add unit tests to excercise the new functions using std::string_view.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
2022-04-29 21:40:02 +02:00
Niels Lohmann
a6ee8bf9d9
Overwork documentation (#3444)
* 📝 overwork macro documentation

* 📝 address review comments

* 🔧 add style check to Makefile

* 🙈 overwork .gitignore

* 📌 Pygments 2.12.0 is broken

* ✏️ fix links

* 🚸 adjust output to cppcheck

* 📝 add titles to more admonitions

* ✏️ fix typos

* 📝 document future behavior change
2022-04-25 22:40:45 +02:00
JungHoon Lee
a94430615d
Fix typo in basic_json documentation (#3439) 2022-04-12 15:58:06 +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
10344907ff
📝 document which version introduced the macros #3429 (#3431) 2022-04-09 18:09:23 +02:00
Michael Nosthoff
15fa6a342a
at.md: fix typo (#3426) 2022-04-06 15:26:35 +02:00
Niels Lohmann
52e16a9f9c
🚸 add check if different version is also included #3337 (#3418) 2022-04-06 08:29:01 +02:00
Niels Lohmann
4a6e6ca8c7
📝 update documentation 2022-03-07 13:48:24 +01:00
Andrea Cocito
8d7b5b6a28
Add clarification to avoid misunderstanding that cause #3360 (#3378)
* Update macros.md

Typos, typos
2022-03-07 13:43:50 +01:00
Niels Lohmann
c6d8892e5d
FetchContent_MakeAvailable (#3351)
* 🔧 use FetchContent_MakeAvailable

* 💚 fix test names
2022-03-06 15:33:05 +01:00
Niels Lohmann
d8a63291cb
📝 add note on parsing ordered_json #3325 (#3326) 2022-02-12 15:45:51 +01:00
pketelsen
eec79d4e8a
Add macros NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and ..._NON_INTRUSIVE_WITH_DEFAULT (#3143)
* Added new macros NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT.

* Updated docs for NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT accordingly

* Rephrased docs for NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT

* Updated docs for NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT

* Renamed default_obj in to avoid name clashes

* Added test for serialization of default constructed object

* Add const to getters for macro tests

Co-authored-by: Chaoya Li <harry75369@gmail.com>
2022-01-30 22:06:50 +01:00
Niels Lohmann
c11f98228d
📝 document FetchContent 2022-01-30 13:05:18 +01:00
Ferry Huberts
293f67f9ff
Fix a typo (#3265) 2022-01-12 21:43:22 +01:00
Niels Lohmann
c6740d7d58
📝 add documentation for default behavior for macros 2022-01-11 21:46:40 +01:00
Niels Lohmann
ef556019be
📝 overwork documentation 2022-01-09 14:32:38 +01:00
Niels Lohmann
4b6220acf2
✏️ fix typo 2022-01-05 21:18:27 +01:00
Dimitris Apostolou
b785783440
Fix typo (#3249) 2022-01-05 13:35:14 +01:00
Niels Lohmann
6cd68ebd12
📝 add documentation for JSON Lines (#3247) 2022-01-05 09:51:29 +01:00
Niels Lohmann
a8e86ba948
📝 improve documentation InputType and IteratorType (#3246) 2022-01-04 15:02:39 +01:00
Niels Lohmann
b5364faf9d
🔖 set version to 3.10.5 2022-01-02 22:35:35 +01: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
Niels Lohmann
6d3115924c
Add C++17 copies of the test binaries (#3101)
* ⚗️ add C++17 copies of the test binaries
* ⚗️ use proper header for filesystem
* 🚨 fix warnings
* ⚗️ do not use too old compilers with C++17
*  add test
* 🔨 add more constraints #3097
* ⚗️ use fix from https://github.com/nlohmann/json/pull/3101#issuecomment-998788786
* ⚗️ use fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050
* 👷 use published CI image
2021-12-29 09:47:05 +01:00
Daniel Albuschat
ee1208aa60
Docs: Update skip_comments to ignore_comments (#3145)
In the docs, the `ignore_comments` parameter to `nlohmann::json::parse()` is described as `skip_comments`, which does not match the actual implementation. While the demo code compiles and works, the parameter name is wrong.
2021-11-17 19:21:54 +01:00
Dirk Stolle
fe230334d9
fix typos in documentation (#3140)
* fix typos in documentation

* revert changes to ChangeLog.md
2021-11-14 14:25:14 +01:00
Niels Lohmann
5d87c4d409
Add recursive update function (#3069)
*  add recursive update function
2021-11-03 13:52:20 +01:00
Niels Lohmann
c4a4e672fd
📝 add examples for parsing from iterator pair (#3100) 2021-10-29 21:26:41 +02:00
Cristi Vîjdea
f5b3fb326c
Fix typos in operator[] documentation (#3102)
* Fix typos in operator[] documentation
* Fix additional typo
2021-10-20 21:59:33 +02:00
Niels Lohmann
bbdb29c658
Update docset generation script (#2967)
* 📝 update docset generation script

* 📝 update documentation
2021-09-01 08:43:10 +02:00
mb0202
7194245a31
Fixed typo in parse.md (#2968)
Changed a potential typo: "charater" -> "character"
2021-08-24 08:08:02 +02:00
Niels Lohmann
34e2c4ab88
📝 add link to Homebrew package (#2966) 2021-08-22 21:58:37 +02:00
Niels Lohmann
44ffaa052c
Merge pull request #2943 from amirmasoudabdol/patch-1
Updating the Homebrew Command
2021-08-19 12:03:52 +02:00
Amir Masoud Abdol
14af5d4a9f fixing the doc files 2021-08-19 09:31:39 +02:00
Niels Lohmann
23e3b622aa
📝 add documentation for integration via vcpkg 2021-08-18 20:49:13 +02:00
Niels Lohmann
8cae9d7cd2
Overwork warning flags (#2936)
* ⚗️ update warning flags
2021-08-17 14:43:43 +02:00
Niels Lohmann
0a0eb7a850
Merge branch 'develop' of https://github.com/nlohmann/json into issue2863
 Conflicts:
	.github/workflows/windows.yml
2021-08-14 11:19:48 +02:00
Niels Lohmann
8ae31a56a5
Merge branch 'develop' of https://github.com/nlohmann/json into issue2824 2021-08-11 08:06:32 +02:00
Niels Lohmann
68d8661f1b
📝 update documentation 2021-08-11 08:06:25 +02:00
Niels Lohmann
523f7c2c9d
💡 update documentation 2021-08-08 13:24:17 +02:00
Niels Lohmann
eb488bb4d9
📝 add note for wstring handling 2021-08-01 20:54:02 +02:00
Niels Lohmann
19a5e12136
CMake cleanup (#2885)
* 🔥 clean CMake files and Makefile
* 💡 update documentation
2021-07-22 09:25:55 +02:00
Niels Lohmann
a0863b8c20
📝 add support section 2021-07-17 13:44:54 +02:00
Niels Lohmann
3db8903f29
📝 restructure README 2021-07-16 15:00:11 +02:00
Niels Lohmann
fb1ee4f94b
📝 update documentation 2021-07-16 14:41:14 +02:00
Niels Lohmann
a82f66beed
📝 document JSON_NO_IO macro #2842 2021-07-10 12:51:18 +02:00
Niels Lohmann
5c8d0af5ce
📝 add comment for handling of negative zeros #2854 2021-07-10 12:50:59 +02:00
justanotheranonymoususer
e970f31066
Update arbitrary_types.md 2021-06-18 12:44:27 +03:00
Niels Lohmann
d0ab2b86c3
📝 update documentation 2021-04-29 17:19:57 +02:00
Niels Lohmann
cdfe865486
📝 add documentation for numbers 2021-04-28 20:33:05 +02:00
Niels Lohmann
ca9a1f2fd4
📝 add note to outdated exceptions 2021-03-24 12:46:34 +01:00