-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
235 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ArduinoJson - arduinojson.org | ||
// Copyright Benoit Blanchon 2014-2019 | ||
// MIT License | ||
|
||
#pragma once | ||
|
||
#include <ArduinoJson/Namespace.hpp> | ||
|
||
namespace ARDUINOJSON_NAMESPACE { | ||
|
||
// The default writer is a simple wrapper for Writers that are not copiable | ||
template <typename TDestination, typename Enable = void> | ||
class Writer { | ||
public: | ||
explicit Writer(TDestination& dest) : _dest(&dest) {} | ||
|
||
size_t write(uint8_t c) { | ||
return _dest->write(c); | ||
} | ||
|
||
size_t write(const uint8_t* s, size_t n) { | ||
return _dest->write(s, n); | ||
} | ||
|
||
private: | ||
TDestination* _dest; | ||
}; | ||
|
||
} // namespace ARDUINOJSON_NAMESPACE | ||
|
||
#include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp> | ||
|
||
#if ARDUINOJSON_ENABLE_STD_STRING | ||
#include <ArduinoJson/Serialization/Writers/StdStringWriter.hpp> | ||
#endif | ||
|
||
#if ARDUINOJSON_ENABLE_ARDUINO_STRING | ||
#include <ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp> | ||
#endif | ||
|
||
#if ARDUINOJSON_ENABLE_STD_STREAM | ||
#include <ArduinoJson/Serialization/Writers/StdStreamWriter.hpp> | ||
#endif | ||
|
||
#if ARDUINOJSON_ENABLE_ARDUINO_PRINT | ||
#include <ArduinoJson/Serialization/Writers/PrintWriter.hpp> | ||
#endif |
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// ArduinoJson - arduinojson.org | ||
// Copyright Benoit Blanchon 2014-2019 | ||
// MIT License | ||
|
||
#pragma once | ||
|
||
#include <WString.h> | ||
|
||
namespace ARDUINOJSON_NAMESPACE { | ||
|
||
template <> | ||
class Writer< ::String, void> { | ||
public: | ||
explicit Writer(::String &str) : _str(&str) {} | ||
|
||
size_t write(uint8_t c) { | ||
_str->operator+=(static_cast<char>(c)); | ||
return 1; | ||
} | ||
|
||
size_t write(const uint8_t *s, size_t n) { | ||
// CAUTION: Arduino String doesn't have append() | ||
// and old version doesn't have size() either | ||
_str->reserve(_str->length() + n); | ||
while (n > 0) { | ||
_str->operator+=(static_cast<char>(*s++)); | ||
n--; | ||
} | ||
return n; | ||
} | ||
|
||
private: | ||
::String *_str; | ||
}; | ||
|
||
} // namespace ARDUINOJSON_NAMESPACE |
File renamed without changes.
Oops, something went wrong.