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

bblanchon / ArduinoJson / 5371678521

pending completion
5371678521

push

github

bblanchon
Manage resources in `CollectionData`

107 of 107 new or added lines in 8 files covered. (100.0%)

3383 of 3405 relevant lines covered (99.35%)

6273.07 hits per line

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

93.75
/src/ArduinoJson/Collection/CollectionFunctions.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
inline VariantData* collectionAddElement(CollectionData* array,
68,509✔
12
                                         ResourceManager* resources) {
13
  if (!array)
68,509✔
14
    return nullptr;
5✔
15
  return array->addElement(resources);
68,504✔
16
}
17

18
template <typename TAdaptedString>
19
inline VariantData* collectionAddMember(CollectionData* obj, TAdaptedString key,
20
                                        ResourceManager* resources) {
21
  ARDUINOJSON_ASSERT(obj != nullptr);
22
  return obj->addMember(key, resources);
23
}
24

25
inline void collectionClear(CollectionData* c, ResourceManager* resources) {
4✔
26
  if (!c)
4✔
27
    return;
2✔
28
  c->clear(resources);
2✔
29
}
30

31
inline bool collectionCopy(CollectionData* dst, const CollectionData* src,
39✔
32
                           ResourceManager* resources) {
33
  if (!dst || !src)
39✔
34
    return false;
2✔
35

36
  return dst->copyFrom(*src, resources);
37✔
37
}
38

39
inline VariantData* collectionGetElement(const CollectionData* obj,
3✔
40
                                         size_t index) {
41
  if (!obj)
3✔
42
    return nullptr;
×
43
  return obj->getElement(index);
3✔
44
}
45

46
template <typename TAdaptedString>
47
inline VariantData* collectionGetMember(const CollectionData* obj,
8✔
48
                                        TAdaptedString key) {
49
  if (!obj)
8✔
50
    return nullptr;
×
51
  return obj->getMember(key);
8✔
52
}
53

54
inline void collectionRemove(CollectionData* data, VariantSlot* slot,
9✔
55
                             ResourceManager* resources) {
56
  if (!data)
9✔
57
    return;
2✔
58
  data->removeSlot(slot, resources);
7✔
59
}
60

61
inline void collectionRemoveElement(CollectionData* array, size_t index,
11✔
62
                                    ResourceManager* resources) {
63
  if (!array)
11✔
64
    return;
1✔
65
  array->removeElement(index, resources);
10✔
66
}
67

68
template <typename TAdaptedString>
69
inline void collectionRemoveMember(CollectionData* obj, TAdaptedString key,
26✔
70
                                   ResourceManager* resources) {
71
  if (!obj)
26✔
72
    return;
1✔
73
  obj->removeMember(key, resources);
25✔
74
}
75

76
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