Debian Codegraph @

gstreamer/src/colorbalance.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gstreamermm/colorbalancechannel.h>
21
22 namespace Gst
23 {
24
25 const GList* ColorBalance_Class::list_channels_vfunc_callback(GstColorBalance* self)
26 {
27 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
28 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
29
30 // Non-gtkmmproc-generated custom classes implicitly call the default
31 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
32 // generated classes can use this optimisation, which avoids the unnecessary
33 // parameter conversions if there is no possibility of the virtual function
34 // being overridden:
35 if(obj_base && obj_base->is_derived_())
36 {
37 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
38 if(obj) // This can be NULL during destruction.
39 {
40 try // Trap C++ exceptions which would normally be lost because this is a C callback.
41 {
42 // Call the virtual member method, which derived classes might override.
43 return (obj->list_channels_vfunc()).data();
44 }
45 catch(...)
46 {
47 Glib::exception_handlers_invoke();
48 }
49 }
50 }
51
52 BaseClassType *const base = static_cast<BaseClassType*>(
53 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
54 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
55 ) );
56
57 // Call the original underlying C function:
58 if(base && base->list_channels)
59 return (*base->list_channels)(self);
60
61
62 typedef const GList* RType;
63 return RType();
64 }
65 Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> > Gst::ColorBalance::list_channels_vfunc() const
66 {
67 BaseClassType *const base = static_cast<BaseClassType*>(
68 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
69 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
70 ) );
71
72 if(base && base->list_channels)
73 return Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> >(const_cast<GList*>((*base->list_channels)(const_cast<GstColorBalance*>(gobj()))), Glib::OWNERSHIP_NONE);
74
75 typedef Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> > RType;
76 return RType(0, Glib::OWNERSHIP_NONE);
77 }
78
79 } // namespace Gst