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

bblanchon / ArduinoJson / 5377130425

pending completion
5377130425

push

github

bblanchon
Convert "variant functions" to static member functions

126 of 126 new or added lines in 16 files covered. (100.0%)

3385 of 3408 relevant lines covered (99.33%)

6305.9 hits per line

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

94.44
/src/ArduinoJson/Object/ObjectData.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 ObjectData : public CollectionData {
12
 public:
13
  VariantData* addMember(StringNode* key, ResourceManager* resources);
14

15
  template <typename TAdaptedString>
16
  VariantData* addMember(TAdaptedString key, ResourceManager* resources);
17

18
  bool copyFrom(const ObjectData& src, ResourceManager* resources);
19

20
  static bool copy(ObjectData* dst, const ObjectData* src,
10✔
21
                   ResourceManager* resources) {
22
    if (!dst || !src)
10✔
23
      return false;
2✔
24

25
    return dst->copyFrom(*src, resources);
8✔
26
  }
27

28
  bool equals(const ObjectData& other) const;
29

30
  static bool equals(const ObjectData* lhs, const ObjectData* rhs) {
25✔
31
    if (lhs == rhs)
25✔
32
      return true;
3✔
33

34
    if (!lhs || !rhs)
22✔
35
      return false;
6✔
36

37
    return lhs->equals(*rhs);
16✔
38
  }
39

40
  template <typename TAdaptedString>
41
  VariantData* getOrAddMember(TAdaptedString key, ResourceManager* resources);
42

43
  template <typename TAdaptedString>
44
  VariantData* getMember(TAdaptedString key) const;
45

46
  template <typename TAdaptedString>
47
  static VariantData* getMember(const ObjectData* object, TAdaptedString key) {
8✔
48
    if (!object)
8✔
49
      return nullptr;
×
50
    return object->getMember(key);
8✔
51
  }
52

53
  template <typename TAdaptedString>
54
  void removeMember(TAdaptedString key, ResourceManager* resources);
55

56
  template <typename TAdaptedString>
57
  static void removeMember(ObjectData* obj, TAdaptedString key,
26✔
58
                           ResourceManager* resources) {
59
    if (!obj)
26✔
60
      return;
1✔
61
    obj->removeMember(key, resources);
25✔
62
  }
63

64
 private:
65
  template <typename TAdaptedString>
66
  VariantSlot* getSlot(TAdaptedString key) const;
67
};
68

69
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