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.
RamReader.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 #include <ArduinoJson/Polyfills/type_traits.hpp> 00008 00009 namespace ARDUINOJSON_NAMESPACE { 00010 00011 template <typename T> 00012 struct IsCharOrVoid { 00013 static const bool value = 00014 is_same<T, void>::value || is_same<T, char>::value || 00015 is_same<T, unsigned char>::value || is_same<T, signed char>::value; 00016 }; 00017 00018 template <typename T> 00019 struct IsCharOrVoid<const T> : IsCharOrVoid<T> {}; 00020 00021 template <typename TSource> 00022 struct Reader<TSource*, 00023 typename enable_if<IsCharOrVoid<TSource>::value>::type> { 00024 const char* _ptr; 00025 00026 public: 00027 explicit Reader(const void* ptr) 00028 : _ptr(ptr ? reinterpret_cast<const char*>(ptr) : "") {} 00029 00030 int read() { 00031 return static_cast<unsigned char>(*_ptr++); 00032 } 00033 00034 size_t readBytes(char* buffer, size_t length) { 00035 for (size_t i = 0; i < length; i++) buffer[i] = *_ptr++; 00036 return length; 00037 } 00038 }; 00039 00040 template <typename TSource> 00041 struct BoundedReader<TSource*, 00042 typename enable_if<IsCharOrVoid<TSource>::value>::type> 00043 : public IteratorReader<const char*> { 00044 public: 00045 explicit BoundedReader(const void* ptr, size_t len) 00046 : IteratorReader<const char*>(reinterpret_cast<const char*>(ptr), 00047 reinterpret_cast<const char*>(ptr) + len) {} 00048 }; 00049 00050 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2