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.
StdStringWriter.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 #include <ArduinoJson/Namespace.hpp> 00008 #include <ArduinoJson/Polyfills/type_traits.hpp> 00009 00010 #include <string> 00011 00012 namespace ARDUINOJSON_NAMESPACE { 00013 00014 template <class T> 00015 struct is_std_string : false_type {}; 00016 00017 template <class TCharTraits, class TAllocator> 00018 struct is_std_string<std::basic_string<char, TCharTraits, TAllocator> > 00019 : true_type {}; 00020 00021 template <typename TDestination> 00022 class Writer<TDestination, 00023 typename enable_if<is_std_string<TDestination>::value>::type> { 00024 public: 00025 Writer(TDestination &str) : _str(&str) {} 00026 00027 size_t write(uint8_t c) { 00028 _str->operator+=(static_cast<char>(c)); 00029 return 1; 00030 } 00031 00032 size_t write(const uint8_t *s, size_t n) { 00033 _str->append(reinterpret_cast<const char *>(s), n); 00034 return n; 00035 } 00036 00037 private: 00038 TDestination *_str; 00039 }; 00040 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2