mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
Removed Print class and converted printTo() to a template method (issue #276)
This commit is contained in:
@@ -11,22 +11,25 @@
|
||||
|
||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||
|
||||
#include "../Print.hpp"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace ArduinoJson {
|
||||
namespace Internals {
|
||||
|
||||
class StreamPrintAdapter : public Print {
|
||||
class StreamPrintAdapter {
|
||||
public:
|
||||
explicit StreamPrintAdapter(std::ostream& os) : _os(os) {}
|
||||
|
||||
virtual size_t write(uint8_t c) {
|
||||
_os << static_cast<char>(c);
|
||||
size_t print(char c) {
|
||||
_os << c;
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t print(const char* s) {
|
||||
_os << s;
|
||||
return strlen(s);
|
||||
}
|
||||
|
||||
private:
|
||||
// cannot be assigned
|
||||
StreamPrintAdapter& operator=(const StreamPrintAdapter&);
|
||||
|
||||
Reference in New Issue
Block a user