Debian Codegraph @

override/glib/glib_extra_def.hpp

raw symbols SCIP
1 #ifndef _GI_GLIB_GLIB_EXTRA_DEF_HPP_
2 #define _GI_GLIB_GLIB_EXTRA_DEF_HPP_
3
4 namespace gi
5 {
6 namespace repository
7 {
8 namespace GLib
9 {
10 GI_INLINE_DECL gi::rv<guint>::type idle_add(GLib::SourceFunc function)
11 GI_NOEXCEPT_DECL(true);
12
13 GI_INLINE_DECL gi::rv<guint>::type idle_add_once(std::function<void()> function)
14 GI_NOEXCEPT_DECL(true);
15
16 GI_INLINE_DECL gi::rv<guint>::type timeout_add_seconds(
17 guint interval, GLib::SourceFunc function) GI_NOEXCEPT_DECL(true);
18
19 GI_INLINE_DECL gi::rv<guint>::type timeout_add_seconds_once(
20 guint interval, std::function<void()> function) GI_NOEXCEPT_DECL(true);
21
22 GI_INLINE_DECL gi::rv<guint>::type timeout_add(
23 guint interval, GLib::SourceFunc function) GI_NOEXCEPT_DECL(true);
24
25 GI_INLINE_DECL gi::rv<guint>::type timeout_add_once(
26 guint interval, std::function<void()> function) GI_NOEXCEPT_DECL(true);
27
28 // connection helpers
29 namespace internal
30 {
31 class SourceConnection : public detail::connection_impl
32 {
33 public:
34 using connection_impl::connection_impl;
35
36 void disconnect() { g_source_remove(id_); }
37 };
38
39 } // namespace internal
40
41 using SourceConnection = detail::connection<internal::SourceConnection>;
42 using SourceScopedConnection = detail::scoped_connection<SourceConnection>;
43
44 } // namespace GLib
45
46 template<>
47 struct declare_gtype_of<GLib::Variant>
48 {
49 // a get_type() member already exists in base class detail::VariantWrapper
50 // so get_type() should not be specified here
51 // otherwise traits::gtype<GLib::Variant> will have 2 ambiguous options
52
53 static GLib::Variant get_value(const GValue *val)
54 {
55 return wrap(g_value_dup_variant(val), transfer_full);
56 }
57 static void set_value(GValue *val, GLib::Variant v)
58 {
59 g_value_take_variant(val, v.gobj_copy_());
60 }
61 };
62
63 } // namespace repository
64
65 inline repository::GLib::SourceConnection
66 make_connection(gulong id, const repository::GLib::SourceFunc &func)
67 {
68 return repository::GLib::SourceConnection(id, func.connection());
69 }
70
71 } // namespace gi
72
73 #endif