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

Method applyAttribute

valdi/src/valdi/runtime/Attributes/AttributeHandler.cpp:49–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47AttributeHandler::~AttributeHandler() = default;
48
49Result<Void> AttributeHandler::applyAttribute(ViewTransactionScope& viewTransactionScope,
50 ViewNode& viewNode,
51 const Valdi::Value& value,
52 const SharedAnimator& animator) const {
53 SC_ASSERT(!requiresView() || viewNode.hasView());
54
55 Result<Void> result;
56 auto postprocessedValue = postprocess(viewNode, value);
57 if (postprocessedValue) {
58 SC_ASSERT(_delegate != nullptr, "AttributeHandler::applyAttribute called with null delegate");
59 if (_delegate == nullptr) {
60 return Error("AttributeHandler::applyAttribute called with null delegate");
61 }
62 result = _delegate->onApply(
63 viewTransactionScope, viewNode, viewNode.getView(), _name, postprocessedValue.value(), animator);
64 } else {
65 result = postprocessedValue.moveError();
66 }
67
68 if (!result) {
69 return result.error().rethrow(STRING_FORMAT("Failed to apply value {}", value.toString()));
70 }
71
72 return result;
73}
74
75Result<Value> AttributeHandler::preprocessWithoutCache(const Value& value) const {
76 auto current = value;

Callers 2

updateMethod · 0.80

Calls 8

hasViewMethod · 0.80
rethrowMethod · 0.80
valueMethod · 0.65
errorMethod · 0.65
toStringMethod · 0.65
ErrorInterface · 0.50
onApplyMethod · 0.45
getViewMethod · 0.45

Tested by

no test coverage detected