Huge refactoring in progress...

This commit is contained in:
Benoit Blanchon
2014-10-30 14:03:33 +01:00
parent c3001e9ea9
commit 4c204840e9
25 changed files with 108 additions and 79 deletions

View File

@@ -10,6 +10,7 @@
namespace ArduinoJson {
namespace Internals {
class CompactJsonWriter : public JsonWriter {
public:
explicit CompactJsonWriter(Print *sink) : JsonWriter(sink) {}

View File

@@ -14,16 +14,10 @@ namespace Internals {
class JsonArrayNode {
public:
static JsonArrayNode* createFrom(JsonBuffer* buffer) {
void* ptr = buffer->alloc(sizeof(JsonArrayNode));
return ptr ? new (ptr) JsonArrayNode() : NULL;
}
JsonArrayNode() : next(0) {}
JsonArrayNode* next;
JsonValue value;
private:
JsonArrayNode() : next(0) {}
};
}
}

View File

@@ -14,16 +14,10 @@ namespace Internals {
class JsonObjectNode {
public:
static JsonObjectNode* createFrom(JsonBuffer* buffer, const char* key) {
void* ptr = buffer->alloc(sizeof(JsonObjectNode));
return ptr ? new (ptr) JsonObjectNode(key) : NULL;
}
JsonObjectNode(const char* k) : pair(k), next(NULL) {}
JsonPair pair;
JsonObjectNode* next;
private:
JsonObjectNode(const char* k) : pair(k), next(NULL) {}
};
}
}

View File

@@ -23,4 +23,4 @@ class JsonSerializer {
JsonWriter &_writer;
};
}
}
}

View File

@@ -10,6 +10,7 @@
namespace ArduinoJson {
namespace Internals {
class JsonWriter {
public:
explicit JsonWriter(Print *sink) : _sink(sink), _length(0) {}

View File

@@ -11,6 +11,7 @@
namespace ArduinoJson {
namespace Internals {
class PrettyJsonWriter : public JsonWriter {
public:
explicit PrettyJsonWriter(IndentedPrint *sink)

View File

@@ -10,10 +10,10 @@
namespace ArduinoJson {
namespace Internals {
class QuotedString {
public:
static size_t printTo(const char *, Print *);
static char *extractFrom(char *input, char **end);
};
}