[gjs/arg-inlines: 5/9] arg: Add utility function to unset a GIArgument depending on type
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/arg-inlines: 5/9] arg: Add utility function to unset a GIArgument depending on type
- Date: Sat, 11 Jul 2020 22:24:56 +0000 (UTC)
commit 41db0aaeb4fa61610823d6638168e58629f6befa
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Mon May 11 02:21:40 2020 +0200
arg: Add utility function to unset a GIArgument depending on type
gi/arg-inl.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 33366aa5..e199cee7 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -169,3 +169,15 @@ GJS_USE inline gboolean gjs_g_argument_value_get<gboolean, GI_TYPE_TAG_BOOLEAN>(
GIArgument* arg) {
return !!gjs_g_argument_value<bool>(arg);
}
+
+template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
+inline std::enable_if_t<!std::is_pointer<T>::value> gjs_g_argument_value_unset(
+ GIArgument* arg) {
+ gjs_g_argument_value_set<T, TAG>(arg, static_cast<T>(0));
+}
+
+template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
+inline std::enable_if_t<std::is_pointer<T>::value> gjs_g_argument_value_unset(
+ GIArgument* arg) {
+ gjs_g_argument_value_set<T, TAG>(arg, nullptr);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]