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

bblanchon / ArduinoJson / 10700044544

04 Sep 2024 10:40AM CUT coverage: 99.301%. First build
10700044544

push

github

bblanchon
Approx

3975 of 4003 relevant lines covered (99.3%)

10563.62 hits per line

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

95.45
/src/ArduinoJson/Array/ArrayData.hpp
1
// ArduinoJson - https://arduinojson.org
2
// Copyright © 2014-2024, Benoit BLANCHON
3
// MIT License
4

5
#pragma once
6

7
#include <ArduinoJson/Collection/CollectionData.hpp>
8

9
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
10

11
class ArrayData : public CollectionData {
12
 public:
13
  VariantData* addElement(ResourceManager* resources);
14

15
  static VariantData* addElement(ArrayData* array, ResourceManager* resources) {
222✔
16
    if (!array)
222✔
17
      return nullptr;
×
18
    return array->addElement(resources);
222✔
19
  }
20

21
  template <typename T>
22
  bool addValue(T&& value, ResourceManager* resources);
23

24
  template <typename T>
25
  static bool addValue(ArrayData* array, T&& value,
66,676✔
26
                       ResourceManager* resources) {
27
    if (!array)
66,676✔
28
      return false;
3✔
29
    return array->addValue(value, resources);
66,673✔
30
  }
31

32
  VariantData* getOrAddElement(size_t index, ResourceManager* resources);
33

34
  VariantData* getElement(size_t index, const ResourceManager* resources) const;
35

36
  static VariantData* getElement(const ArrayData* array, size_t index,
457✔
37
                                 const ResourceManager* resources) {
38
    if (!array)
457✔
39
      return nullptr;
15✔
40
    return array->getElement(index, resources);
442✔
41
  }
42

43
  void removeElement(size_t index, ResourceManager* resources);
44

45
  static void removeElement(ArrayData* array, size_t index,
15✔
46
                            ResourceManager* resources) {
47
    if (!array)
15✔
48
      return;
1✔
49
    array->removeElement(index, resources);
14✔
50
  }
51

52
  void remove(iterator it, ResourceManager* resources) {
19✔
53
    CollectionData::removeOne(it, resources);
19✔
54
  }
19✔
55

56
  static void remove(ArrayData* array, iterator it,
6✔
57
                     ResourceManager* resources) {
58
    if (array)
6✔
59
      return array->remove(it, resources);
5✔
60
  }
61

62
 private:
63
  iterator at(size_t index, const ResourceManager* resources) const;
64
};
65

66
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