diff --git a/doc/Using the library without Arduino.md b/doc/Using the library without Arduino.md index a9cc4170..3fbb4043 100644 --- a/doc/Using the library without Arduino.md +++ b/doc/Using the library without Arduino.md @@ -28,19 +28,6 @@ Assuming you installed the library into ``, you need to add: 1. `/include` to your include path 2. `/lib` to your library path -## Headers - -The following headers are required: - - #include - #include - #include - -## Namespace - -Every class of the library is declared in the `ArduinoJson` namespace, so you may want to add the following line after the `#include` statements: - - using namespace ArduinoJson; ---------- diff --git a/include/ArduinoJson.h b/include/ArduinoJson.h new file mode 100644 index 00000000..d02a1739 --- /dev/null +++ b/include/ArduinoJson.h @@ -0,0 +1,11 @@ +// Copyright Benoit Blanchon 2014 +// MIT License +// +// Arduino JSON library +// https://github.com/bblanchon/ArduinoJson + +#include "../include/ArduinoJson/JsonArray.hpp" +#include "../include/ArduinoJson/JsonObject.hpp" +#include "../include/ArduinoJson/StaticJsonBuffer.hpp" + +using namespace ArduinoJson; diff --git a/src/ArduinoJson.h b/src/ArduinoJson.h index 20ad9ae6..2fa636fd 100644 --- a/src/ArduinoJson.h +++ b/src/ArduinoJson.h @@ -10,8 +10,4 @@ // for the IDE to find it. Feel free to ignore this file if your working in // another environment -#include "../include/ArduinoJson/JsonArray.hpp" -#include "../include/ArduinoJson/JsonObject.hpp" -#include "../include/ArduinoJson/StaticJsonBuffer.hpp" - -using namespace ArduinoJson; +#include "../include/ArduinoJson.h" diff --git a/test/GbathreeBug.cpp b/test/GbathreeBug.cpp index 85656b8b..e5f1173c 100644 --- a/test/GbathreeBug.cpp +++ b/test/GbathreeBug.cpp @@ -5,13 +5,9 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include +#include #include "Printers.hpp" -using namespace ArduinoJson; - class GbathreeBug : public testing::Test { public: GbathreeBug() : object(buffer.parseObject(getJson())) {} diff --git a/test/IntegrationTests.cpp b/test/IntegrationTests.cpp index 908e8430..181819c5 100644 --- a/test/IntegrationTests.cpp +++ b/test/IntegrationTests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class IntegrationTests : public testing::TestWithParam { static const size_t MAX_JSON_SIZE = 10000; diff --git a/test/Issue10.cpp b/test/Issue10.cpp index 2c00b342..a8811aeb 100644 --- a/test/Issue10.cpp +++ b/test/Issue10.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include struct Person { int id; diff --git a/test/JsonArray_Container_Tests.cpp b/test/JsonArray_Container_Tests.cpp index 268bb6a5..de7cea94 100644 --- a/test/JsonArray_Container_Tests.cpp +++ b/test/JsonArray_Container_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonArray_Container_Tests : public ::testing::Test { protected: diff --git a/test/JsonArray_Iterator_Tests.cpp b/test/JsonArray_Iterator_Tests.cpp index 009586d8..7ea75427 100644 --- a/test/JsonArray_Iterator_Tests.cpp +++ b/test/JsonArray_Iterator_Tests.cpp @@ -5,10 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include - -using namespace ArduinoJson; +#include TEST(JsonArray_Iterator_Test, SimpleTest) { StaticJsonBuffer<100> jsonBuffer; diff --git a/test/JsonArray_PrettyPrintTo_Tests.cpp b/test/JsonArray_PrettyPrintTo_Tests.cpp index 9cf7260a..e7a57238 100644 --- a/test/JsonArray_PrettyPrintTo_Tests.cpp +++ b/test/JsonArray_PrettyPrintTo_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonArray_PrettyPrintTo_Tests : public testing::Test { public: diff --git a/test/JsonArray_PrintTo_Tests.cpp b/test/JsonArray_PrintTo_Tests.cpp index 12bc995b..946d5ab6 100644 --- a/test/JsonArray_PrintTo_Tests.cpp +++ b/test/JsonArray_PrintTo_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonArray_PrintTo_Tests : public testing::Test { public: diff --git a/test/JsonObject_Container_Tests.cpp b/test/JsonObject_Container_Tests.cpp index 24a3893e..71abeef6 100644 --- a/test/JsonObject_Container_Tests.cpp +++ b/test/JsonObject_Container_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonObject_Container_Tests : public ::testing::Test { public: diff --git a/test/JsonObject_Iterator_Tests.cpp b/test/JsonObject_Iterator_Tests.cpp index 74e42286..26fe90dd 100644 --- a/test/JsonObject_Iterator_Tests.cpp +++ b/test/JsonObject_Iterator_Tests.cpp @@ -5,12 +5,9 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include +#include #include "Printers.hpp" -using namespace ArduinoJson; - class JsonObject_Iterator_Test : public testing::Test { public: JsonObject_Iterator_Test() : object(_buffer.createObject()) { diff --git a/test/JsonObject_PrettyPrintTo_Tests.cpp b/test/JsonObject_PrettyPrintTo_Tests.cpp index a06fae5f..a871ffb6 100644 --- a/test/JsonObject_PrettyPrintTo_Tests.cpp +++ b/test/JsonObject_PrettyPrintTo_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonObject_PrettyPrintTo_Tests : public testing::Test { public: diff --git a/test/JsonObject_PrintTo_Tests.cpp b/test/JsonObject_PrintTo_Tests.cpp index 207b6448..f8ce2fd0 100644 --- a/test/JsonObject_PrintTo_Tests.cpp +++ b/test/JsonObject_PrintTo_Tests.cpp @@ -5,11 +5,8 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include +#include -using namespace ArduinoJson; using namespace ArduinoJson::Internals; class JsonObject_PrintTo_Tests : public testing::Test { diff --git a/test/JsonParser_Array_Tests.cpp b/test/JsonParser_Array_Tests.cpp index 01d2e767..3ea288d1 100644 --- a/test/JsonParser_Array_Tests.cpp +++ b/test/JsonParser_Array_Tests.cpp @@ -5,10 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include - -using namespace ArduinoJson; +#include class JsonParser_Array_Tests : public testing::Test { protected: diff --git a/test/JsonParser_Nested_Tests.cpp b/test/JsonParser_Nested_Tests.cpp index a50d437e..af125127 100644 --- a/test/JsonParser_Nested_Tests.cpp +++ b/test/JsonParser_Nested_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include TEST(JsonParser_Nested_Tests, ArrayNestedInObject) { StaticJsonBuffer<256> jsonBuffer; diff --git a/test/JsonParser_NestingLimit_Tests.cpp b/test/JsonParser_NestingLimit_Tests.cpp index a5ddcfc2..04278efb 100644 --- a/test/JsonParser_NestingLimit_Tests.cpp +++ b/test/JsonParser_NestingLimit_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonParser_NestingLimit_Tests : public testing::Test { protected: diff --git a/test/JsonParser_Object_Tests.cpp b/test/JsonParser_Object_Tests.cpp index 11a32243..148d496a 100644 --- a/test/JsonParser_Object_Tests.cpp +++ b/test/JsonParser_Object_Tests.cpp @@ -5,10 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include - -using namespace ArduinoJson; +#include class JsonParser_Object_Test : public testing::Test { protected: diff --git a/test/JsonVariant_Copy_Tests.cpp b/test/JsonVariant_Copy_Tests.cpp index bd5f7f6b..be5364ab 100644 --- a/test/JsonVariant_Copy_Tests.cpp +++ b/test/JsonVariant_Copy_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonVariant_Copy_Tests : public ::testing::Test { protected: diff --git a/test/JsonVariant_Invalid_Tests.cpp b/test/JsonVariant_Invalid_Tests.cpp index 4858b439..b490fd1f 100644 --- a/test/JsonVariant_Invalid_Tests.cpp +++ b/test/JsonVariant_Invalid_Tests.cpp @@ -5,12 +5,9 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include +#include #include "Printers.hpp" -using namespace ArduinoJson; - class JsonVariant_Invalid_Tests : public ::testing::Test { public: JsonVariant_Invalid_Tests() : variant(JsonVariant::invalid()) {} diff --git a/test/JsonVariant_Storage_Tests.cpp b/test/JsonVariant_Storage_Tests.cpp index 68c22370..0c7b6e0e 100644 --- a/test/JsonVariant_Storage_Tests.cpp +++ b/test/JsonVariant_Storage_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonVariant_Storage_Tests : public ::testing::Test { protected: diff --git a/test/JsonVariant_Subscript_Tests.cpp b/test/JsonVariant_Subscript_Tests.cpp index 1c5fcbdc..46edbecf 100644 --- a/test/JsonVariant_Subscript_Tests.cpp +++ b/test/JsonVariant_Subscript_Tests.cpp @@ -5,11 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include -#include - -using namespace ArduinoJson; +#include class JsonVariant_Subscript_Tests : public ::testing::Test { protected: diff --git a/test/JsonVariant_Undefined_Tests.cpp b/test/JsonVariant_Undefined_Tests.cpp index 2082025e..d2538034 100644 --- a/test/JsonVariant_Undefined_Tests.cpp +++ b/test/JsonVariant_Undefined_Tests.cpp @@ -5,12 +5,9 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include +#include #include "Printers.hpp" -using namespace ArduinoJson; - class JsonVariant_Undefined_Tests : public ::testing::Test { protected: JsonVariant variant; diff --git a/test/StaticJsonBuffer_Array_Tests.cpp b/test/StaticJsonBuffer_Array_Tests.cpp index ee59af2d..c6055dae 100644 --- a/test/StaticJsonBuffer_Array_Tests.cpp +++ b/test/StaticJsonBuffer_Array_Tests.cpp @@ -5,10 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include - -using namespace ArduinoJson; +#include TEST(StaticJsonBuffer_Array_Tests, GrowsWithArray) { StaticJsonBuffer json; diff --git a/test/StaticJsonBuffer_Object_Tests.cpp b/test/StaticJsonBuffer_Object_Tests.cpp index 055014ad..b8e1da9c 100644 --- a/test/StaticJsonBuffer_Object_Tests.cpp +++ b/test/StaticJsonBuffer_Object_Tests.cpp @@ -5,10 +5,7 @@ // https://github.com/bblanchon/ArduinoJson #include -#include -#include - -using namespace ArduinoJson; +#include TEST(StaticJsonBuffer_Object_Tests, GrowsWithObject) { StaticJsonBuffer json;