ArduinoJson is now a header-only library (issue #199)

This commit is contained in:
Benoit Blanchon
2016-06-22 21:41:19 +02:00
parent 0801e16327
commit 8c7edbd9c3
52 changed files with 819 additions and 958 deletions

View File

@@ -16,7 +16,7 @@ class Encoding {
public:
// Optimized for code size on a 8-bit AVR
static char escapeChar(char c) {
const char *p = _escapeTable;
const char *p = escapeTable(false);
while (p[0] && p[1] != c) {
p += 2;
}
@@ -25,7 +25,7 @@ class Encoding {
// Optimized for code size on a 8-bit AVR
static char unescapeChar(char c) {
const char *p = _escapeTable + 4;
const char *p = escapeTable(true);
for (;;) {
if (p[0] == '\0') return c;
if (p[0] == c) return p[1];
@@ -34,7 +34,9 @@ class Encoding {
}
private:
static const char _escapeTable[];
static const char *escapeTable(bool excludeIdenticals) {
return &"\"\"\\\\b\bf\fn\nr\rt\t"[excludeIdenticals ? 4 : 0];
}
};
}
}