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.
StaticJsonDocument.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 #include <ArduinoJson/Document/JsonDocument.hpp> 00008 00009 namespace ARDUINOJSON_NAMESPACE { 00010 00011 template <size_t desiredCapacity> 00012 class StaticJsonDocument : public JsonDocument { 00013 static const size_t _capacity = 00014 AddPadding<Max<1, desiredCapacity>::value>::value; 00015 00016 public: 00017 StaticJsonDocument() : JsonDocument(_buffer, _capacity) {} 00018 00019 StaticJsonDocument(const StaticJsonDocument& src) 00020 : JsonDocument(_buffer, _capacity) { 00021 set(src); 00022 } 00023 00024 template <typename T> 00025 StaticJsonDocument(const T& src, 00026 typename enable_if<IsVisitable<T>::value>::type* = 0) 00027 : JsonDocument(_buffer, _capacity) { 00028 set(src); 00029 } 00030 00031 // disambiguate 00032 StaticJsonDocument(VariantRef src) : JsonDocument(_buffer, _capacity) { 00033 set(src); 00034 } 00035 00036 StaticJsonDocument operator=(const StaticJsonDocument& src) { 00037 set(src); 00038 return *this; 00039 } 00040 00041 template <typename T> 00042 StaticJsonDocument operator=(const T& src) { 00043 set(src); 00044 return *this; 00045 } 00046 00047 void garbageCollect() { 00048 StaticJsonDocument tmp(*this); 00049 set(tmp); 00050 } 00051 00052 private: 00053 char _buffer[_capacity]; 00054 }; 00055 00056 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2