1 // Generated by gmmproc 2.56.0 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <atkmm/streamablecontent.h>
7 #include <atkmm/private/streamablecontent_p.h>
8
9
10 // -*- c++ -*-
11 /* $Id: streamablecontent.ccg,v 1.1 2004/01/02 09:56:43 murrayc Exp $ */
12
13 /* Copyright 2003 The gtkmm Development Team
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30 #include <atkmm/object.h>
31 #include <atk/atkstreamablecontent.h>
32
33
34 namespace Atk
35 {
36
37
38 } // namespace Atk
39
40
41 namespace
42 {
43 } // anonymous namespace
44
45
46 namespace Glib
47 {
48
wrap(AtkStreamableContent * object,bool take_copy)49 Glib::RefPtr<Atk::StreamableContent> wrap(AtkStreamableContent* object, bool take_copy)
50 {
51 return Glib::RefPtr<Atk::StreamableContent>( dynamic_cast<Atk::StreamableContent*> (Glib::wrap_auto_interface<Atk::StreamableContent> ((GObject*)(object), take_copy)) );
52 //We use dynamic_cast<> in case of multiple inheritance.
53 }
54
55 } // namespace Glib
56
57
58 namespace Atk
59 {
60
61
62 /* The *_Class implementation: */
63
init()64 const Glib::Interface_Class& StreamableContent_Class::init()
65 {
66 if(!gtype_) // create the GType if necessary
67 {
68 // Glib::Interface_Class has to know the interface init function
69 // in order to add interfaces to implementing types.
70 class_init_func_ = &StreamableContent_Class::iface_init_function;
71
72 // We can not derive from another interface, and it is not necessary anyway.
73 gtype_ = atk_streamable_content_get_type();
74 }
75
76 return *this;
77 }
78
iface_init_function(void * g_iface,void *)79 void StreamableContent_Class::iface_init_function(void* g_iface, void*)
80 {
81 const auto klass = static_cast<BaseClassType*>(g_iface);
82
83 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
84 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
85 g_assert(klass != nullptr);
86
87 klass->get_n_mime_types = &get_n_mime_types_vfunc_callback;
88 klass->get_mime_type = &get_mime_type_vfunc_callback;
89 klass->get_stream = &get_stream_vfunc_callback;
90
91 }
92
get_n_mime_types_vfunc_callback(AtkStreamableContent * self)93 int StreamableContent_Class::get_n_mime_types_vfunc_callback(AtkStreamableContent* self)
94 {
95 const auto obj_base = static_cast<Glib::ObjectBase*>(
96 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
97
98 // Non-gtkmmproc-generated custom classes implicitly call the default
99 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
100 // generated classes can use this optimisation, which avoids the unnecessary
101 // parameter conversions if there is no possibility of the virtual function
102 // being overridden:
103 if(obj_base && obj_base->is_derived_())
104 {
105 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
106 if(obj) // This can be NULL during destruction.
107 {
108 try // Trap C++ exceptions which would normally be lost because this is a C callback.
109 {
110 // Call the virtual member method, which derived classes might override.
111 return obj->get_n_mime_types_vfunc();
112 }
113 catch(...)
114 {
115 Glib::exception_handlers_invoke();
116 }
117 }
118 }
119
120 BaseClassType *const base = static_cast<BaseClassType*>(
121 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
122 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
123 ) );
124
125 // Call the original underlying C function:
126 if(base && base->get_n_mime_types)
127 return (*base->get_n_mime_types)(self);
128
129 using RType = int;
130 return RType();
131 }
get_mime_type_vfunc_callback(AtkStreamableContent * self,gint i)132 const gchar* StreamableContent_Class::get_mime_type_vfunc_callback(AtkStreamableContent* self, gint i)
133 {
134 const auto obj_base = static_cast<Glib::ObjectBase*>(
135 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
136
137 // Non-gtkmmproc-generated custom classes implicitly call the default
138 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
139 // generated classes can use this optimisation, which avoids the unnecessary
140 // parameter conversions if there is no possibility of the virtual function
141 // being overridden:
142 if(obj_base && obj_base->is_derived_())
143 {
144 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
145 if(obj) // This can be NULL during destruction.
146 {
147 try // Trap C++ exceptions which would normally be lost because this is a C callback.
148 {
149 // Call the virtual member method, which derived classes might override.
150 return obj->get_mime_type_vfunc(i
151 );
152 }
153 catch(...)
154 {
155 Glib::exception_handlers_invoke();
156 }
157 }
158 }
159
160 BaseClassType *const base = static_cast<BaseClassType*>(
161 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
162 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
163 ) );
164
165 // Call the original underlying C function:
166 if(base && base->get_mime_type)
167 return (*base->get_mime_type)(self, i);
168
169 using RType = const gchar*;
170 return RType();
171 }
get_stream_vfunc_callback(AtkStreamableContent * self,const gchar * mime_type)172 GIOChannel* StreamableContent_Class::get_stream_vfunc_callback(AtkStreamableContent* self, const gchar* mime_type)
173 {
174 const auto obj_base = static_cast<Glib::ObjectBase*>(
175 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
176
177 // Non-gtkmmproc-generated custom classes implicitly call the default
178 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
179 // generated classes can use this optimisation, which avoids the unnecessary
180 // parameter conversions if there is no possibility of the virtual function
181 // being overridden:
182 if(obj_base && obj_base->is_derived_())
183 {
184 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
185 if(obj) // This can be NULL during destruction.
186 {
187 try // Trap C++ exceptions which would normally be lost because this is a C callback.
188 {
189 // Call the virtual member method, which derived classes might override.
190 return obj->get_stream_vfunc(Glib::convert_const_gchar_ptr_to_ustring(mime_type)
191 );
192 }
193 catch(...)
194 {
195 Glib::exception_handlers_invoke();
196 }
197 }
198 }
199
200 BaseClassType *const base = static_cast<BaseClassType*>(
201 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
202 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
203 ) );
204
205 // Call the original underlying C function:
206 if(base && base->get_stream)
207 return (*base->get_stream)(self, mime_type);
208
209 using RType = GIOChannel*;
210 return RType();
211 }
212
213
wrap_new(GObject * object)214 Glib::ObjectBase* StreamableContent_Class::wrap_new(GObject* object)
215 {
216 return new StreamableContent((AtkStreamableContent*)(object));
217 }
218
219
220 /* The implementation: */
221
StreamableContent()222 StreamableContent::StreamableContent()
223 :
224 Glib::Interface(streamablecontent_class_.init())
225 {}
226
StreamableContent(AtkStreamableContent * castitem)227 StreamableContent::StreamableContent(AtkStreamableContent* castitem)
228 :
229 Glib::Interface((GObject*)(castitem))
230 {}
231
StreamableContent(const Glib::Interface_Class & interface_class)232 StreamableContent::StreamableContent(const Glib::Interface_Class& interface_class)
233 : Glib::Interface(interface_class)
234 {
235 }
236
StreamableContent(StreamableContent && src)237 StreamableContent::StreamableContent(StreamableContent&& src) noexcept
238 : Glib::Interface(std::move(src))
239 {}
240
operator =(StreamableContent && src)241 StreamableContent& StreamableContent::operator=(StreamableContent&& src) noexcept
242 {
243 Glib::Interface::operator=(std::move(src));
244 return *this;
245 }
246
~StreamableContent()247 StreamableContent::~StreamableContent() noexcept
248 {}
249
250 // static
add_interface(GType gtype_implementer)251 void StreamableContent::add_interface(GType gtype_implementer)
252 {
253 streamablecontent_class_.init().add_interface(gtype_implementer);
254 }
255
256 StreamableContent::CppClassType StreamableContent::streamablecontent_class_; // initialize static member
257
get_type()258 GType StreamableContent::get_type()
259 {
260 return streamablecontent_class_.init().get_type();
261 }
262
263
get_base_type()264 GType StreamableContent::get_base_type()
265 {
266 return atk_streamable_content_get_type();
267 }
268
269
get_n_mime_types() const270 int StreamableContent::get_n_mime_types() const
271 {
272 return atk_streamable_content_get_n_mime_types(const_cast<AtkStreamableContent*>(gobj()));
273 }
274
get_mime_type(int i) const275 Glib::ustring StreamableContent::get_mime_type(int i) const
276 {
277 return Glib::convert_const_gchar_ptr_to_ustring(atk_streamable_content_get_mime_type(const_cast<AtkStreamableContent*>(gobj()), i));
278 }
279
get_stream(const Glib::ustring & mime_type)280 Glib::RefPtr<Glib::IOChannel> StreamableContent::get_stream(const Glib::ustring& mime_type)
281 {
282 return Glib::wrap(atk_streamable_content_get_stream(gobj(), mime_type.c_str()));
283 }
284
285
get_n_mime_types_vfunc() const286 int Atk::StreamableContent::get_n_mime_types_vfunc() const
287 {
288 const auto 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(gobject_), CppObjectType::get_type()) // Get the interface.
291 ) );
292
293 if(base && base->get_n_mime_types)
294 {
295 int retval((*base->get_n_mime_types)(const_cast<AtkStreamableContent*>(gobj())));
296 return retval;
297 }
298
299 using RType = int;
300 return RType();
301 }
get_mime_type_vfunc(int i) const302 const gchar* Atk::StreamableContent::get_mime_type_vfunc(int i) const
303 {
304 const auto base = static_cast<BaseClassType*>(
305 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
306 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
307 ) );
308
309 if(base && base->get_mime_type)
310 {
311 const gchar* retval((*base->get_mime_type)(const_cast<AtkStreamableContent*>(gobj()),i));
312 return retval;
313 }
314
315 using RType = const gchar*;
316 return RType();
317 }
get_stream_vfunc(const Glib::ustring & mime_type)318 GIOChannel* Atk::StreamableContent::get_stream_vfunc(const Glib::ustring& mime_type)
319 {
320 const auto base = static_cast<BaseClassType*>(
321 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
322 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
323 ) );
324
325 if(base && base->get_stream)
326 {
327 GIOChannel* retval((*base->get_stream)(gobj(),mime_type.c_str()));
328 return retval;
329 }
330
331 using RType = GIOChannel*;
332 return RType();
333 }
334
335
336 } // namespace Atk
337
338
339