Commit b8f08987 authored by Marco Trevisan's avatar Marco Trevisan 🎺 Committed by Philip Chimento

gi: Use specialized GIArgument wrapper to handle enum types

Enums and flags must be saved as int internally, so define a specialized
wrapper for this so that we can automatically and safely ensure everywhere that
we're respecting this
parent e779673d
......@@ -141,6 +141,12 @@ GJS_USE inline decltype(auto) gjs_arg_member<std::nullptr_t>(GIArgument* arg) {
return gjs_arg_member(arg, &GIArgument::v_pointer);
}
template <>
GJS_USE inline decltype(auto) gjs_arg_member<int, GI_TYPE_TAG_INTERFACE>(
GIArgument* arg) {
return gjs_arg_member(arg, &GIArgument::v_int);
}
template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
inline void gjs_arg_set(GIArgument* arg, T v) {
gjs_arg_member<T, TAG>(arg) = v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment