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 "../Configuration.hpp"
|
---|
| 11 |
|
---|
| 12 | #if ARDUINOJSON_ENABLE_STD_STREAM
|
---|
| 13 |
|
---|
| 14 | #include "../Arduino/Print.hpp"
|
---|
| 15 |
|
---|
| 16 | #include <ostream>
|
---|
| 17 |
|
---|
| 18 | namespace ArduinoJson {
|
---|
| 19 | namespace Internals {
|
---|
| 20 |
|
---|
| 21 | class StreamPrintAdapter : public Print {
|
---|
| 22 | public:
|
---|
| 23 | explicit StreamPrintAdapter(std::ostream& os) : _os(os) {}
|
---|
| 24 |
|
---|
| 25 | virtual size_t write(uint8_t c) {
|
---|
| 26 | _os << static_cast<char>(c);
|
---|
| 27 | return 1;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | private:
|
---|
| 31 | // cannot be assigned
|
---|
| 32 | StreamPrintAdapter& operator=(const StreamPrintAdapter&);
|
---|
| 33 |
|
---|
| 34 | std::ostream& _os;
|
---|
| 35 | };
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | #endif // ARDUINOJSON_ENABLE_STD_STREAM
|
---|
Note:
See
TracBrowser
for help on using the repository browser.