Debian Codegraph @

gstreamer/gstreamermm/childproxy.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/childproxy.h>
7 #include <gstreamermm/private/childproxy_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008-2016 The gstreamermm Development Team
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29 #include <gstreamermm/object.h>
30
31 namespace Gst
32 {
33
34 bool ChildProxy::lookup(const Glib::ustring& name, Glib::RefPtr<Glib::Object>& target,
35 GParamSpec*& pspec)
36 {
37 GObject* g_object = nullptr;
38 bool const result = gst_child_proxy_lookup(gobj(),
39 name.c_str(), &g_object, &pspec);
40 target = Glib::wrap(g_object);
41 return result;
42 }
43
44 Glib::RefPtr<Gst::ChildProxy> ChildProxy::get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value)
45 {
46 gst_child_proxy_get_property(const_cast<GstChildProxy*>(gobj()), name.c_str(), value.gobj());
47 return Glib::wrap(gobj(), true);
48 }
49
50 Glib::RefPtr<const Gst::ChildProxy> ChildProxy::get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value) const
51 {
52 gst_child_proxy_get_property(const_cast<GstChildProxy*>(gobj()), name.c_str(), value.gobj());
53 return Glib::wrap(const_cast<GstChildProxy*>(gobj()), true);
54 }
55
56 Glib::RefPtr<Gst::ChildProxy> ChildProxy::set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value)
57 {
58 gst_child_proxy_set_property(const_cast<GstChildProxy*>(gobj()), name.c_str(), value.gobj());
59 return Glib::wrap(gobj(), true);
60 }
61
62 } //namespace Gst
63
64 namespace
65 {
66
67
68 static void ChildProxy_signal_child_added_callback(GstChildProxy* self, GObject* p0,const gchar* p1,void* data)
69 {
70 using namespace Gst;
71 using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& >;
72
73 auto obj = dynamic_cast<ChildProxy*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
74 // Do not try to call a signal on a disassociated wrapper.
75 if(obj)
76 {
77 try
78 {
79 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
80 (*static_cast<SlotType*>(slot))(Glib::wrap(GST_OBJECT(p0), true)
81 , Glib::convert_const_gchar_ptr_to_ustring(p1)
82 );
83 }
84 catch(...)
85 {
86 Glib::exception_handlers_invoke();
87 }
88 }
89 }
90
91 static const Glib::SignalProxyInfo ChildProxy_signal_child_added_info =
92 {
93 "child-added",
94 (GCallback) &ChildProxy_signal_child_added_callback,
95 (GCallback) &ChildProxy_signal_child_added_callback
96 };
97
98
99 static void ChildProxy_signal_child_removed_callback(GstChildProxy* self, GObject* p0,const gchar* p1,void* data)
100 {
101 using namespace Gst;
102 using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& >;
103
104 auto obj = dynamic_cast<ChildProxy*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
105 // Do not try to call a signal on a disassociated wrapper.
106 if(obj)
107 {
108 try
109 {
110 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
111 (*static_cast<SlotType*>(slot))(Glib::wrap(GST_OBJECT(p0), true)
112 , Glib::convert_const_gchar_ptr_to_ustring(p1)
113 );
114 }
115 catch(...)
116 {
117 Glib::exception_handlers_invoke();
118 }
119 }
120 }
121
122 static const Glib::SignalProxyInfo ChildProxy_signal_child_removed_info =
123 {
124 "child-removed",
125 (GCallback) &ChildProxy_signal_child_removed_callback,
126 (GCallback) &ChildProxy_signal_child_removed_callback
127 };
128
129
130 } // anonymous namespace
131
132
133 namespace Glib
134 {
135
136 Glib::RefPtr<Gst::ChildProxy> wrap(GstChildProxy* object, bool take_copy)
137 {
138 return Glib::RefPtr<Gst::ChildProxy>( dynamic_cast<Gst::ChildProxy*> (Glib::wrap_auto_interface<Gst::ChildProxy> ((GObject*)(object), take_copy)) );
139 //We use dynamic_cast<> in case of multiple inheritance.
140 }
141
142 } // namespace Glib
143
144
145 namespace Gst
146 {
147
148
149 /* The *_Class implementation: */
150
151 const Glib::Interface_Class& ChildProxy_Class::init()
152 {
153 if(!gtype_) // create the GType if necessary
154 {
155 // Glib::Interface_Class has to know the interface init function
156 // in order to add interfaces to implementing types.
157 class_init_func_ = &ChildProxy_Class::iface_init_function;
158
159 // We can not derive from another interface, and it is not necessary anyway.
160 gtype_ = gst_child_proxy_get_type();
161 }
162
163 return *this;
164 }
165
166 void ChildProxy_Class::iface_init_function(void* g_iface, void*)
167 {
168 const auto klass = static_cast<BaseClassType*>(g_iface);
169
170 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
171 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
172 g_assert(klass != nullptr);
173
174 klass->get_child_by_name = &get_child_by_name_vfunc_callback;
175 klass->get_child_by_index = &get_child_by_index_vfunc_callback;
176 klass->get_children_count = &get_children_count_vfunc_callback;
177
178 klass->child_added = &child_added_callback;
179 klass->child_removed = &child_removed_callback;
180 }
181
182 GObject* ChildProxy_Class::get_child_by_name_vfunc_callback(GstChildProxy* self, const gchar* name)
183 {
184 const auto obj_base = static_cast<Glib::ObjectBase*>(
185 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
186
187 // Non-gtkmmproc-generated custom classes implicitly call the default
188 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
189 // generated classes can use this optimisation, which avoids the unnecessary
190 // parameter conversions if there is no possibility of the virtual function
191 // being overridden:
192 if(obj_base && obj_base->is_derived_())
193 {
194 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
195 if(obj) // This can be NULL during destruction.
196 {
197 try // Trap C++ exceptions which would normally be lost because this is a C callback.
198 {
199 // Call the virtual member method, which derived classes might override.
200 return Glib::unwrap(obj->get_child_by_name_vfunc(Glib::convert_const_gchar_ptr_to_ustring(name)
201 ));
202 }
203 catch(...)
204 {
205 Glib::exception_handlers_invoke();
206 }
207 }
208 }
209
210 BaseClassType *const base = static_cast<BaseClassType*>(
211 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
212 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
213 ) );
214
215 // Call the original underlying C function:
216 if(base && base->get_child_by_name)
217 return (*base->get_child_by_name)(self, name);
218
219 using RType = GObject*;
220 return RType();
221 }
222 GObject* ChildProxy_Class::get_child_by_index_vfunc_callback(GstChildProxy* self, guint index)
223 {
224 const auto obj_base = static_cast<Glib::ObjectBase*>(
225 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
226
227 // Non-gtkmmproc-generated custom classes implicitly call the default
228 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
229 // generated classes can use this optimisation, which avoids the unnecessary
230 // parameter conversions if there is no possibility of the virtual function
231 // being overridden:
232 if(obj_base && obj_base->is_derived_())
233 {
234 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
235 if(obj) // This can be NULL during destruction.
236 {
237 try // Trap C++ exceptions which would normally be lost because this is a C callback.
238 {
239 // Call the virtual member method, which derived classes might override.
240 return Glib::unwrap(obj->get_child_by_index_vfunc(index));
241 }
242 catch(...)
243 {
244 Glib::exception_handlers_invoke();
245 }
246 }
247 }
248
249 BaseClassType *const base = static_cast<BaseClassType*>(
250 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
251 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
252 ) );
253
254 // Call the original underlying C function:
255 if(base && base->get_child_by_index)
256 return (*base->get_child_by_index)(self, index);
257
258 using RType = GObject*;
259 return RType();
260 }
261 guint ChildProxy_Class::get_children_count_vfunc_callback(GstChildProxy* self)
262 {
263 const auto obj_base = static_cast<Glib::ObjectBase*>(
264 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
265
266 // Non-gtkmmproc-generated custom classes implicitly call the default
267 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
268 // generated classes can use this optimisation, which avoids the unnecessary
269 // parameter conversions if there is no possibility of the virtual function
270 // being overridden:
271 if(obj_base && obj_base->is_derived_())
272 {
273 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
274 if(obj) // This can be NULL during destruction.
275 {
276 try // Trap C++ exceptions which would normally be lost because this is a C callback.
277 {
278 // Call the virtual member method, which derived classes might override.
279 return obj->get_children_count_vfunc();
280 }
281 catch(...)
282 {
283 Glib::exception_handlers_invoke();
284 }
285 }
286 }
287
288 BaseClassType *const base = static_cast<BaseClassType*>(
289 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
290 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
291 ) );
292
293 // Call the original underlying C function:
294 if(base && base->get_children_count)
295 return (*base->get_children_count)(self);
296
297 using RType = guint;
298 return RType();
299 }
300
301 void ChildProxy_Class::child_added_callback(GstChildProxy* self, GObject* p0, const gchar* p1)
302 {
303 const auto obj_base = static_cast<Glib::ObjectBase*>(
304 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
305
306 // Non-gtkmmproc-generated custom classes implicitly call the default
307 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
308 // generated classes can use this optimisation, which avoids the unnecessary
309 // parameter conversions if there is no possibility of the virtual function
310 // being overridden:
311 if(obj_base && obj_base->is_derived_())
312 {
313 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
314 if(obj) // This can be NULL during destruction.
315 {
316 try // Trap C++ exceptions which would normally be lost because this is a C callback.
317 {
318 // Call the virtual member method, which derived classes might override.
319 obj->on_child_added(Glib::wrap(GST_OBJECT(p0), true)
320 , Glib::convert_const_gchar_ptr_to_ustring(p1)
321 );
322 return;
323 }
324 catch(...)
325 {
326 Glib::exception_handlers_invoke();
327 }
328 }
329 }
330
331 const auto base = static_cast<BaseClassType*>(
332 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
333 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
334 ) );
335
336 // Call the original underlying C function:
337 if(base && base->child_added)
338 (*base->child_added)(self, p0, p1);
339 }
340 void ChildProxy_Class::child_removed_callback(GstChildProxy* self, GObject* p0, const gchar* p1)
341 {
342 const auto obj_base = static_cast<Glib::ObjectBase*>(
343 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
344
345 // Non-gtkmmproc-generated custom classes implicitly call the default
346 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
347 // generated classes can use this optimisation, which avoids the unnecessary
348 // parameter conversions if there is no possibility of the virtual function
349 // being overridden:
350 if(obj_base && obj_base->is_derived_())
351 {
352 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
353 if(obj) // This can be NULL during destruction.
354 {
355 try // Trap C++ exceptions which would normally be lost because this is a C callback.
356 {
357 // Call the virtual member method, which derived classes might override.
358 obj->on_child_removed(Glib::wrap(GST_OBJECT(p0), true)
359 , Glib::convert_const_gchar_ptr_to_ustring(p1)
360 );
361 return;
362 }
363 catch(...)
364 {
365 Glib::exception_handlers_invoke();
366 }
367 }
368 }
369
370 const auto base = static_cast<BaseClassType*>(
371 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
372 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
373 ) );
374
375 // Call the original underlying C function:
376 if(base && base->child_removed)
377 (*base->child_removed)(self, p0, p1);
378 }
379
380
381 Glib::ObjectBase* ChildProxy_Class::wrap_new(GObject* object)
382 {
383 return new ChildProxy((GstChildProxy*)(object));
384 }
385
386
387 /* The implementation: */
388
389 ChildProxy::ChildProxy()
390 :
391 Glib::Interface(childproxy_class_.init())
392 {}
393
394 ChildProxy::ChildProxy(GstChildProxy* castitem)
395 :
396 Glib::Interface((GObject*)(castitem))
397 {}
398
399 ChildProxy::ChildProxy(const Glib::Interface_Class& interface_class)
400 : Glib::Interface(interface_class)
401 {
402 }
403
404 ChildProxy::ChildProxy(ChildProxy&& src) noexcept
405 : Glib::Interface(std::move(src))
406 {}
407
408 ChildProxy& ChildProxy::operator=(ChildProxy&& src) noexcept
409 {
410 Glib::Interface::operator=(std::move(src));
411 return *this;
412 }
413
414 ChildProxy::~ChildProxy() noexcept
415 {}
416
417 // static
418 void ChildProxy::add_interface(GType gtype_implementer)
419 {
420 childproxy_class_.init().add_interface(gtype_implementer);
421 }
422
423 ChildProxy::CppClassType ChildProxy::childproxy_class_; // initialize static member
424
425 GType ChildProxy::get_type()
426 {
427 return childproxy_class_.init().get_type();
428 }
429
430
431 GType ChildProxy::get_base_type()
432 {
433 return gst_child_proxy_get_type();
434 }
435
436
437 guint ChildProxy::get_children_count() const
438 {
439 return gst_child_proxy_get_children_count(const_cast<GstChildProxy*>(gobj()));
440 }
441
442 Glib::RefPtr<Gst::Object> ChildProxy::get_child(const Glib::ustring& name)
443 {
444 return Glib::wrap(GST_OBJECT(gst_child_proxy_get_child_by_name(gobj(), name.c_str())), true);
445 }
446
447 Glib::RefPtr<const Gst::Object> ChildProxy::get_child(const Glib::ustring& name) const
448 {
449 return const_cast<ChildProxy*>(this)->get_child(name);
450 }
451
452 Glib::RefPtr<Glib::Object> ChildProxy::get_child(guint index)
453 {
454 return Glib::wrap(gst_child_proxy_get_child_by_index(gobj(), index));
455 }
456
457 Glib::RefPtr<const Glib::Object> ChildProxy::get_child(guint index) const
458 {
459 return const_cast<ChildProxy*>(this)->get_child(index);
460 }
461
462 void ChildProxy::child_added(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name)
463 {
464 gst_child_proxy_child_added(gobj(), G_OBJECT(Glib::unwrap(child)), name.c_str());
465 }
466
467 void ChildProxy::child_removed(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name)
468 {
469 gst_child_proxy_child_removed(gobj(), G_OBJECT(Glib::unwrap(child)), name.c_str());
470 }
471
472
473 Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& > ChildProxy::signal_child_added()
474 {
475 return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& >(this, &ChildProxy_signal_child_added_info);
476 }
477
478
479 Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& > ChildProxy::signal_child_removed()
480 {
481 return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& >(this, &ChildProxy_signal_child_removed_info);
482 }
483
484
485 void Gst::ChildProxy::on_child_added(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& name)
486 {
487 const auto base = static_cast<BaseClassType*>(
488 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
489 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
490 ) );
491
492 if(base && base->child_added)
493 (*base->child_added)(gobj(),G_OBJECT(Glib::unwrap(object)),name.c_str());
494 }
495 void Gst::ChildProxy::on_child_removed(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& name)
496 {
497 const auto base = static_cast<BaseClassType*>(
498 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
499 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
500 ) );
501
502 if(base && base->child_removed)
503 (*base->child_removed)(gobj(),G_OBJECT(Glib::unwrap(object)),name.c_str());
504 }
505
506 Glib::RefPtr<Glib::Object> Gst::ChildProxy::get_child_by_name_vfunc(const Glib::ustring& name) const
507 {
508 const auto base = static_cast<BaseClassType*>(
509 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
510 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
511 ) );
512
513 if(base && base->get_child_by_name)
514 {
515 Glib::RefPtr<Glib::Object> retval(Glib::wrap((*base->get_child_by_name)(const_cast<GstChildProxy*>(gobj()),name.c_str())));
516 return retval;
517 }
518
519 using RType = Glib::RefPtr<Glib::Object>;
520 return RType();
521 }
522 Glib::RefPtr<Glib::Object> Gst::ChildProxy::get_child_by_index_vfunc(guint index) const
523 {
524 const auto base = static_cast<BaseClassType*>(
525 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
526 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
527 ) );
528
529 if(base && base->get_child_by_index)
530 {
531 Glib::RefPtr<Glib::Object> retval(Glib::wrap((*base->get_child_by_index)(const_cast<GstChildProxy*>(gobj()),index)));
532 return retval;
533 }
534
535 using RType = Glib::RefPtr<Glib::Object>;
536 return RType();
537 }
538 guint Gst::ChildProxy::get_children_count_vfunc() const
539 {
540 const auto base = static_cast<BaseClassType*>(
541 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
542 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
543 ) );
544
545 if(base && base->get_children_count)
546 {
547 guint retval((*base->get_children_count)(const_cast<GstChildProxy*>(gobj())));
548 return retval;
549 }
550
551 using RType = guint;
552 return RType();
553 }
554
555
556 } // namespace Gst
557
558