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

bblanchon / ArduinoJson / 6770901880

06 Nov 2023 12:24PM CUT coverage: 99.545%. Remained the same
6770901880

push

github

bblanchon
CI: always use libc++ with clang

3497 of 3513 relevant lines covered (99.54%)

10637.15 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(
411✔
13
    size_t index, const ResourceManager* resources) const {
14
  auto it = createIterator(resources);
411✔
15
  while (!it.done() && index) {
654✔
16
    it.next(resources);
243✔
17
    --index;
243✔
18
  }
19
  return it;
411✔
20
}
21

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

41
inline VariantData* ArrayData::getElement(
400✔
42
    size_t index, const ResourceManager* resources) const {
43
  return at(index, resources).data();
400✔
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