Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
serialize.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 #include <ArduinoJson/Serialization/Writer.hpp> 00008 00009 namespace ARDUINOJSON_NAMESPACE { 00010 00011 template <template <typename> class TSerializer, typename TSource, 00012 typename TWriter> 00013 size_t doSerialize(const TSource &source, TWriter writer) { 00014 TSerializer<TWriter> serializer(writer); 00015 return source.accept(serializer); 00016 } 00017 00018 template <template <typename> class TSerializer, typename TSource, 00019 typename TDestination> 00020 size_t serialize(const TSource &source, TDestination &destination) { 00021 Writer<TDestination> writer(destination); 00022 return doSerialize<TSerializer>(source, writer); 00023 } 00024 00025 template <template <typename> class TSerializer, typename TSource> 00026 size_t serialize(const TSource &source, void *buffer, size_t bufferSize) { 00027 StaticStringWriter writer(reinterpret_cast<char *>(buffer), bufferSize); 00028 return doSerialize<TSerializer>(source, writer); 00029 } 00030 00031 template <template <typename> class TSerializer, typename TSource, 00032 typename TChar, size_t N> 00033 #if defined _MSC_VER && _MSC_VER < 1900 00034 typename enable_if<sizeof(remove_reference<TChar>::type) == 1, size_t>::type 00035 #else 00036 typename enable_if<sizeof(TChar) == 1, size_t>::type 00037 #endif 00038 serialize(const TSource &source, TChar (&buffer)[N]) { 00039 StaticStringWriter writer(reinterpret_cast<char *>(buffer), N); 00040 return doSerialize<TSerializer>(source, writer); 00041 } 00042 00043 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2