[gjs/arg-inlines: 9/11] gi: Use specialized GIArgument wrapper to handle enum types
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/arg-inlines: 9/11] gi: Use specialized GIArgument wrapper to handle enum types
- Date: Sun, 12 Jul 2020 03:45:16 +0000 (UTC)
commit 7c65e8e94c445c3c8ea64ba929a117e589ba8160
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Mon May 18 16:11:23 2020 +0200
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
gi/arg-inl.h | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 2e6105fe..74e6976b 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]