-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of non standard JSON input (issue #44)
- Loading branch information
Showing
30 changed files
with
405 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/build | ||
/bin | ||
/lib | ||
/sftp-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright Benoit Blanchon 2014-2015 | ||
// MIT License | ||
// | ||
// Arduino JSON library | ||
// https://github.com/bblanchon/ArduinoJson | ||
|
||
#pragma once | ||
|
||
#include "../Arduino/Print.hpp" | ||
|
||
namespace ArduinoJson { | ||
namespace Internals { | ||
|
||
class Encoding { | ||
public: | ||
// Optimized for code size on a 8-bit AVR | ||
static char escapeChar(char c) { | ||
const char *p = _escapeTable; | ||
while (p[0] && p[1] != c) { | ||
p += 2; | ||
} | ||
return p[0]; | ||
} | ||
|
||
// Optimized for code size on a 8-bit AVR | ||
static char unescapeChar(char c) { | ||
const char *p = _escapeTable + 4; | ||
for (;;) { | ||
if (p[0] == '\0') return c; | ||
if (p[0] == c) return p[1]; | ||
p += 2; | ||
} | ||
} | ||
|
||
private: | ||
static const char _escapeTable[]; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright Benoit Blanchon 2014-2015 | ||
// MIT License | ||
// | ||
// Arduino JSON library | ||
// https://github.com/bblanchon/ArduinoJson | ||
|
||
#pragma once | ||
|
||
#ifdef ARDUINOJSON_ENABLE_STD_STREAM | ||
|
||
#include "../Arduino/Print.hpp" | ||
|
||
namespace ArduinoJson { | ||
namespace Internals { | ||
|
||
class StreamPrintAdapter : public Print { | ||
public: | ||
explicit StreamPrintAdapter(std::ostream& os) : _os(os) {} | ||
|
||
virtual size_t write(uint8_t c) { | ||
_os << static_cast<char>(c); | ||
return 1; | ||
} | ||
|
||
private: | ||
// cannot be assigned | ||
StreamPrintAdapter& operator=(const StreamPrintAdapter&); | ||
|
||
std::ostream& _os; | ||
}; | ||
} | ||
} | ||
|
||
#endif // ARDUINOJSON_ENABLE_STD_STREAM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright Benoit Blanchon 2014-2015 | ||
// MIT License | ||
// | ||
// Arduino JSON library | ||
// https://github.com/bblanchon/ArduinoJson | ||
|
||
#include "../../include/ArduinoJson/Internals/Encoding.hpp" | ||
|
||
// How to escape special chars: | ||
// _escapeTable[2*i+1] => the special char | ||
// _escapeTable[2*i] => the char to use instead | ||
const char ArduinoJson::Internals::Encoding::_escapeTable[] = "\"\"\\\\b\bf\fn\nr\rt\t"; |
Oops, something went wrong.