mirror of
https://github.com/nlohmann/json.git
synced 2026-05-08 15:25:24 +00:00
Fix missing exports from json.cppm (#5137)
* Fix missing exports from `json.cppm` Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Update documentation to describe what symbols are exported Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Add mention of `std` symbols Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Add `json_literals` inline namespace to `using` statement Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Remove internals (`nlohmann::detail::*`) from module Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Omit internals (`nlohmann::detail::*`) from modules documentation Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> * Restore `nlohmann::detail` symbols with mention of the MSVC bug Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com> --------- Signed-off-by: Miko <110693261+mikomikotaishi@users.noreply.github.com>
This commit is contained in:
@@ -24,11 +24,21 @@ json data = json::parse(f);
|
||||
```
|
||||
|
||||
## Modules do not export macros
|
||||
It should be noted that as modules do not export macros, the `nlohmann.json` module will not export any macros, but rather only the following symbols:
|
||||
It should be noted that as modules do not export macros, the `nlohmann.json` module will not export any macros.
|
||||
|
||||
## Exported symbols
|
||||
Only the following symbols are exported from `nlohmann.json`:
|
||||
- `nlohmann::adl_serializer`
|
||||
- `nlohmann::basic_json`
|
||||
- `nlohmann::json`
|
||||
- `nlohmann::json_pointer`
|
||||
- `nlohmann::ordered_map`
|
||||
- `nlohmann::ordered_json`
|
||||
- `nlohmann::ordered_map`
|
||||
- `nlohmann::to_string`
|
||||
- `nlohmann::literals::json_literals::operator""_json`
|
||||
- `nlohmann::literals::json_literals::operator""_json_pointer`
|
||||
|
||||
The following specialisations of `std` symbols are also exported:
|
||||
- `std::hash`
|
||||
- `std::less`
|
||||
- `std::swap`
|
||||
|
||||
+37
-19
@@ -1,32 +1,50 @@
|
||||
// __ _____ _____ _____
|
||||
// __| | __| | | | JSON for Modern C++
|
||||
// | | |__ | | | | | | version 3.12.0
|
||||
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann <https://nlohmann.me>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
module;
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
export module nlohmann.json;
|
||||
|
||||
export namespace nlohmann {
|
||||
using ::nlohmann::adl_serializer;
|
||||
using ::nlohmann::basic_json;
|
||||
using ::nlohmann::json;
|
||||
using ::nlohmann::json_pointer;
|
||||
using ::nlohmann::ordered_json;
|
||||
using ::nlohmann::ordered_map;
|
||||
} // namespace nlohmann
|
||||
|
||||
export
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
|
||||
using NLOHMANN_JSON_NAMESPACE::adl_serializer;
|
||||
using NLOHMANN_JSON_NAMESPACE::basic_json;
|
||||
using NLOHMANN_JSON_NAMESPACE::json;
|
||||
using NLOHMANN_JSON_NAMESPACE::json_pointer;
|
||||
using NLOHMANN_JSON_NAMESPACE::ordered_json;
|
||||
using NLOHMANN_JSON_NAMESPACE::ordered_map;
|
||||
using NLOHMANN_JSON_NAMESPACE::to_string;
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
inline namespace json_literals
|
||||
{
|
||||
using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator""_json;
|
||||
using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator""_json_pointer;
|
||||
} // namespace json_literals
|
||||
} // namespace literals
|
||||
|
||||
// Note: the following nlohmann::detail symbols must be exported due to
|
||||
// an MSVC bug failing to compile without these symbols visible (ticket #3970)
|
||||
namespace detail
|
||||
{
|
||||
export using NLOHMANN_JSON_NAMESPACE::detail::json_sax_dom_callback_parser;
|
||||
export using NLOHMANN_JSON_NAMESPACE::detail::unknown_size;
|
||||
using NLOHMANN_JSON_NAMESPACE::detail::json_sax_dom_callback_parser;
|
||||
using NLOHMANN_JSON_NAMESPACE::detail::unknown_size;
|
||||
} // namespace detail
|
||||
|
||||
export using NLOHMANN_JSON_NAMESPACE::adl_serializer;
|
||||
export using NLOHMANN_JSON_NAMESPACE::basic_json;
|
||||
export using NLOHMANN_JSON_NAMESPACE::json;
|
||||
export using NLOHMANN_JSON_NAMESPACE::json_pointer;
|
||||
export using NLOHMANN_JSON_NAMESPACE::ordered_json;
|
||||
export using NLOHMANN_JSON_NAMESPACE::ordered_map;
|
||||
export using NLOHMANN_JSON_NAMESPACE::to_string;
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
export namespace std
|
||||
{
|
||||
using std::hash;
|
||||
using std::less;
|
||||
using std::swap;
|
||||
} // namespace std
|
||||
|
||||
Reference in New Issue
Block a user