Moved JsonBuffer to Memory/

This commit is contained in:
Benoit Blanchon
2018-03-15 09:56:00 +01:00
parent ef55a6ba7c
commit cf149940ed
18 changed files with 28 additions and 34 deletions

View File

@ -5,11 +5,9 @@
#pragma once #pragma once
#include "ArduinoJson/DynamicJsonArray.hpp" #include "ArduinoJson/DynamicJsonArray.hpp"
#include "ArduinoJson/DynamicJsonBuffer.hpp"
#include "ArduinoJson/DynamicJsonObject.hpp" #include "ArduinoJson/DynamicJsonObject.hpp"
#include "ArduinoJson/DynamicJsonVariant.hpp" #include "ArduinoJson/DynamicJsonVariant.hpp"
#include "ArduinoJson/StaticJsonArray.hpp" #include "ArduinoJson/StaticJsonArray.hpp"
#include "ArduinoJson/StaticJsonBuffer.hpp"
#include "ArduinoJson/StaticJsonObject.hpp" #include "ArduinoJson/StaticJsonObject.hpp"
#include "ArduinoJson/StaticJsonVariant.hpp" #include "ArduinoJson/StaticJsonVariant.hpp"
#include "ArduinoJson/deserializeJson.hpp" #include "ArduinoJson/deserializeJson.hpp"

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "../JsonBuffer.hpp" #include "../Memory/JsonBuffer.hpp"
#include "ListConstIterator.hpp" #include "ListConstIterator.hpp"
#include "ListIterator.hpp" #include "ListIterator.hpp"

View File

@ -6,7 +6,7 @@
#include <stddef.h> // for NULL #include <stddef.h> // for NULL
#include "JsonBufferAllocated.hpp" #include "../Memory/JsonBufferAllocated.hpp"
namespace ArduinoJson { namespace ArduinoJson {
namespace Internals { namespace Internals {
@ -20,5 +20,5 @@ struct ListNode : public Internals::JsonBufferAllocated {
ListNode<T> *next; ListNode<T> *next;
T content; T content;
}; };
} } // namespace Internals
} } // namespace ArduinoJson

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include "../JsonBuffer.hpp"
#include "../JsonVariant.hpp" #include "../JsonVariant.hpp"
#include "../Memory/JsonBuffer.hpp"
#include "../StringTraits/StringTraits.hpp" #include "../StringTraits/StringTraits.hpp"
#include "../TypeTraits/EnableIf.hpp" #include "../TypeTraits/EnableIf.hpp"
@ -48,5 +48,5 @@ struct ValueSaver<
return true; return true;
} }
}; };
} } // namespace Internals
} } // namespace ArduinoJson

View File

