Minh Nguyen / ArduinoJson
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PrintWriter.hpp Source File

PrintWriter.hpp

00001 // ArduinoJson - arduinojson.org
00002 // Copyright Benoit Blanchon 2014-2021
00003 // MIT License
00004 
00005 #pragma once
00006 
00007 namespace ARDUINOJSON_NAMESPACE {
00008 
00009 template <typename TDestination>
00010 class Writer<
00011     TDestination,
00012     typename enable_if<is_base_of< ::Print, TDestination>::value>::type> {
00013  public:
00014   explicit Writer(::Print& print) : _print(&print) {}
00015 
00016   size_t write(uint8_t c) {
00017     return _print->write(c);
00018   }
00019 
00020   size_t write(const uint8_t* s, size_t n) {
00021     return _print->write(s, n);
00022   }
00023 
00024  private:
00025   ::Print* _print;
00026 };
00027 
00028 }  // namespace ARDUINOJSON_NAMESPACE