| 24 | } |
| 25 | |
| 26 | Value 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 | |
| 39 | CSSAttribute toCSSAttribute(AttributeIds& attributeIds, const Valdi::NodeAttribute& nodeAttribute) { |
| 40 | return {.id = attributeIds.getIdForName(Valdi::StringCache::getGlobal().makeString(nodeAttribute.name())), |
no test coverage detected