From 85173f56279eb55161415fa0eae4276059dee876 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 10 Jan 2018 10:18:31 +0100 Subject: [PATCH] :hammer: some clean up --- develop/adl_serializer.hpp | 5 +- develop/detail/conversions/from_json.hpp | 5 +- develop/detail/conversions/to_json.hpp | 5 +- .../detail/iterators/internal_iterator.hpp | 5 +- develop/detail/iterators/iter_impl.hpp | 5 +- develop/detail/iterators/iteration_proxy.hpp | 5 +- .../iterators/json_reverse_iterator.hpp | 5 +- .../detail/iterators/primitive_iterator.hpp | 5 +- develop/detail/json_ref.hpp | 5 +- develop/detail/macro_scope.hpp | 5 +- develop/detail/macro_unscope.hpp | 5 +- develop/detail/meta.hpp | 5 +- develop/detail/parsing/binary_reader.hpp | 5 +- develop/detail/parsing/binary_writer.hpp | 5 +- develop/detail/parsing/input_adapters.hpp | 5 +- develop/detail/parsing/lexer.hpp | 5 +- develop/detail/parsing/output_adapters.hpp | 5 +- develop/detail/parsing/parser.hpp | 5 +- develop/detail/serializer.hpp | 5 +- develop/detail/value_t.hpp | 5 +- src/json.hpp | 136 +++++------------- 21 files changed, 58 insertions(+), 178 deletions(-) diff --git a/develop/adl_serializer.hpp b/develop/adl_serializer.hpp index c2ad371c..cae95637 100644 --- a/develop/adl_serializer.hpp +++ b/develop/adl_serializer.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_ADL_SERIALIZER_HPP -#define NLOHMANN_JSON_ADL_SERIALIZER_HPP +#pragma once #include @@ -44,5 +43,3 @@ struct adl_serializer } }; } - -#endif diff --git a/develop/detail/conversions/from_json.hpp b/develop/detail/conversions/from_json.hpp index 55925464..ba89e540 100644 --- a/develop/detail/conversions/from_json.hpp +++ b/develop/detail/conversions/from_json.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_CONVERSIONS_FROM_JSON_HPP -#define NLOHMANN_JSON_DETAIL_CONVERSIONS_FROM_JSON_HPP +#pragma once #include // transform #include // array @@ -314,5 +313,3 @@ namespace constexpr const auto& from_json = detail::static_const::value; } } - -#endif diff --git a/develop/detail/conversions/to_json.hpp b/develop/detail/conversions/to_json.hpp index 0153b13d..2df7b0b8 100644 --- a/develop/detail/conversions/to_json.hpp +++ b/develop/detail/conversions/to_json.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_CONVERSIONS_TO_JSON_HPP -#define NLOHMANN_JSON_DETAIL_CONVERSIONS_TO_JSON_HPP +#pragma once #include // or, and, not #include // begin, end @@ -337,5 +336,3 @@ namespace constexpr const auto& to_json = detail::static_const::value; } } - -#endif diff --git a/develop/detail/iterators/internal_iterator.hpp b/develop/detail/iterators/internal_iterator.hpp index 25763355..b65b33d3 100644 --- a/develop/detail/iterators/internal_iterator.hpp +++ b/develop/detail/iterators/internal_iterator.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP +#pragma once #include "detail/iterators/primitive_iterator.hpp" @@ -24,5 +23,3 @@ template struct internal_iterator }; } } - -#endif diff --git a/develop/detail/iterators/iter_impl.hpp b/develop/detail/iterators/iter_impl.hpp index e11412c6..4d939476 100644 --- a/develop/detail/iterators/iter_impl.hpp +++ b/develop/detail/iterators/iter_impl.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_ITER_IMPL_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_ITER_IMPL_HPP +#pragma once #include // not #include // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next @@ -613,5 +612,3 @@ class iter_impl }; } } - -#endif diff --git a/develop/detail/iterators/iteration_proxy.hpp b/develop/detail/iterators/iteration_proxy.hpp index e4ce84e4..296101c8 100644 --- a/develop/detail/iterators/iteration_proxy.hpp +++ b/develop/detail/iterators/iteration_proxy.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_ITERATION_PROXY_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_ITERATION_PROXY_HPP +#pragma once #include // size_t #include // string, to_string @@ -97,5 +96,3 @@ template class iteration_proxy }; } } - -#endif diff --git a/develop/detail/iterators/json_reverse_iterator.hpp b/develop/detail/iterators/json_reverse_iterator.hpp index b0f4effe..06448191 100644 --- a/develop/detail/iterators/json_reverse_iterator.hpp +++ b/develop/detail/iterators/json_reverse_iterator.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_JSON_REVERSE_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_JSON_REVERSE_ITERATOR_HPP +#pragma once #include // ptrdiff_t #include // reverse_iterator @@ -118,5 +117,3 @@ class json_reverse_iterator : public std::reverse_iterator }; } } - -#endif diff --git a/develop/detail/iterators/primitive_iterator.hpp b/develop/detail/iterators/primitive_iterator.hpp index c5cd4031..fd2a00cb 100644 --- a/develop/detail/iterators/primitive_iterator.hpp +++ b/develop/detail/iterators/primitive_iterator.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_PRIMITIVE_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_PRIMITIVE_ITERATOR_HPP +#pragma once #include // not #include // ptrdiff_t @@ -127,5 +126,3 @@ class primitive_iterator_t }; } } - -#endif diff --git a/develop/detail/json_ref.hpp b/develop/detail/json_ref.hpp index ec120c02..8285be22 100644 --- a/develop/detail/json_ref.hpp +++ b/develop/detail/json_ref.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_JSON_REF_HPP -#define NLOHMANN_JSON_DETAIL_JSON_REF_HPP +#pragma once #include #include @@ -62,5 +61,3 @@ class json_ref }; } } - -#endif diff --git a/develop/detail/macro_scope.hpp b/develop/detail/macro_scope.hpp index f20cc667..f8936025 100644 --- a/develop/detail/macro_scope.hpp +++ b/develop/detail/macro_scope.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_MACRO_SCOPE_HPP -#define NLOHMANN_JSON_MACRO_SCOPE_HPP +#pragma once #include // not @@ -102,5 +101,3 @@ contains a `mapped_type`, whereas `std::vector` fails the test. static constexpr bool value = \ std::is_integral()))>::value; \ } - -#endif diff --git a/develop/detail/macro_unscope.hpp b/develop/detail/macro_unscope.hpp index 9b8cf7b9..99a0abdf 100644 --- a/develop/detail/macro_unscope.hpp +++ b/develop/detail/macro_unscope.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_MACRO_UNSCOPE_HPP -#define NLOHMANN_JSON_DETAIL_MACRO_UNSCOPE_HPP +#pragma once // restore GCC/clang diagnostic settings #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) @@ -21,5 +20,3 @@ #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION #undef NLOHMANN_BASIC_JSON_TPL #undef NLOHMANN_JSON_HAS_HELPER - -#endif diff --git a/develop/detail/meta.hpp b/develop/detail/meta.hpp index 35705183..bea42a07 100644 --- a/develop/detail/meta.hpp +++ b/develop/detail/meta.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_META_HPP -#define NLOHMANN_JSON_DETAIL_META_HPP +#pragma once #include // not #include // size_t @@ -233,5 +232,3 @@ template constexpr T static_const::value; } } - -#endif diff --git a/develop/detail/parsing/binary_reader.hpp b/develop/detail/parsing/binary_reader.hpp index a1195393..bacf3d46 100644 --- a/develop/detail/parsing/binary_reader.hpp +++ b/develop/detail/parsing/binary_reader.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_BINARY_READER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_BINARY_READER_HPP +#pragma once #include // generate_n #include // array @@ -1089,5 +1088,3 @@ class binary_reader }; } } - -#endif diff --git a/develop/detail/parsing/binary_writer.hpp b/develop/detail/parsing/binary_writer.hpp index 59583b9c..68034fc7 100644 --- a/develop/detail/parsing/binary_writer.hpp +++ b/develop/detail/parsing/binary_writer.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_BINARY_WRITER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_BINARY_WRITER_HPP +#pragma once #include // reverse #include // array @@ -554,5 +553,3 @@ class binary_writer }; } } - -#endif diff --git a/develop/detail/parsing/input_adapters.hpp b/develop/detail/parsing/input_adapters.hpp index 7d4f2dee..abbf5d29 100644 --- a/develop/detail/parsing/input_adapters.hpp +++ b/develop/detail/parsing/input_adapters.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_INPUT_ADAPTERS_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_INPUT_ADAPTERS_HPP +#pragma once #include // min #include // array @@ -261,5 +260,3 @@ class input_adapter }; } } - -#endif diff --git a/develop/detail/parsing/lexer.hpp b/develop/detail/parsing/lexer.hpp index f50b0521..de222a6c 100644 --- a/develop/detail/parsing/lexer.hpp +++ b/develop/detail/parsing/lexer.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_LEXER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_LEXER_HPP +#pragma once #include // localeconv #include // size_t @@ -1275,5 +1274,3 @@ scan_number_done: }; } } - -#endif diff --git a/develop/detail/parsing/output_adapters.hpp b/develop/detail/parsing/output_adapters.hpp index 71099038..fe9e1b36 100644 --- a/develop/detail/parsing/output_adapters.hpp +++ b/develop/detail/parsing/output_adapters.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_OUTPUT_ADAPTERS_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_OUTPUT_ADAPTERS_HPP +#pragma once #include // copy #include // size_t @@ -112,5 +111,3 @@ class output_adapter }; } } - -#endif diff --git a/develop/detail/parsing/parser.hpp b/develop/detail/parsing/parser.hpp index 52a9c4fe..b0322204 100644 --- a/develop/detail/parsing/parser.hpp +++ b/develop/detail/parsing/parser.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_PARSING_PARSER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_PARSER_HPP +#pragma once #include // assert #include // isfinite @@ -588,5 +587,3 @@ class parser }; } } - -#endif diff --git a/develop/detail/serializer.hpp b/develop/detail/serializer.hpp index 0d3303d9..b5f2b06a 100644 --- a/develop/detail/serializer.hpp +++ b/develop/detail/serializer.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_SERIALIZER_HPP -#define NLOHMANN_JSON_DETAIL_SERIALIZER_HPP +#pragma once #include // reverse, remove, fill, find, none_of #include // array @@ -793,5 +792,3 @@ class serializer }; } } - -#endif diff --git a/develop/detail/value_t.hpp b/develop/detail/value_t.hpp index b96f294b..326367c4 100644 --- a/develop/detail/value_t.hpp +++ b/develop/detail/value_t.hpp @@ -1,5 +1,4 @@ -#ifndef NLOHMANN_JSON_DETAIL_VALUE_T_HPP -#define NLOHMANN_JSON_DETAIL_VALUE_T_HPP +#pragma once #include // array #include // and @@ -75,5 +74,3 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept } } } - -#endif diff --git a/src/json.hpp b/src/json.hpp index cc43f5b5..a80cc36a 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -107,8 +107,7 @@ using json = basic_json<>; #endif // #include "detail/macro_scope.hpp" -#ifndef NLOHMANN_JSON_MACRO_SCOPE_HPP -#define NLOHMANN_JSON_MACRO_SCOPE_HPP + #include // not @@ -212,11 +211,8 @@ contains a `mapped_type`, whereas `std::vector` fails the test. std::is_integral()))>::value; \ } -#endif - // #include "detail/meta.hpp" -#ifndef NLOHMANN_JSON_DETAIL_META_HPP -#define NLOHMANN_JSON_DETAIL_META_HPP + #include // not #include // size_t @@ -453,8 +449,6 @@ constexpr T static_const::value; } } -#endif - // #include "detail/exceptions.hpp" #ifndef NLOHMANN_JSON_DETAIL_EXCEPTIONS_HPP #define NLOHMANN_JSON_DETAIL_EXCEPTIONS_HPP @@ -789,8 +783,7 @@ class other_error : public exception #endif // #include "detail/value_t.hpp" -#ifndef NLOHMANN_JSON_DETAIL_VALUE_T_HPP -#define NLOHMANN_JSON_DETAIL_VALUE_T_HPP + #include // array #include // and @@ -867,11 +860,8 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept } } -#endif - // #include "detail/conversions/from_json.hpp" -#ifndef NLOHMANN_JSON_DETAIL_CONVERSIONS_FROM_JSON_HPP -#define NLOHMANN_JSON_DETAIL_CONVERSIONS_FROM_JSON_HPP + #include // transform #include // array @@ -1191,11 +1181,8 @@ constexpr const auto& from_json = detail::static_const::va } } -#endif - // #include "detail/conversions/to_json.hpp" -#ifndef NLOHMANN_JSON_DETAIL_CONVERSIONS_TO_JSON_HPP -#define NLOHMANN_JSON_DETAIL_CONVERSIONS_TO_JSON_HPP + #include // or, and, not #include // begin, end @@ -1536,11 +1523,8 @@ constexpr const auto& to_json = detail::static_const::value; } } -#endif - // #include "detail/parsing/input_adapters.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_INPUT_ADAPTERS_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_INPUT_ADAPTERS_HPP + #include // min #include // array @@ -1804,11 +1788,8 @@ class input_adapter } } -#endif - // #include "detail/parsing/lexer.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_LEXER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_LEXER_HPP + #include // localeconv #include // size_t @@ -3087,11 +3068,8 @@ scan_number_done: } } -#endif - // #include "detail/parsing/parser.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_PARSER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_PARSER_HPP + #include // assert #include // isfinite @@ -3686,11 +3664,8 @@ class parser } } -#endif - // #include "detail/iterators/primitive_iterator.hpp" -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_PRIMITIVE_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_PRIMITIVE_ITERATOR_HPP + #include // not #include // ptrdiff_t @@ -3819,11 +3794,8 @@ class primitive_iterator_t } } -#endif - // #include "detail/iterators/internal_iterator.hpp" -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP + // #include "detail/iterators/primitive_iterator.hpp" @@ -3850,11 +3822,8 @@ template struct internal_iterator } } -#endif - // #include "detail/iterators/iter_impl.hpp" -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_ITER_IMPL_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_ITER_IMPL_HPP + #include // not #include // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next @@ -4475,11 +4444,8 @@ class iter_impl } } -#endif - // #include "detail/iterators/iteration_proxy.hpp" -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_ITERATION_PROXY_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_ITERATION_PROXY_HPP + #include // size_t #include // string, to_string @@ -4579,11 +4545,8 @@ template class iteration_proxy } } -#endif - // #include "detail/iterators/json_reverse_iterator.hpp" -#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_JSON_REVERSE_ITERATOR_HPP -#define NLOHMANN_JSON_DETAIL_ITERATORS_JSON_REVERSE_ITERATOR_HPP + #include // ptrdiff_t #include // reverse_iterator @@ -4703,11 +4666,8 @@ class json_reverse_iterator : public std::reverse_iterator } } -#endif - // #include "detail/parsing/output_adapters.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_OUTPUT_ADAPTERS_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_OUTPUT_ADAPTERS_HPP + #include // copy #include // size_t @@ -4821,11 +4781,8 @@ class output_adapter } } -#endif - // #include "detail/parsing/binary_reader.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_BINARY_READER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_BINARY_READER_HPP + #include // generate_n #include // array @@ -5920,11 +5877,8 @@ class binary_reader } } -#endif - // #include "detail/parsing/binary_writer.hpp" -#ifndef NLOHMANN_JSON_DETAIL_PARSING_BINARY_WRITER_HPP -#define NLOHMANN_JSON_DETAIL_PARSING_BINARY_WRITER_HPP + #include // reverse #include // array @@ -6482,11 +6436,8 @@ class binary_writer } } -#endif - // #include "detail/serializer.hpp" -#ifndef NLOHMANN_JSON_DETAIL_SERIALIZER_HPP -#define NLOHMANN_JSON_DETAIL_SERIALIZER_HPP + #include // reverse, remove, fill, find, none_of #include // array @@ -7285,11 +7236,8 @@ class serializer } } -#endif - // #include "detail/json_ref.hpp" -#ifndef NLOHMANN_JSON_DETAIL_JSON_REF_HPP -#define NLOHMANN_JSON_DETAIL_JSON_REF_HPP + #include #include @@ -7353,11 +7301,8 @@ class json_ref } } -#endif - // #include "adl_serializer.hpp" -#ifndef NLOHMANN_JSON_ADL_SERIALIZER_HPP -#define NLOHMANN_JSON_ADL_SERIALIZER_HPP + #include @@ -7405,8 +7350,6 @@ struct adl_serializer }; } -#endif - /*! @brief namespace for Niels Lohmann @@ -15365,31 +15308,28 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std } // #include "detail/macro_unscope.hpp" -#ifndef NLOHMANN_JSON_DETAIL_MACRO_UNSCOPE_HPP - #define NLOHMANN_JSON_DETAIL_MACRO_UNSCOPE_HPP - // restore GCC/clang diagnostic settings - #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) - #pragma GCC diagnostic pop - #endif - #if defined(__clang__) - #pragma GCC diagnostic pop - #endif - - // clean up - #undef JSON_CATCH - #undef JSON_THROW - #undef JSON_TRY - #undef JSON_LIKELY - #undef JSON_UNLIKELY - #undef JSON_DEPRECATED - #undef JSON_HAS_CPP_14 - #undef JSON_HAS_CPP_17 - #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION - #undef NLOHMANN_BASIC_JSON_TPL - #undef NLOHMANN_JSON_HAS_HELPER +// restore GCC/clang diagnostic settings +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic pop #endif +#if defined(__clang__) + #pragma GCC diagnostic pop +#endif + +// clean up +#undef JSON_CATCH +#undef JSON_THROW +#undef JSON_TRY +#undef JSON_LIKELY +#undef JSON_UNLIKELY +#undef JSON_DEPRECATED +#undef JSON_HAS_CPP_14 +#undef JSON_HAS_CPP_17 +#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION +#undef NLOHMANN_BASIC_JSON_TPL +#undef NLOHMANN_JSON_HAS_HELPER #endif