@ -4,9 +4,9 @@
#pragma once #pragma once
#include "../JsonBuffer.hpp"
#include "../JsonError.hpp" #include "../JsonError.hpp"
#include "../JsonVariant.hpp" #include "../JsonVariant.hpp"
#include "../Memory/JsonBuffer.hpp"
#include "../TypeTraits/IsConst.hpp" #include "../TypeTraits/IsConst.hpp"
#include "StringWriter.hpp" #include "StringWriter.hpp"

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include "DynamicJsonBuffer.hpp"
#include "JsonArray.hpp" #include "JsonArray.hpp"
#include "Memory/DynamicJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {
class DynamicJsonArray : public JsonArray { class DynamicJsonArray : public JsonArray {

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include "DynamicJsonBuffer.hpp"
#include "JsonObject.hpp" #include "JsonObject.hpp"
#include "Memory/DynamicJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {
class DynamicJsonObject : public JsonObject { class DynamicJsonObject : public JsonObject {

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include "DynamicJsonBuffer.hpp"
#include "JsonVariant.hpp" #include "JsonVariant.hpp"
#include "Memory/DynamicJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {

View File

@ -4,11 +4,11 @@
#pragma once #pragma once
#include "Data/JsonBufferAllocated.hpp"
#include "Data/List.hpp" #include "Data/List.hpp"
#include "Data/ReferenceType.hpp" #include "Data/ReferenceType.hpp"
#include "Data/ValueSaver.hpp" #include "Data/ValueSaver.hpp"
#include "JsonVariant.hpp" #include "JsonVariant.hpp"
#include "Memory/JsonBufferAllocated.hpp"
#include "StringTraits/StringTraits.hpp" #include "StringTraits/StringTraits.hpp"
#include "TypeTraits/EnableIf.hpp" #include "TypeTraits/EnableIf.hpp"
#include "TypeTraits/IsArray.hpp" #include "TypeTraits/IsArray.hpp"
@ -34,7 +34,7 @@ class JsonArray : public Internals::ReferenceType,
public Internals::List<JsonVariant>, public Internals::List<JsonVariant>,
public Internals::JsonBufferAllocated { public Internals::JsonBufferAllocated {
public: public:
explicit JsonArray(JsonBuffer *buf) throw() explicit JsonArray(Internals::JsonBuffer *buf) throw()
: Internals::List<JsonVariant>(buf) {} : Internals::List<JsonVariant>(buf) {}
// Gets the value at the specified index // Gets the value at the specified index

View File

@ -4,11 +4,11 @@
#pragma once #pragma once
#include "Data/JsonBufferAllocated.hpp"
#include "Data/List.hpp" #include "Data/List.hpp"
#include "Data/ReferenceType.hpp" #include "Data/ReferenceType.hpp"
#include "Data/ValueSaver.hpp" #include "Data/ValueSaver.hpp"
#include "JsonPair.hpp" #include "JsonPair.hpp"
#include "Memory/JsonBufferAllocated.hpp"
#include "StringTraits/StringTraits.hpp" #include "StringTraits/StringTraits.hpp"
#include "TypeTraits/EnableIf.hpp" #include "TypeTraits/EnableIf.hpp"
#include "TypeTraits/IsArray.hpp" #include "TypeTraits/IsArray.hpp"
@ -37,7 +37,7 @@ class JsonObject : public Internals::ReferenceType,
public: public:
// Create an empty JsonArray attached to the specified JsonBuffer. // Create an empty JsonArray attached to the specified JsonBuffer.
// You should not use this constructor directly. // You should not use this constructor directly.
explicit JsonObject(JsonBuffer* buf) throw() explicit JsonObject(Internals::JsonBuffer* buf) throw()
: Internals::List<JsonPair>(buf) {} : Internals::List<JsonPair>(buf) {}
// Gets or sets the value associated with the specified key. // Gets or sets the value associated with the specified key.

View File

@ -8,21 +8,16 @@
#include <stdint.h> // for uint8_t #include <stdint.h> // for uint8_t
#include <string.h> #include <string.h>
#include "Data/NonCopyable.hpp" #include "../Configuration.hpp"
#include "JsonVariant.hpp" #include "../Polyfills/NonCopyable.hpp"
#include "TypeTraits/EnableIf.hpp" #include "../Polyfills/attributes.hpp"
#include "TypeTraits/IsArray.hpp"
namespace ArduinoJson { namespace ArduinoJson {
class JsonArray; namespace Internals {
class JsonObject;
// Entry point for using the library.
//
// Handle the memory management (done in derived classes) and calls the parser. // Handle the memory management (done in derived classes) and calls the parser.
// This abstract class is implemented by StaticJsonBuffer which implements a // This abstract class is implemented by StaticJsonBuffer which implements a
// fixed memory allocation. // fixed memory allocation.
class JsonBuffer : Internals::NonCopyable { class JsonBuffer : NonCopyable {
public: public:
// Allocates n bytes in the JsonBuffer. // Allocates n bytes in the JsonBuffer.
// Return a pointer to the allocated memory or NULL if allocation fails. // Return a pointer to the allocated memory or NULL if allocation fails.
@ -44,4 +39,5 @@ class JsonBuffer : Internals::NonCopyable {
#endif #endif
} }
}; };
} // namespace Internals
} // namespace ArduinoJson } // namespace ArduinoJson

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "../JsonBuffer.hpp" #include "JsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {
namespace Internals { namespace Internals {
@ -18,5 +18,5 @@ class JsonBufferAllocated {
void operator delete(void *, JsonBuffer *)throw(); void operator delete(void *, JsonBuffer *)throw();
}; };
} } // namespace Internals
} } // namespace ArduinoJson

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include "../TypeTraits/Max.hpp"
#include "JsonBuffer.hpp" #include "JsonBuffer.hpp"
#include "TypeTraits/Max.hpp"
namespace ArduinoJson { namespace ArduinoJson {
namespace Internals { namespace Internals {

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include "JsonArray.hpp" #include "JsonArray.hpp"
#include "StaticJsonBuffer.hpp" #include "Memory/StaticJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include "JsonObject.hpp" #include "JsonObject.hpp"
#include "StaticJsonBuffer.hpp" #include "Memory/StaticJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include "JsonVariant.hpp" #include "JsonVariant.hpp"
#include "StaticJsonBuffer.hpp" #include "Memory/StaticJsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {