blob: 687b1ba3d933c2f1924adcf173ca9d3c79075adf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// 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<uint8_t>(_value - 1));
}
bool reached() const {
return _value == 0;
}
private:
uint8_t _value;
};
} // namespace ARDUINOJSON_NAMESPACE
|