mirror of
https://github.com/nlohmann/json.git
synced 2026-07-03 01:04:18 +00:00
@@ -5408,11 +5408,11 @@ struct formatter<nlohmann::NLOHMANN_BASIC_JSON_TPL, char> // NOLINT(cert-dcl58-c
|
||||
++it;
|
||||
}
|
||||
|
||||
// ['#'] - "alternate form", used here to request pretty-printing
|
||||
bool pretty = false;
|
||||
// ['#'] - "alternate form", used here to request pretty-printing with a
|
||||
// default indent of 4 (overridden by an explicit width below, if given)
|
||||
if (it != end && *it == '#')
|
||||
{
|
||||
pretty = true;
|
||||
indent = 4;
|
||||
++it;
|
||||
}
|
||||
|
||||
@@ -5428,10 +5428,6 @@ struct formatter<nlohmann::NLOHMANN_BASIC_JSON_TPL, char> // NOLINT(cert-dcl58-c
|
||||
++it;
|
||||
}
|
||||
}
|
||||
else if (pretty)
|
||||
{
|
||||
indent = 4;
|
||||
}
|
||||
|
||||
// sign, the '0' flag, precision, locale-specific formatting ('L'), dynamic
|
||||
// width/precision ("{...}"), and type characters all have no meaning for
|
||||
|
||||
@@ -25934,11 +25934,11 @@ struct formatter<nlohmann::NLOHMANN_BASIC_JSON_TPL, char> // NOLINT(cert-dcl58-c
|
||||
++it;
|
||||
}
|
||||
|
||||
// ['#'] - "alternate form", used here to request pretty-printing
|
||||
bool pretty = false;
|
||||
// ['#'] - "alternate form", used here to request pretty-printing with a
|
||||
// default indent of 4 (overridden by an explicit width below, if given)
|
||||
if (it != end && *it == '#')
|
||||
{
|
||||
pretty = true;
|
||||
indent = 4;
|
||||
++it;
|
||||
}
|
||||
|
||||
@@ -25954,10 +25954,6 @@ struct formatter<nlohmann::NLOHMANN_BASIC_JSON_TPL, char> // NOLINT(cert-dcl58-c
|
||||
++it;
|
||||
}
|
||||
}
|
||||
else if (pretty)
|
||||
{
|
||||
indent = 4;
|
||||
}
|
||||
|
||||
// sign, the '0' flag, precision, locale-specific formatting ('L'), dynamic
|
||||
// width/precision ("{...}"), and type characters all have no meaning for
|
||||
|
||||
+15
-1
@@ -195,4 +195,18 @@ add_subdirectory(cmake_add_subdirectory)
|
||||
add_subdirectory(cmake_fetch_content)
|
||||
add_subdirectory(cmake_fetch_content2)
|
||||
add_subdirectory(cmake_target_include_directories)
|
||||
add_subdirectory(fmt_formatter)
|
||||
|
||||
# fmt (fetched by tests/fmt_formatter) requires a genuinely modern, C++17-capable
|
||||
# toolchain; skip it on legacy/niche toolchains where fmt itself is known not to build
|
||||
set(JSON_FMT_FORMATTER_TEST_SUPPORTED ${compiler_supports_cpp_17})
|
||||
# fmt 12's 128-bit integer emulation does not build with 32-bit MinGW
|
||||
if (MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(JSON_FMT_FORMATTER_TEST_SUPPORTED FALSE)
|
||||
endif()
|
||||
# the MSVC STL rejects Clang versions older than 19 as a host compiler
|
||||
if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0)
|
||||
set(JSON_FMT_FORMATTER_TEST_SUPPORTED FALSE)
|
||||
endif()
|
||||
if (JSON_FMT_FORMATTER_TEST_SUPPORTED)
|
||||
add_subdirectory(fmt_formatter)
|
||||
endif()
|
||||
|
||||
@@ -35,11 +35,11 @@ struct fmt::formatter<nlohmann::json>
|
||||
++it;
|
||||
}
|
||||
|
||||
// ['#'] - "alternate form", used here to request pretty-printing
|
||||
bool pretty = false;
|
||||
// ['#'] - "alternate form", used here to request pretty-printing with a
|
||||
// default indent of 4 (overridden by an explicit width below, if given)
|
||||
if (it != end && *it == '#')
|
||||
{
|
||||
pretty = true;
|
||||
indent = 4;
|
||||
++it;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,6 @@ struct fmt::formatter<nlohmann::json>
|
||||
++it;
|
||||
}
|
||||
}
|
||||
else if (pretty)
|
||||
{
|
||||
indent = 4;
|
||||
}
|
||||
|
||||
if (it != end && *it != '}')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user