Coverage Report

Created: 2026-03-21 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/arduinojson/src/ArduinoJson/Deserialization/NestingLimit.hpp
Line
Count
Source
1
// ArduinoJson - https://arduinojson.org
2
// Copyright © 2014-2025, Benoit BLANCHON
3
// MIT License
4
5
#pragma once
6
7
#include <ArduinoJson/Namespace.hpp>
8
#include <ArduinoJson/Polyfills/assert.hpp>
9
10
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
11
12
namespace DeserializationOption {
13
class NestingLimit {
14
 public:
15
1.72k
  NestingLimit() : value_(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {}
16
14.2k
  explicit NestingLimit(uint8_t n) : value_(n) {}
17
18
14.2k
  NestingLimit decrement() const {
19
14.2k
    ARDUINOJSON_ASSERT(value_ > 0);
20
14.2k
    return NestingLimit(static_cast<uint8_t>(value_ - 1));
21
14.2k
  }
22
23
4.37k
  bool reached() const {
24
4.37k
    return value_ == 0;
25
4.37k
  }
26
27
 private:
28
  uint8_t value_;
29
};
30
}  // namespace DeserializationOption
31
32
ARDUINOJSON_END_PUBLIC_NAMESPACE