1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <giomm/dbusinterface.h>
7 #include <giomm/private/dbusinterface_p.h>
8
9
10 /* Copyright (C) 2012 The giomm Development Team
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #include <gio/gio.h>
27 #include <giomm/dbusintrospection.h>
28 #include <giomm/dbusobject.h>
29
30 namespace Gio
31 {
32
33 } // namespace Gio
34
35 namespace
36 {
37 } // anonymous namespace
38
39
40 namespace Glib
41 {
42
wrap(GDBusInterface * object,bool take_copy)43 Glib::RefPtr<Gio::DBus::Interface> wrap(GDBusInterface* object, bool take_copy)
44 {
45 return Glib::RefPtr<Gio::DBus::Interface>( dynamic_cast<Gio::DBus::Interface*> (Glib::wrap_auto_interface<Gio::DBus::Interface> ((GObject*)(object), take_copy)) );
46 //We use dynamic_cast<> in case of multiple inheritance.
47 }
48
49 } // namespace Glib
50
51
52 namespace Gio
53 {
54
55 namespace DBus
56 {
57
58
59 /* The *_Class implementation: */
60
init()61 const Glib::Interface_Class& Interface_Class::init()
62 {
63 if(!gtype_) // create the GType if necessary
64 {
65 // Glib::Interface_Class has to know the interface init function
66 // in order to add interfaces to implementing types.
67 class_init_func_ = &Interface_Class::iface_init_function;
68
69 // We can not derive from another interface, and it is not necessary anyway.
70 gtype_ = g_dbus_interface_get_type();
71 }
72
73 return *this;
74 }
75
iface_init_function(void * g_iface,void *)76 void Interface_Class::iface_init_function(void* g_iface, void*)
77 {
78 const auto klass = static_cast<BaseClassType*>(g_iface);
79
80 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
81 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
82 g_assert(klass != nullptr);
83
84 klass->get_info = &get_info_vfunc_callback;
85 klass->get_object = &get_object_vfunc_callback;
86 klass->set_object = &set_object_vfunc_callback;
87 klass->dup_object = &dup_object_vfunc_callback;
88
89 }
90
get_info_vfunc_callback(GDBusInterface * self)91 GDBusInterfaceInfo* Interface_Class::get_info_vfunc_callback(GDBusInterface* self)
92 {
93 const auto obj_base = static_cast<Glib::ObjectBase*>(
94 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
95
96 // Non-gtkmmproc-generated custom classes implicitly call the default
97 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
98 // generated classes can use this optimisation, which avoids the unnecessary
99 // parameter conversions if there is no possibility of the virtual function
100 // being overridden:
101 if(obj_base && obj_base->is_derived_())
102 {
103 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
104 if(obj) // This can be NULL during destruction.
105 {
106 try // Trap C++ exceptions which would normally be lost because this is a C callback.
107 {
108 // Call the virtual member method, which derived classes might override.
109 return Glib::unwrap(obj->get_info_vfunc());
110 }
111 catch(...)
112 {
113 Glib::exception_handlers_invoke();
114 }
115 }
116 }
117
118 BaseClassType *const base = static_cast<BaseClassType*>(
119 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
120 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
121 ) );
122
123 // Call the original underlying C function:
124 if(base && base->get_info)
125 return (*base->get_info)(self);
126
127 using RType = GDBusInterfaceInfo*;
128 return RType();
129 }
get_object_vfunc_callback(GDBusInterface * self)130 GDBusObject* Interface_Class::get_object_vfunc_callback(GDBusInterface* self)
131 {
132 const auto obj_base = static_cast<Glib::ObjectBase*>(
133 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
134
135 // Non-gtkmmproc-generated custom classes implicitly call the default
136 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
137 // generated classes can use this optimisation, which avoids the unnecessary
138 // parameter conversions if there is no possibility of the virtual function
139 // being overridden:
140 if(obj_base && obj_base->is_derived_())
141 {
142 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
143 if(obj) // This can be NULL during destruction.
144 {
145 try // Trap C++ exceptions which would normally be lost because this is a C callback.
146 {
147 // Call the virtual member method, which derived classes might override.
148 return Glib::unwrap(obj->get_object_vfunc());
149 }
150 catch(...)
151 {
152 Glib::exception_handlers_invoke();
153 }
154 }
155 }
156
157 BaseClassType *const base = static_cast<BaseClassType*>(
158 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
159 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
160 ) );
161
162 // Call the original underlying C function:
163 if(base && base->get_object)
164 return (*base->get_object)(self);
165
166 using RType = GDBusObject*;
167 return RType();
168 }
set_object_vfunc_callback(GDBusInterface * self,GDBusObject * object)169 void Interface_Class::set_object_vfunc_callback(GDBusInterface* self, GDBusObject* object)
170 {
171 const auto obj_base = static_cast<Glib::ObjectBase*>(
172 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
173
174 // Non-gtkmmproc-generated custom classes implicitly call the default
175 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
176 // generated classes can use this optimisation, which avoids the unnecessary
177 // parameter conversions if there is no possibility of the virtual function
178 // being overridden:
179 if(obj_base && obj_base->is_derived_())
180 {
181 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
182 if(obj) // This can be NULL during destruction.
183 {
184 try // Trap C++ exceptions which would normally be lost because this is a C callback.
185 {
186 // Call the virtual member method, which derived classes might override.
187 obj->set_object_vfunc(Glib::wrap(object, true)
188 );
189 return;
190 }
191 catch(...)
192 {
193 Glib::exception_handlers_invoke();
194 }
195 }
196 }
197
198 BaseClassType *const base = static_cast<BaseClassType*>(
199 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
200 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
201 ) );
202
203 // Call the original underlying C function:
204 if(base && base->set_object)
205 (*base->set_object)(self, object);
206 }
dup_object_vfunc_callback(GDBusInterface * self)207 GDBusObject* Interface_Class::dup_object_vfunc_callback(GDBusInterface* self)
208 {
209 const auto obj_base = static_cast<Glib::ObjectBase*>(
210 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
211
212 // Non-gtkmmproc-generated custom classes implicitly call the default
213 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
214 // generated classes can use this optimisation, which avoids the unnecessary
215 // parameter conversions if there is no possibility of the virtual function
216 // being overridden:
217 if(obj_base && obj_base->is_derived_())
218 {
219 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
220 if(obj) // This can be NULL during destruction.
221 {
222 try // Trap C++ exceptions which would normally be lost because this is a C callback.
223 {
224 // Call the virtual member method, which derived classes might override.
225 return Glib::unwrap(obj->dup_object_vfunc());
226 }
227 catch(...)
228 {
229 Glib::exception_handlers_invoke();
230 }
231 }
232 }
233
234 BaseClassType *const base = static_cast<BaseClassType*>(
235 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
236 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
237 ) );
238
239 // Call the original underlying C function:
240 if(base && base->dup_object)
241 return (*base->dup_object)(self);
242
243 using RType = GDBusObject*;
244 return RType();
245 }
246
247
wrap_new(GObject * object)248 Glib::ObjectBase* Interface_Class::wrap_new(GObject* object)
249 {
250 return new Interface((GDBusInterface*)(object));
251 }
252
253
254 /* The implementation: */
255
Interface()256 Interface::Interface()
257 :
258 Glib::Interface(interface_class_.init())
259 {}
260
Interface(GDBusInterface * castitem)261 Interface::Interface(GDBusInterface* castitem)
262 :
263 Glib::Interface((GObject*)(castitem))
264 {}
265
Interface(const Glib::Interface_Class & interface_class)266 Interface::Interface(const Glib::Interface_Class& interface_class)
267 : Glib::Interface(interface_class)
268 {
269 }
270
Interface(Interface && src)271 Interface::Interface(Interface&& src) noexcept
272 : Glib::Interface(std::move(src))
273 {}
274
operator =(Interface && src)275 Interface& Interface::operator=(Interface&& src) noexcept
276 {
277 Glib::Interface::operator=(std::move(src));
278 return *this;
279 }
280
~Interface()281 Interface::~Interface() noexcept
282 {}
283
284 // static
add_interface(GType gtype_implementer)285 void Interface::add_interface(GType gtype_implementer)
286 {
287 interface_class_.init().add_interface(gtype_implementer);
288 }
289
290 Interface::CppClassType Interface::interface_class_; // initialize static member
291
get_type()292 GType Interface::get_type()
293 {
294 return interface_class_.init().get_type();
295 }
296
297
get_base_type()298 GType Interface::get_base_type()
299 {
300 return g_dbus_interface_get_type();
301 }
302
303
get_info()304 Glib::RefPtr<InterfaceInfo> Interface::get_info()
305 {
306 return Glib::wrap(g_dbus_interface_get_info(gobj()));
307 }
308
get_info() const309 Glib::RefPtr<const InterfaceInfo> Interface::get_info() const
310 {
311 return const_cast<Interface*>(this)->get_info();
312 }
313
get_object()314 Glib::RefPtr<Gio::DBus::Object> Interface::get_object()
315 {
316 return Glib::wrap(g_dbus_interface_get_object(gobj()));
317 }
318
get_object() const319 Glib::RefPtr<const Gio::DBus::Object> Interface::get_object() const
320 {
321 return const_cast<Interface*>(this)->get_object();
322 }
323
dup_object()324 Glib::RefPtr<Gio::DBus::Object> Interface::dup_object()
325 {
326 return Glib::wrap(g_dbus_interface_dup_object(gobj()));
327 }
328
dup_object() const329 Glib::RefPtr<const Gio::DBus::Object> Interface::dup_object() const
330 {
331 return const_cast<Interface*>(this)->dup_object();
332 }
333
set_object(const Glib::RefPtr<Gio::DBus::Object> & object)334 void Interface::set_object(const Glib::RefPtr<Gio::DBus::Object>& object)
335 {
336 g_dbus_interface_set_object(gobj(), Glib::unwrap(object));
337 }
338
339
get_info_vfunc() const340 Glib::RefPtr<InterfaceInfo> Gio::DBus::Interface::get_info_vfunc() const
341 {
342 const auto base = static_cast<BaseClassType*>(
343 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
344 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
345 ) );
346
347 if(base && base->get_info)
348 {
349 Glib::RefPtr<InterfaceInfo> retval(Glib::wrap((*base->get_info)(const_cast<GDBusInterface*>(gobj()))));
350 return retval;
351 }
352
353 using RType = Glib::RefPtr<InterfaceInfo>;
354 return RType();
355 }
get_object_vfunc() const356 Glib::RefPtr<Gio::DBus::Object> Gio::DBus::Interface::get_object_vfunc() const
357 {
358 const auto base = static_cast<BaseClassType*>(
359 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
360 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
361 ) );
362
363 if(base && base->get_object)
364 {
365 Glib::RefPtr<Gio::DBus::Object> retval(Glib::wrap((*base->get_object)(const_cast<GDBusInterface*>(gobj()))));
366 return retval;
367 }
368
369 using RType = Glib::RefPtr<Gio::DBus::Object>;
370 return RType();
371 }
set_object_vfunc(const Glib::RefPtr<Gio::DBus::Object> & object)372 void Gio::DBus::Interface::set_object_vfunc(const Glib::RefPtr<Gio::DBus::Object>& object)
373 {
374 const auto base = static_cast<BaseClassType*>(
375 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
376 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
377 ) );
378
379 if(base && base->set_object)
380 {
381 (*base->set_object)(gobj(),Glib::unwrap(object));
382 }
383 }
dup_object_vfunc() const384 Glib::RefPtr<Gio::DBus::Object> Gio::DBus::Interface::dup_object_vfunc() const
385 {
386 const auto base = static_cast<BaseClassType*>(
387 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
388 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
389 ) );
390
391 if(base && base->dup_object)
392 {
393 Glib::RefPtr<Gio::DBus::Object> retval(Glib::wrap((*base->dup_object)(const_cast<GDBusInterface*>(gobj()))));
394 return retval;
395 }
396
397 using RType = Glib::RefPtr<Gio::DBus::Object>;
398 return RType();
399 }
400
401
402 } // namespace DBus
403
404 } // namespace Gio
405
406
407