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.
RamStringAdapter.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 #include <ArduinoJson/Strings/ConstRamStringAdapter.hpp> 00008 #include <ArduinoJson/Strings/IsString.hpp> 00009 #include <ArduinoJson/Strings/StoragePolicy.hpp> 00010 00011 namespace ARDUINOJSON_NAMESPACE { 00012 00013 class RamStringAdapter : public ConstRamStringAdapter { 00014 public: 00015 RamStringAdapter(const char* str) : ConstRamStringAdapter(str) {} 00016 00017 void copyTo(char* p, size_t n) const { 00018 memcpy(p, _str, n); 00019 } 00020 00021 typedef ARDUINOJSON_NAMESPACE::storage_policies::store_by_copy storage_policy; 00022 }; 00023 00024 template <typename TChar> 00025 inline RamStringAdapter adaptString(const TChar* str) { 00026 return RamStringAdapter(reinterpret_cast<const char*>(str)); 00027 } 00028 00029 inline RamStringAdapter adaptString(char* str) { 00030 return RamStringAdapter(str); 00031 } 00032 00033 template <typename TChar> 00034 struct IsString<TChar*> { 00035 static const bool value = sizeof(TChar) == 1; 00036 }; 00037 00038 template <> 00039 struct IsString<void*> { 00040 static const bool value = false; 00041 }; 00042 00043 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2