forked from bblanchon/ArduinoJson
Added a header to simplify library usage
This commit is contained in:
@ -28,19 +28,6 @@ Assuming you installed the library into `<arduino-json>`, you need to add:
|
||||
1. `<arduino-json>/include` to your include path
|
||||
2. `<arduino-json>/lib` to your library path
|
||||
|
||||
## Headers
|
||||
|
||||
The following headers are required:
|
||||
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
## 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;
|
||||
|
||||
----------
|
||||
|
||||
|
11
include/ArduinoJson.h
Normal file
11
include/ArduinoJson.h
Normal file
@ -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;
|
@ -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"
|
||||
|
@ -5,13 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson.h>
|
||||
#include "Printers.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
|
||||
class GbathreeBug : public testing::Test {
|
||||
public:
|
||||
GbathreeBug() : object(buffer.parseObject(getJson())) {}
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class IntegrationTests : public testing::TestWithParam<const char*> {
|
||||
static const size_t MAX_JSON_SIZE = 10000;
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
struct Person {
|
||||
int id;
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonArray_Container_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -5,10 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
TEST(JsonArray_Iterator_Test, SimpleTest) {
|
||||
StaticJsonBuffer<100> jsonBuffer;
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonArray_PrettyPrintTo_Tests : public testing::Test {
|
||||
public:
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonArray_PrintTo_Tests : public testing::Test {
|
||||
public:
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonObject_Container_Tests : public ::testing::Test {
|
||||
public:
|
||||
|
@ -5,12 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson.h>
|
||||
#include "Printers.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
|
||||
class JsonObject_Iterator_Test : public testing::Test {
|
||||
public:
|
||||
JsonObject_Iterator_Test() : object(_buffer.createObject()) {
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonObject_PrettyPrintTo_Tests : public testing::Test {
|
||||
public:
|
||||
|
@ -5,11 +5,8 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
using namespace ArduinoJson::Internals;
|
||||
|
||||
class JsonObject_PrintTo_Tests : public testing::Test {
|
||||
|
@ -5,10 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonParser_Array_Tests : public testing::Test {
|
||||
protected:
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
TEST(JsonParser_Nested_Tests, ArrayNestedInObject) {
|
||||
StaticJsonBuffer<256> jsonBuffer;
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonParser_NestingLimit_Tests : public testing::Test {
|
||||
protected:
|
||||
|
@ -5,10 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonParser_Object_Test : public testing::Test {
|
||||
protected:
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonVariant_Copy_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -5,12 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson.h>
|
||||
#include "Printers.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
|
||||
class JsonVariant_Invalid_Tests : public ::testing::Test {
|
||||
public:
|
||||
JsonVariant_Invalid_Tests() : variant(JsonVariant::invalid()) {}
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonVariant_Storage_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -5,11 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonVariant_Subscript_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -5,12 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson.h>
|
||||
#include "Printers.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
|
||||
class JsonVariant_Undefined_Tests : public ::testing::Test {
|
||||
protected:
|
||||
JsonVariant variant;
|
||||
|
@ -5,10 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonArray.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
TEST(StaticJsonBuffer_Array_Tests, GrowsWithArray) {
|
||||
StaticJsonBuffer<JSON_ARRAY_SIZE(2)> json;
|
||||
|
@ -5,10 +5,7 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/JsonObject.hpp>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
TEST(StaticJsonBuffer_Object_Tests, GrowsWithObject) {
|
||||
StaticJsonBuffer<JSON_OBJECT_SIZE(3)> json;
|
||||
|
Reference in New Issue
Block a user