MCPcopy Create free account
hub / github.com/Snapchat/Valdi / ReferenceInfo

Class ReferenceInfo

valdi_core/src/valdi_core/cpp/Utils/ReferenceInfo.hpp:22–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20class ReferenceInfoBuilder;
21
22class ReferenceInfo {
23public:
24 static constexpr size_t kComponentsSize = 4;
25 static constexpr size_t kNamesSize = 2;
26
27 struct Component {
28 enum class Type : uint8_t { Unknown, Property, ReturnValue, ParameterValue, ArrayItem };
29
30 // NOLINTNEXTLINE(modernize-use-default-member-init)
31 Type type;
32 // NOLINTNEXTLINE(modernize-use-default-member-init)
33 uint8_t index : 6;
34 // NOLINTNEXTLINE(modernize-use-default-member-init)
35 bool hasAssignedName : 1;
36 // NOLINTNEXTLINE(modernize-use-default-member-init)
37 bool isFunction : 1;
38
39 constexpr Component() : type(Type::Unknown), index(0), hasAssignedName(false), isFunction(false) {}
40 };
41
42 ReferenceInfo();
43 ~ReferenceInfo();
44
45 const StringBox& getName() const;
46
47 std::string toString() const;
48 void outputToStream(std::ostream& os) const;
49
50 StringBox toFunctionIdentifier() const;
51
52 const Component* begin() const;
53 const Component* end() const;
54
55 std::reverse_iterator<const Component*> rbegin() const;
56 std::reverse_iterator<const Component*> rend() const;
57
58 const StringBox& getNameForComponent(const Component& component) const;
59
60 static ReferenceInfo fromObjectNamed(std::string_view objectName);
61
62private:
63 friend ReferenceInfoBuilder;
64
65 using Components = std::array<Component, kComponentsSize>;
66 using Names = std::array<StringBox, kNamesSize>;
67
68 Components _components;
69 Names _names;
70
71 ReferenceInfo(Components&& components, Names&& names);
72
73 const Component& top() const;
74 Component& top();
75};
76
77class ReferenceInfoBuilder : public snap::NonCopyable {
78public:

Callers 2

ReferenceInfo.cppFile · 0.70
buildMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected