mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 00:38:26 +01:00
Fixed "no matching function for call to write(uint8_t)" (closes #972)
This commit is contained in:
@@ -14,32 +14,38 @@
|
||||
namespace ARDUINOJSON_NAMESPACE {
|
||||
|
||||
template <template <typename> class TSerializer, typename TSource,
|
||||
typename TPrint>
|
||||
typename enable_if<!IsWriteableString<TPrint>::value, size_t>::type serialize(
|
||||
const TSource &source, TPrint &destination) {
|
||||
TSerializer<TPrint> serializer(destination);
|
||||
typename TDestination>
|
||||
size_t doSerialize(const TSource &source, TDestination &destination) {
|
||||
TSerializer<TDestination> serializer(destination);
|
||||
source.accept(serializer);
|
||||
return serializer.bytesWritten();
|
||||
}
|
||||
|
||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||
template <template <typename> class TSerializer, typename TSource>
|
||||
size_t serialize(const TSource &source, std::ostream &os) {
|
||||
StreamWriter writer(os);
|
||||
return serialize<TSerializer>(source, writer);
|
||||
size_t serialize(const TSource &source, std::ostream &destination) {
|
||||
StreamWriter writer(destination);
|
||||
return doSerialize<TSerializer>(source, writer);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ARDUINOJSON_ENABLE_ARDUINO_PRINT
|
||||
template <template <typename> class TSerializer, typename TSource>
|
||||
size_t serialize(const TSource &source, Print &destination) {
|
||||
return doSerialize<TSerializer>(source, destination);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <template <typename> class TSerializer, typename TSource>
|
||||
size_t serialize(const TSource &source, char *buffer, size_t bufferSize) {
|
||||
StaticStringWriter writer(buffer, bufferSize);
|
||||
return serialize<TSerializer>(source, writer);
|
||||
return doSerialize<TSerializer>(source, writer);
|
||||
}
|
||||
|
||||
template <template <typename> class TSerializer, typename TSource, size_t N>
|
||||
size_t serialize(const TSource &source, char (&buffer)[N]) {
|
||||
StaticStringWriter writer(buffer, N);
|
||||
return serialize<TSerializer>(source, writer);
|
||||
return doSerialize<TSerializer>(source, writer);
|
||||
}
|
||||
|
||||
template <template <typename> class TSerializer, typename TSource,
|
||||
@@ -47,7 +53,7 @@ template <template <typename> class TSerializer, typename TSource,
|
||||
typename enable_if<IsWriteableString<TString>::value, size_t>::type serialize(
|
||||
const TSource &source, TString &str) {
|
||||
DynamicStringWriter<TString> writer(str);
|
||||
return serialize<TSerializer>(source, writer);
|
||||
return doSerialize<TSerializer>(source, writer);
|
||||
}
|
||||
|
||||
} // namespace ARDUINOJSON_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user