// ArduinoJson - https://arduinojson.org // Copyright Benoit Blanchon 2014-2021 // MIT License #pragma once #include "lib/ArduinoJson/Namespace.hpp" #include "lib/ArduinoJson/Polyfills/assert.hpp" namespace ARDUINOJSON_NAMESPACE { class NestingLimit { public: NestingLimit() : _value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} explicit NestingLimit(uint8_t n) : _value(n) {} NestingLimit decrement() const { ARDUINOJSON_ASSERT(_value > 0); return NestingLimit(static_cast(_value - 1)); } bool reached() const { return _value == 0; } private: uint8_t _value; }; } // namespace ARDUINOJSON_NAMESPACE