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

bblanchon / ArduinoJson / 5489391768

pending completion
5489391768

push

github

bblanchon
`VariantSlot` stores a `StringNode*` for owned keys

18 of 18 new or added lines in 5 files covered. (100.0%)

3406 of 3429 relevant lines covered (99.33%)

6529.06 hits per line

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

94.44
/src/ArduinoJson/Array/ArrayData.hpp
1
// ArduinoJson - https://arduinojson.org
2
// Copyright © 2014-2023, 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) {
66,070✔
16
    if (!array)
66,070✔
17
      return nullptr;
5✔
18
    return array->addElement(resources);
66,065✔
19
  }
20

21
  VariantData* getOrAddElement(size_t index, ResourceManager* resources);
22

23
  VariantData* getElement(size_t index) const;
24

25
  static VariantData* getElement(const ArrayData* array, size_t index) {
3✔
26
    if (!array)
3✔
27
      return nullptr;
×
28
    return array->getElement(index);
3✔
29
  }
30

31
  void removeElement(size_t index, ResourceManager* resources);
32

33
  static void removeElement(ArrayData* array, size_t index,
11✔
34
                            ResourceManager* resources) {
35
    if (!array)
11✔
36
      return;
1✔
37
    array->removeElement(index, resources);
10✔
38
  }
39

40
  bool equals(const ArrayData&) const;
41

42
  static bool equals(const ArrayData* lhs, const ArrayData* rhs) {
25✔
43
    if (lhs == rhs)
25✔
44
      return true;
4✔
45
    if (!lhs || !rhs)
21✔
46
      return false;
6✔
47

48
    return lhs->equals(*rhs);
15✔
49
  }
50

51
  bool copyFrom(const ArrayData& src, ResourceManager* resources);
52

53
  static bool copy(ArrayData* dst, const ArrayData* src,
54
                   ResourceManager* resources) {
55
    if (!dst || !src)
56
      return false;
57

58
    return dst->copyFrom(*src, resources);
59
  }
60

61
 private:
62
  iterator at(size_t index) const;
63
};
64

65
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