MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / Setter

Function Setter

src/NodeRTLib/CppTemplates/StaticPropertySetter.cpp:2–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1
2 static void @(Model.Name)Setter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
3 HandleScope scope;
4
5 if (!@(String.Format(Converter.TypeCheck(Model.PropertyType, TX.MainModel.Types.ContainsKey(Model.PropertyType)),"value"))) {
6 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
7 return;
8 }
9
10 try {
11 @{
12 var winrtConversionInfo = Converter.ToWinRT(Model.PropertyType);
13 }
14
15 @(winrtConversionInfo[0]) winRtValue = @(string.Format(winrtConversionInfo[1], "value"));
16
17 @(TX.ToWinRT(Model.DeclaringType, false))::@(Model.Name) = winRtValue;
18 } catch (Platform::Exception ^exception) {
19 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
20 }
21 }

Callers

nothing calls this directly

Calls 3

NewStringFunction · 0.85
TypeCheckMethod · 0.80
ToWinRTMethod · 0.45

Tested by

no test coverage detected