MCPcopy Create free account
hub / github.com/GNOME/gjs / path_to_gi_argument

Function path_to_gi_argument

modules/cairo-path.cpp:62–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62GJS_JSAPI_RETURN_CONVENTION static bool path_to_gi_argument(
63 JSContext* cx, JS::Value value, const char* arg_name,
64 GjsArgumentType argument_type, GITransfer transfer, GjsArgumentFlags flags,
65 GIArgument* arg) {
66 if (value.isNull()) {
67 if (!(flags & GjsArgumentFlags::MAY_BE_NULL)) {
68 Gjs::AutoChar display_name{
69 gjs_argument_display_name(arg_name, argument_type)};
70 gjs_throw(cx, "%s may not be null", display_name.get());
71 return false;
72 }
73
74 gjs_arg_unset(arg);
75 return true;
76 }
77
78 if (!value.isObject()) {
79 Gjs::AutoChar display_name{
80 gjs_argument_display_name(arg_name, argument_type)};
81 gjs_throw(cx, "%s is not a Cairo.Path", display_name.get());
82 return false;
83 }
84
85 JS::RootedObject path_wrapper{cx, &value.toObject()};
86 cairo_path_t* s = CairoPath::for_js(cx, path_wrapper);
87 if (!s)
88 return false;
89 if (transfer == GI_TRANSFER_EVERYTHING)
90 s = CairoPath::copy_ptr(s);
91
92 gjs_arg_set(arg, s);
93 return true;
94}
95
96GJS_JSAPI_RETURN_CONVENTION
97static bool path_from_gi_argument(JSContext* cx, JS::MutableHandleValue value_p,

Callers

nothing calls this directly

Calls 5

gjs_throwFunction · 0.85
gjs_arg_unsetFunction · 0.85
gjs_arg_setFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected