• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bblanchon / ArduinoJson / 5645229289

pending completion
5645229289

push

github

bblanchon
Remains

3427 of 3441 relevant lines covered (99.59%)

8803.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.0
/src/ArduinoJson/Array/ArrayImpl.hpp
1
// ArduinoJson - https://arduinojson.org
2
// Copyright © 2014-2023, Benoit BLANCHON
3
// MIT License
4

5
#pragma once
6

7
#include <ArduinoJson/Array/ArrayData.hpp>
8
#include <ArduinoJson/Variant/VariantCompare.hpp>
9

10
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
11

12
inline ArrayData::iterator ArrayData::at(
417✔
13
    size_t index, const ResourceManager* resources) const {
14
  auto it = createIterator(resources);
417✔
15
  while (!it.done() && index) {
660✔
16
    it.next(resources);
243✔
17
    --index;
243✔
18
  }
19
  return it;
417✔
20
}
21

22
inline VariantData* ArrayData::getOrAddElement(size_t index,
130✔
23
                                               ResourceManager* resources) {
24
  auto it = createIterator(resources);
130✔
25
  while (!it.done() && index > 0) {
140✔
26
    it.next(resources);
10✔
27
    index--;
10✔
28
  }
29
  if (it.done())
130✔
30
    index++;
98✔
31
  VariantData* element = it.data();
130✔
32
  while (index > 0) {
240✔
33
    element = addElement(resources);
110✔
34
    if (!element)
110✔
35
      return nullptr;
×
36
    index--;
110✔
37
  }
38
  return element;
130✔
39
}
40

41
inline VariantData* ArrayData::getElement(
406✔
42
    size_t index, const ResourceManager* resources) const {
43
  return at(index, resources).data();
406✔
44
}
45

46
inline void ArrayData::removeElement(size_t index, ResourceManager* resources) {
11✔
47
  remove(at(index, resources), resources);
11✔
48
}
11✔
49

50
ARDUINOJSON_END_PRIVATE_NAMESPACE
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc