From 27011e37185039721a79abd4ba83d1e24acc67e8 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 15 Mar 2019 14:55:13 +0100 Subject: [PATCH] :rotating_light: fixed warnings --- .../nlohmann/detail/conversions/to_json.hpp | 2 + include/nlohmann/detail/input/json_sax.hpp | 7 +-- include/nlohmann/detail/input/lexer.hpp | 1 + include/nlohmann/detail/input/parser.hpp | 1 + include/nlohmann/detail/input/position_t.hpp | 4 +- .../detail/iterators/iteration_proxy.hpp | 2 +- .../detail/iterators/iterator_traits.hpp | 4 +- include/nlohmann/detail/json_pointer.hpp | 1 + include/nlohmann/detail/macro_scope.hpp | 2 + include/nlohmann/detail/meta/is_sax.hpp | 1 + .../nlohmann/detail/output/binary_writer.hpp | 1 + include/nlohmann/detail/output/serializer.hpp | 1 + include/nlohmann/detail/value_t.hpp | 1 + include/nlohmann/json.hpp | 17 +++---- include/nlohmann/json_fwd.hpp | 6 +-- single_include/nlohmann/json.hpp | 51 +++++++++++-------- 16 files changed, 58 insertions(+), 44 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index ee13eb55..96095e9c 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -1,7 +1,9 @@ #pragma once +#include // copy #include // or, and, not #include // begin, end +#include // string #include // tuple, get #include // is_same, is_constructible, is_floating_point, is_enum, underlying_type #include // move, forward, declval, pair diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 4ce5a30d..d267bf2b 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -1,9 +1,10 @@ #pragma once -#include +#include // assert #include -#include -#include +#include // string +#include // move +#include // vector #include #include diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index 6f8b32c0..fd8858b3 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -6,6 +6,7 @@ #include // snprintf #include // initializer_list #include // char_traits, string +#include // move #include // vector #include diff --git a/include/nlohmann/detail/input/parser.hpp b/include/nlohmann/detail/input/parser.hpp index f5744196..e1999871 100644 --- a/include/nlohmann/detail/input/parser.hpp +++ b/include/nlohmann/detail/input/parser.hpp @@ -6,6 +6,7 @@ #include // function #include // string #include // move +#include // vector #include #include diff --git a/include/nlohmann/detail/input/position_t.hpp b/include/nlohmann/detail/input/position_t.hpp index 37f4ab15..14e9649f 100644 --- a/include/nlohmann/detail/input/position_t.hpp +++ b/include/nlohmann/detail/input/position_t.hpp @@ -23,5 +23,5 @@ struct position_t } }; -} -} +} // namespace detail +} // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/iteration_proxy.hpp b/include/nlohmann/detail/iterators/iteration_proxy.hpp index 334b467b..48231968 100644 --- a/include/nlohmann/detail/iterators/iteration_proxy.hpp +++ b/include/nlohmann/detail/iterators/iteration_proxy.hpp @@ -167,4 +167,4 @@ class tuple_element> #if defined(__clang__) #pragma clang diagnostic pop #endif -} +} // namespace std diff --git a/include/nlohmann/detail/iterators/iterator_traits.hpp b/include/nlohmann/detail/iterators/iterator_traits.hpp index 35ea81fb..9806be8c 100644 --- a/include/nlohmann/detail/iterators/iterator_traits.hpp +++ b/include/nlohmann/detail/iterators/iterator_traits.hpp @@ -45,5 +45,5 @@ struct iterator_traits::value>> { using pointer = T*; using reference = T&; }; -} -} +} // namespace detail +} // namespace nlohmann diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 28a7e8f3..5dba7b11 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -4,6 +4,7 @@ #include // assert #include // accumulate #include // string +#include // move #include // vector #include diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index fdaabec6..94d081ee 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -1,5 +1,7 @@ #pragma once +#include // pair + // This file contains all internal macro definitions // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them diff --git a/include/nlohmann/detail/meta/is_sax.hpp b/include/nlohmann/detail/meta/is_sax.hpp index b610beab..4a4f5bbd 100644 --- a/include/nlohmann/detail/meta/is_sax.hpp +++ b/include/nlohmann/detail/meta/is_sax.hpp @@ -2,6 +2,7 @@ #include // size_t #include // declval +#include // string #include #include diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index f191ca12..4d6f1577 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -5,6 +5,7 @@ #include // uint8_t, uint16_t, uint32_t, uint64_t #include // memcpy #include // numeric_limits +#include // string #include #include diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 74c2d771..f51afeea 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -12,6 +12,7 @@ #include // numeric_limits #include // string #include // is_same +#include // move #include #include diff --git a/include/nlohmann/detail/value_t.hpp b/include/nlohmann/detail/value_t.hpp index 10d555b9..c4552df9 100644 --- a/include/nlohmann/detail/value_t.hpp +++ b/include/nlohmann/detail/value_t.hpp @@ -4,6 +4,7 @@ #include // and #include // size_t #include // uint8_t +#include // string namespace nlohmann { diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 50f7980f..60f453d8 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -27,8 +27,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NLOHMANN_JSON_HPP -#define NLOHMANN_JSON_HPP +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 5 @@ -42,9 +42,11 @@ SOFTWARE. #include // initializer_list #include // istream, ostream #include // random_access_iterator_tag +#include // unique_ptr #include // accumulate #include // string, stoi, to_string #include // declval, forward, move, pair, swap +#include // vector #include #include @@ -3980,14 +3982,7 @@ class basic_json template bool contains(KeyT&& key) const { - if (is_object()) - { - return (m_value.object->find(std::forward(key)) != m_value.object->end()); - } - else - { - return false; - } + return (is_object() and m_value.object->find(std::forward(key)) != m_value.object->end()); } /// @} @@ -8052,4 +8047,4 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std #include -#endif +#endif // INCLUDE_NLOHMANN_JSON_HPP_ diff --git a/include/nlohmann/json_fwd.hpp b/include/nlohmann/json_fwd.hpp index 32abba91..28fd10d4 100644 --- a/include/nlohmann/json_fwd.hpp +++ b/include/nlohmann/json_fwd.hpp @@ -1,5 +1,5 @@ -#ifndef NLOHMANN_JSON_FWD_HPP -#define NLOHMANN_JSON_FWD_HPP +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ +#define INCLUDE_NLOHMANN_JSON_FWD_HPP_ #include // int64_t, uint64_t #include // map @@ -61,4 +61,4 @@ uses the standard template types. using json = basic_json<>; } // namespace nlohmann -#endif +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a77bf974..7e228def 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -27,8 +27,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NLOHMANN_JSON_HPP -#define NLOHMANN_JSON_HPP +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 5 @@ -42,13 +42,15 @@ SOFTWARE. #include // initializer_list #include // istream, ostream #include // random_access_iterator_tag +#include // unique_ptr #include // accumulate #include // string, stoi, to_string #include // declval, forward, move, pair, swap +#include // vector // #include -#ifndef NLOHMANN_JSON_FWD_HPP -#define NLOHMANN_JSON_FWD_HPP +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ +#define INCLUDE_NLOHMANN_JSON_FWD_HPP_ #include // int64_t, uint64_t #include // map @@ -110,11 +112,13 @@ uses the standard template types. using json = basic_json<>; } // namespace nlohmann -#endif +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ // #include +#include // pair + // This file contains all internal macro definitions // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them @@ -403,8 +407,8 @@ struct iterator_traits::value>> using pointer = T*; using reference = T&; }; -} -} +} // namespace detail +} // namespace nlohmann // #include @@ -839,8 +843,8 @@ struct position_t } }; -} -} +} // namespace detail +} // namespace nlohmann namespace nlohmann @@ -1192,6 +1196,7 @@ class other_error : public exception #include // and #include // size_t #include // uint8_t +#include // string namespace nlohmann { @@ -1643,8 +1648,10 @@ constexpr const auto& from_json = detail::static_const::va // #include +#include // copy #include // or, and, not #include // begin, end +#include // string #include // tuple, get #include // is_same, is_constructible, is_floating_point, is_enum, underlying_type #include // move, forward, declval, pair @@ -1829,7 +1836,7 @@ class tuple_element> #if defined(__clang__) #pragma clang diagnostic pop #endif -} +} // namespace std namespace nlohmann @@ -2595,6 +2602,7 @@ class input_adapter #include // snprintf #include // initializer_list #include // char_traits, string +#include // move #include // vector // #include @@ -4106,6 +4114,7 @@ scan_number_done: #include // function #include // string #include // move +#include // vector // #include @@ -4116,6 +4125,7 @@ scan_number_done: #include // size_t #include // declval +#include // string // #include @@ -4261,10 +4271,11 @@ struct is_sax_static_asserts // #include -#include +#include // assert #include -#include -#include +#include // string +#include // move +#include // vector // #include @@ -8472,6 +8483,7 @@ class binary_reader #include // uint8_t, uint16_t, uint32_t, uint64_t #include // memcpy #include // numeric_limits +#include // string // #include @@ -9822,6 +9834,7 @@ class binary_writer #include // numeric_limits #include // string #include // is_same +#include // move // #include @@ -11821,6 +11834,7 @@ class json_ref #include // assert #include // accumulate #include // string +#include // move #include // vector // #include @@ -16555,14 +16569,7 @@ class basic_json template bool contains(KeyT&& key) const { - if (is_object()) - { - return (m_value.object->find(std::forward(key)) != m_value.object->end()); - } - else - { - return false; - } + return (is_object() and m_value.object->find(std::forward(key)) != m_value.object->end()); } /// @} @@ -20651,4 +20658,4 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std #undef NLOHMANN_BASIC_JSON_TPL -#endif +#endif // INCLUDE_NLOHMANN_JSON_HPP_