Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / giomm / asyncresult.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/asyncresult.h>
5 #include <giomm/private/asyncresult_p.h>
6
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
8
9 /* Copyright (C) 2007 The giomm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 //#include <gio/gasyncresult.h> //We are not allowed to include individual headers.
27 #include <gio/gio.h>
28
29 namespace
30 {
31 } // anonymous namespace
32
33
34 namespace Glib
35 {
36
37 Glib::RefPtr<Gio::AsyncResult> wrap(GAsyncResult* object, bool take_copy)
38 {
39   return Glib::RefPtr<Gio::AsyncResult>( dynamic_cast<Gio::AsyncResult*> (Glib::wrap_auto_interface<Gio::AsyncResult> ((GObject*)(object), take_copy)) );
40   //We use dynamic_cast<> in case of multiple inheritance.
41 }
42
43 } // namespace Glib
44
45
46 namespace Gio
47 {
48
49
50 /* The *_Class implementation: */
51
52 const Glib::Interface_Class& AsyncResult_Class::init()
53 {
54   if(!gtype_) // create the GType if necessary
55   {
56     // Glib::Interface_Class has to know the interface init function
57     // in order to add interfaces to implementing types.
58     class_init_func_ = &AsyncResult_Class::iface_init_function;
59
60     // We can not derive from another interface, and it is not necessary anyway.
61     gtype_ = g_async_result_get_type();
62   }
63
64   return *this;
65 }
66
67 void AsyncResult_Class::iface_init_function(void* g_iface, void*)
68 {
69   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
70
71   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
72   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
73   g_assert(klass != 0); 
74
75 #ifdef GLIBMM_VFUNCS_ENABLED
76   klass->get_source_object = &get_source_object_vfunc_callback;
77 #endif //GLIBMM_VFUNCS_ENABLED
78
79 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
80 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
81 }
82
83 #ifdef GLIBMM_VFUNCS_ENABLED
84 GObject* AsyncResult_Class::get_source_object_vfunc_callback(GAsyncResult* self)
85 {
86   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
87       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
88
89   // Non-gtkmmproc-generated custom classes implicitly call the default
90   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
91   // generated classes can use this optimisation, which avoids the unnecessary
92   // parameter conversions if there is no possibility of the virtual function
93   // being overridden:
94   if(obj_base && obj_base->is_derived_())
95   {
96     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
97     if(obj) // This can be NULL during destruction.
98     {
99       #ifdef GLIBMM_EXCEPTIONS_ENABLED
100       try // Trap C++ exceptions which would normally be lost because this is a C callback.
101       {
102       #endif //GLIBMM_EXCEPTIONS_ENABLED
103         // Call the virtual member method, which derived classes might override.
104         return Glib::unwrap(obj->get_source_object_vfunc());
105       #ifdef GLIBMM_EXCEPTIONS_ENABLED
106       }
107       catch(...)
108       {
109         Glib::exception_handlers_invoke();
110       }
111       #endif //GLIBMM_EXCEPTIONS_ENABLED
112     }
113   }
114   
115   BaseClassType *const base = static_cast<BaseClassType*>(
116       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
117 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
118 )  );
119
120   // Call the original underlying C function:
121   if(base && base->get_source_object)
122     return (*base->get_source_object)(self);
123
124
125   typedef GObject* RType;
126   return RType();
127 }
128 #endif //GLIBMM_VFUNCS_ENABLED
129
130 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
131 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
132
133
134 Glib::ObjectBase* AsyncResult_Class::wrap_new(GObject* object)
135 {
136   return new AsyncResult((GAsyncResult*)(object));
137 }
138
139
140 /* The implementation: */
141
142 AsyncResult::AsyncResult()
143 :
144   Glib::Interface(asyncresult_class_.init())
145 {}
146
147 AsyncResult::AsyncResult(GAsyncResult* castitem)
148 :
149   Glib::Interface((GObject*)(castitem))
150 {}
151
152 AsyncResult::AsyncResult(const Glib::Interface_Class& interface_class)
153 : Glib::Interface(interface_class)
154 {
155 }
156
157 AsyncResult::~AsyncResult()
158 {}
159
160 // static
161 void AsyncResult::add_interface(GType gtype_implementer)
162 {
163   asyncresult_class_.init().add_interface(gtype_implementer);
164 }
165
166 AsyncResult::CppClassType AsyncResult::asyncresult_class_; // initialize static member
167
168 GType AsyncResult::get_type()
169 {
170   return asyncresult_class_.init().get_type();
171 }
172
173 GType AsyncResult::get_base_type()
174 {
175   return g_async_result_get_type();
176 }
177
178
179 Glib::RefPtr<Glib::Object> AsyncResult::get_source_object()
180 {
181   return Glib::wrap(g_async_result_get_source_object(gobj()));
182 }
183
184 Glib::RefPtr<const Glib::Object> AsyncResult::get_source_object() const
185 {
186   return const_cast<AsyncResult*>(this)->get_source_object();
187 }
188
189
190 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
191 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
192
193 #ifdef GLIBMM_VFUNCS_ENABLED
194 Glib::RefPtr<Glib::Object> Gio::AsyncResult::get_source_object_vfunc() 
195 {
196   BaseClassType *const base = static_cast<BaseClassType*>(
197       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
198 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
199 )  );
200
201   if(base && base->get_source_object)
202     return Glib::wrap((*base->get_source_object)(gobj()));
203
204   typedef Glib::RefPtr<Glib::Object> RType;
205   return RType();
206 }
207 #endif //GLIBMM_VFUNCS_ENABLED
208
209
210 } // namespace Gio
211
212