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

Class Element

valdi/test/benchmark/ViewNode_benchmark.cpp:60–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58};
59
60struct Element {
61 StringBox name;
62 std::vector<std::pair<StringBox, Value>> attributes;
63 std::vector<Element> children;
64
65 Element(const char* name) : name(STRING_LITERAL(name)) {}
66
67 template<typename T>
68 Element& attribute(const char* name, const T& value) {
69 attributes.emplace_back(std::make_pair(STRING_LITERAL(name), Value(value)));
70 return *this;
71 }
72
73 Element& attribute(const char* name, const char* value) {
74 return attribute(name, STRING_LITERAL(value));
75 }
76
77 Element& child(Element&& child) {
78 children.emplace_back(std::move(child));
79 return *this;
80 }
81
82 Element& child(const Element& child) {
83 children.emplace_back(child);
84 return *this;
85 }
86
87 Element& setChildren(const std::vector<Element>& children) {
88 this->children = children;
89 return *this;
90 }
91};
92
93struct RenderState {
94 RawViewNodeId elementId = 0;

Callers 1

createElementTreeFunction · 0.70

Calls 1

ValueInterface · 0.50

Tested by 1

createElementTreeFunction · 0.56