Rev | Line | |
---|
[209] | 1 | // Copyright Benoit Blanchon 2014-2016
|
---|
| 2 | // MIT License
|
---|
| 3 | //
|
---|
| 4 | // Arduino JSON library
|
---|
| 5 | // https://github.com/bblanchon/ArduinoJson
|
---|
| 6 | // If you like this project, please add a star!
|
---|
| 7 |
|
---|
| 8 | #pragma once
|
---|
| 9 |
|
---|
| 10 | #include "../Arduino/Print.hpp"
|
---|
| 11 |
|
---|
| 12 | namespace ArduinoJson {
|
---|
| 13 | namespace Internals {
|
---|
| 14 |
|
---|
| 15 | // A Print implementation that allows to write in a char[]
|
---|
| 16 | class StaticStringBuilder : public Print {
|
---|
| 17 | public:
|
---|
| 18 | StaticStringBuilder(char *buf, size_t size)
|
---|
| 19 | : buffer(buf), capacity(size - 1), length(0) {
|
---|
| 20 | buffer[0] = '\0';
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | virtual size_t write(uint8_t c);
|
---|
| 24 |
|
---|
| 25 | private:
|
---|
| 26 | char *buffer;
|
---|
| 27 | size_t capacity;
|
---|
| 28 | size_t length;
|
---|
| 29 | };
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.