Files
thirdparty-ArduinoJson/include/ArduinoJson/Internals/JsonWriter.hpp
2014-11-03 12:51:24 +01:00

35 lines
683 B
C++

// Copyright Benoit Blanchon 2014
// MIT License
//
// Arduino JSON library
// https://github.com/bblanchon/ArduinoJson
#pragma once
#include "../Arduino/Print.hpp"
namespace ArduinoJson {
namespace Internals {
class JsonWriter {
public:
explicit JsonWriter(Print *sink) : _sink(sink), _length(0) {}
size_t bytesWritten() { return _length; }
void writeEmptyArray() { _length += _sink->print("[]"); }
void writeEmptyObject() { _length += _sink->print("{}"); }
void writeString(const char *value);
void writeInteger(long value);
void writeBoolean(bool value);
void writeDouble(double value, int decimals);
protected:
Print *_sink;
size_t _length;
};
}
}