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

Function valueFromNodeAttribute

valdi/src/valdi/runtime/CSS/CSSDocument.cpp:26–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26Value valueFromNodeAttribute(const Valdi::NodeAttribute& attribute) {
27 switch (attribute.type()) {
28 case Valdi::NodeAttribute_Type_NODE_ATTRIBUTE_TYPE_DOUBLE:
29 return Value(attribute.double_value());
30 case Valdi::NodeAttribute_Type_NODE_ATTRIBUTE_TYPE_INT:
31 return Value(static_cast<int32_t>(attribute.int_value()));
32 case Valdi::NodeAttribute_Type_NODE_ATTRIBUTE_TYPE_STRING:
33 return Value(StringCache::getGlobal().makeString(attribute.str_value()));
34 default:
35 return Value();
36 }
37}
38
39CSSAttribute toCSSAttribute(AttributeIds& attributeIds, const Valdi::NodeAttribute& nodeAttribute) {
40 return {.id = attributeIds.getIdForName(Valdi::StringCache::getGlobal().makeString(nodeAttribute.name())),

Callers 1

toCSSAttributeFunction · 0.85

Calls 6

getGlobalFunction · 0.85
double_valueMethod · 0.80
int_valueMethod · 0.80
makeStringMethod · 0.80
typeMethod · 0.65
ValueClass · 0.50

Tested by

no test coverage detected