diff --git a/.clang-format b/.clang-format index ec1550db..0853a782 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ # http://clang.llvm.org/docs/ClangFormatStyleOptions.html BasedOnStyle: Google -Standard: Cpp03 +Standard: c++11 AllowShortFunctionsOnASingleLine: Empty IncludeBlocks: Preserve IndentPPDirectives: AfterHash diff --git a/extras/tests/JsonVariant/stl_containers.cpp b/extras/tests/JsonVariant/stl_containers.cpp index 768586a8..d6b9b60b 100644 --- a/extras/tests/JsonVariant/stl_containers.cpp +++ b/extras/tests/JsonVariant/stl_containers.cpp @@ -12,7 +12,7 @@ namespace ArduinoJson { template -struct Converter > { +struct Converter> { static void toJson(const std::vector& src, JsonVariant dst) { JsonArray array = dst.to(); for (T item : src) @@ -36,7 +36,7 @@ struct Converter > { }; template -struct Converter > { +struct Converter> { static void toJson(const std::array& src, JsonVariant dst) { JsonArray array = dst.to(); for (T item : src) @@ -79,7 +79,7 @@ TEST_CASE("vector") { doc.add(1); doc.add(2); - auto v = doc.as >(); + auto v = doc.as>(); REQUIRE(v.size() == 2); CHECK(v[0] == 1); CHECK(v[1] == 2); @@ -87,14 +87,14 @@ TEST_CASE("vector") { SECTION("checkJson") { StaticJsonDocument<128> doc; - CHECK(doc.is >() == false); + CHECK(doc.is>() == false); doc.add(1); doc.add(2); - CHECK(doc.is >() == true); + CHECK(doc.is>() == true); doc.add("foo"); - CHECK(doc.is >() == false); + CHECK(doc.is>() == false); } } diff --git a/extras/tests/Misc/StringAdapters.cpp b/extras/tests/Misc/StringAdapters.cpp index a088203d..c2a8dc4c 100644 --- a/extras/tests/Misc/StringAdapters.cpp +++ b/extras/tests/Misc/StringAdapters.cpp @@ -91,13 +91,13 @@ struct EmptyStruct {}; TEST_CASE("IsString") { CHECK(IsString::value == true); - CHECK(IsString >::value == false); + CHECK(IsString>::value == false); CHECK(IsString::value == true); CHECK(IsString::value == true); CHECK(IsString::value == true); CHECK(IsString::value == true); - CHECK(IsString< ::String>::value == true); - CHECK(IsString< ::StringSumHelper>::value == true); + CHECK(IsString<::String>::value == true); + CHECK(IsString<::StringSumHelper>::value == true); CHECK(IsString::value == false); } diff --git a/extras/tests/Misc/StringWriter.cpp b/extras/tests/Misc/StringWriter.cpp index cb6ba048..3cc1333f 100644 --- a/extras/tests/Misc/StringWriter.cpp +++ b/extras/tests/Misc/StringWriter.cpp @@ -65,7 +65,7 @@ TEST_CASE("Writer") { TEST_CASE("Writer") { ::String output; - Writer< ::String> writer(output); + Writer<::String> writer(output); SECTION("write(char)") { SECTION("writes to temporary buffer") { diff --git a/extras/tests/TextFormatter/writeFloat.cpp b/extras/tests/TextFormatter/writeFloat.cpp index bece7d4b..8e4bd7e7 100644 --- a/extras/tests/TextFormatter/writeFloat.cpp +++ b/extras/tests/TextFormatter/writeFloat.cpp @@ -17,7 +17,7 @@ template void check(TFloat input, const std::string& expected) { std::string output; Writer sb(output); - TextFormatter > writer(sb); + TextFormatter> writer(sb); writer.writeFloat(input); REQUIRE(writer.bytesWritten() == output.size()); CHECK(expected == output); diff --git a/src/ArduinoJson/Array/ElementProxy.hpp b/src/ArduinoJson/Array/ElementProxy.hpp index 40d1e084..1a9e9ce2 100644 --- a/src/ArduinoJson/Array/ElementProxy.hpp +++ b/src/ArduinoJson/Array/ElementProxy.hpp @@ -11,8 +11,8 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE // A proxy class to get or set an element of an array. // https://arduinojson.org/v6/api/jsonarray/subscript/ template -class ElementProxy : public VariantRefBase >, - public VariantOperators > { +class ElementProxy : public VariantRefBase>, + public VariantOperators> { friend class VariantAttorney; public: diff --git a/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp b/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp index f9176838..14491f44 100644 --- a/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp +++ b/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp @@ -10,7 +10,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template struct Reader::value>::type> + typename enable_if::value>::type> : BoundedReader { explicit Reader(const ::String& s) : BoundedReader(s.c_str(), s.length()) {} diff --git a/src/ArduinoJson/Document/JsonDocument.hpp b/src/ArduinoJson/Document/JsonDocument.hpp index 79596ece..d8efdf51 100644 --- a/src/ArduinoJson/Document/JsonDocument.hpp +++ b/src/ArduinoJson/Document/JsonDocument.hpp @@ -173,7 +173,7 @@ class JsonDocument : public detail::VariantOperators { template FORCE_INLINE typename detail::enable_if< detail::IsString::value, - detail::MemberProxy >::type + detail::MemberProxy>::type operator[](const TString& key) { return {*this, key}; } @@ -183,7 +183,7 @@ class JsonDocument : public detail::VariantOperators { template FORCE_INLINE typename detail::enable_if< detail::IsString::value, - detail::MemberProxy >::type + detail::MemberProxy>::type operator[](TChar* key) { return {*this, key}; } diff --git a/src/ArduinoJson/Object/JsonObject.hpp b/src/ArduinoJson/Object/JsonObject.hpp index 703ce86f..f2c73b7e 100644 --- a/src/ArduinoJson/Object/JsonObject.hpp +++ b/src/ArduinoJson/Object/JsonObject.hpp @@ -108,10 +108,10 @@ class JsonObject : public detail::VariantOperators { // Gets or sets the member with specified key. // https://arduinojson.org/v6/api/jsonobject/subscript/ template - FORCE_INLINE typename detail::enable_if< - detail::IsString::value, - detail::MemberProxy >::type - operator[](const TString& key) const { + FORCE_INLINE + typename detail::enable_if::value, + detail::MemberProxy>::type + operator[](const TString& key) const { return {*this, key}; } @@ -120,7 +120,7 @@ class JsonObject : public detail::VariantOperators { template FORCE_INLINE typename detail::enable_if::value, - detail::MemberProxy >::type + detail::MemberProxy>::type operator[](TChar* key) const { return {*this, key}; } diff --git a/src/ArduinoJson/Object/JsonObjectImpl.hpp b/src/ArduinoJson/Object/JsonObjectImpl.hpp index 5b32c631..3b24081a 100644 --- a/src/ArduinoJson/Object/JsonObjectImpl.hpp +++ b/src/ArduinoJson/Object/JsonObjectImpl.hpp @@ -69,7 +69,7 @@ VariantRefBase::containsKey(TChar* key) const { template template inline typename enable_if::value, - MemberProxy >::type + MemberProxy>::type VariantRefBase::operator[](TString* key) const { return MemberProxy(derived(), key); } @@ -77,7 +77,7 @@ VariantRefBase::operator[](TString* key) const { template template inline typename enable_if::value, - MemberProxy >::type + MemberProxy>::type VariantRefBase::operator[](const TString& key) const { return MemberProxy(derived(), key); } diff --git a/src/ArduinoJson/Object/MemberProxy.hpp b/src/ArduinoJson/Object/MemberProxy.hpp index 99970003..6d397db7 100644 --- a/src/ArduinoJson/Object/MemberProxy.hpp +++ b/src/ArduinoJson/Object/MemberProxy.hpp @@ -12,8 +12,8 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE // https://arduinojson.org/v6/api/jsonobject/subscript/ template class MemberProxy - : public VariantRefBase >, - public VariantOperators > { + : public VariantRefBase>, + public VariantOperators> { friend class VariantAttorney; public: diff --git a/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp b/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp index 71e42f1d..89440cc0 100644 --- a/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp +++ b/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp @@ -9,7 +9,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <> -class Writer< ::String, void> { +class Writer<::String, void> { static const size_t bufferCapacity = ARDUINOJSON_STRING_BUFFER_SIZE; public: diff --git a/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp b/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp index e5f22fa4..e4da4221 100644 --- a/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp +++ b/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp @@ -11,7 +11,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template class Writer< TDestination, - typename enable_if::value>::type> { + typename enable_if::value>::type> { public: explicit Writer(::Print& print) : _print(&print) {} diff --git a/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp b/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp index 3d92d825..96996b2b 100644 --- a/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp +++ b/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp @@ -15,7 +15,7 @@ template struct is_std_string : false_type {}; template -struct is_std_string > +struct is_std_string> : true_type {}; template diff --git a/src/ArduinoJson/Variant/ConverterImpl.hpp b/src/ArduinoJson/Variant/ConverterImpl.hpp index ebba227f..f5e1d046 100644 --- a/src/ArduinoJson/Variant/ConverterImpl.hpp +++ b/src/ArduinoJson/Variant/ConverterImpl.hpp @@ -161,7 +161,7 @@ convertToJson(const T& src, JsonVariant dst) { } template <> -struct Converter > +struct Converter> : private detail::VariantAttorney { static void toJson(SerializedValue src, JsonVariant dst) { auto data = getData(dst); diff --git a/src/ArduinoJson/Variant/VariantRefBase.hpp b/src/ArduinoJson/Variant/VariantRefBase.hpp index c0bd9051..2afdda6a 100644 --- a/src/ArduinoJson/Variant/VariantRefBase.hpp +++ b/src/ArduinoJson/Variant/VariantRefBase.hpp @@ -234,14 +234,14 @@ class VariantRefBase : public VariantTag { // https://arduinojson.org/v6/api/jsonvariant/subscript/ template FORCE_INLINE typename enable_if::value, - MemberProxy >::type + MemberProxy>::type operator[](const TString& key) const; // Gets or sets an object member. // https://arduinojson.org/v6/api/jsonvariant/subscript/ template FORCE_INLINE typename enable_if::value, - MemberProxy >::type + MemberProxy>::type operator[](TChar* key) const; // Creates an array and adds it to the object.