mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 08:48:30 +01:00
Reduced memory consumption by not duplicating spaces and comments
This commit is contained in:
@@ -13,24 +13,29 @@ namespace Internals {
|
||||
// Parse JSON string to create JsonArrays and JsonObjects
|
||||
// This internal class is not indended to be used directly.
|
||||
// Instead, use JsonBuffer.parseArray() or .parseObject()
|
||||
template <typename TIterator>
|
||||
class StringReader {
|
||||
TIterator _input;
|
||||
char _current, _next;
|
||||
|
||||
public:
|
||||
StringReader(const char *input) : _ptr(input ? input : "") {}
|
||||
|
||||
void skip() {
|
||||
_ptr++;
|
||||
StringReader(const TIterator& input) : _input(input) {
|
||||
_current = _input.next();
|
||||
_next = _input.next();
|
||||
}
|
||||
|
||||
char peek() const {
|
||||
return _ptr[0];
|
||||
void move() {
|
||||
_current = _next;
|
||||
_next = _input.next();
|
||||
}
|
||||
|
||||
char peekNext() const {
|
||||
return _ptr[1];
|
||||
char current() const {
|
||||
return _current;
|
||||
}
|
||||
|
||||
private:
|
||||
const char *_ptr;
|
||||
char next() const {
|
||||
return _next;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user