switch glibmm/giomm to 2.18
[ardour.git] / libs / glibmm2 / gio / giomm / bufferedinputstream.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/bufferedinputstream.h>
5 #include <giomm/private/bufferedinputstream_p.h>
6
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
8
9 /* Copyright (C) 2008 The gtkmm 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/gio.h>
27 #include "slot_async.h"
28
29 namespace Gio
30 {
31 Glib::RefPtr<BufferedInputStream> BufferedInputStream::create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size)
32 {
33     return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, size));
34 }
35
36 #ifdef GLIBMM_EXCEPTIONS_ENABLED
37 gssize BufferedInputStream::fill(gssize count)
38 #else
39 gssize BufferedInputStream::fill(gssize count, std::auto_ptr<Glib::Error>& error)
40 #endif //GLIBMM_EXCEPTIONS_ENABLED
41 {
42   GError* gerror = 0;
43   gssize retvalue = g_buffered_input_stream_fill(const_cast<GBufferedInputStream*>(gobj()), count, NULL, &(gerror));
44 #ifdef GLIBMM_EXCEPTIONS_ENABLED
45   if(gerror)
46     ::Glib::Error::throw_exception(gerror);
47 #else
48   if(gerror)
49     error = ::Glib::Error::throw_exception(gerror);
50 #endif //GLIBMM_EXCEPTIONS_ENABLED
51
52   return retvalue;
53 }
54
55 void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
56                                      gssize count,
57                                      const Glib::RefPtr<Cancellable>& cancellable,
58                                      int io_priority)
59 {
60   // Create a copy of the slot.
61   // A pointer to it will be passed through the callback's data parameter
62   // and deleted in the callback.
63     SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
64
65     g_buffered_input_stream_fill_async(gobj(),
66             count,
67             io_priority,
68             cancellable->gobj(),
69             &SignalProxy_async_callback,
70             slot_copy);
71 }
72
73 void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
74                                      gssize count,
75                                      int io_priority)
76 {
77   // Create a copy of the slot.
78   // A pointer to it will be passed through the callback's data parameter
79   // and deleted in the callback.
80     SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
81
82     g_buffered_input_stream_fill_async(gobj(),
83             count,
84             io_priority,
85             NULL,
86             &SignalProxy_async_callback,
87             slot_copy);
88 }
89
90 #ifdef GLIBMM_EXCEPTIONS_ENABLED
91 int BufferedInputStream::read_byte()
92 #else
93 int BufferedInputStream::read_byte(std::auto_ptr<Glib::Error>& error)
94 #endif //GLIBMM_EXCEPTIONS_ENABLED
95 {
96   GError* gerror = 0;
97   int retvalue = g_buffered_input_stream_read_byte(gobj(), NULL, &(gerror));
98 #ifdef GLIBMM_EXCEPTIONS_ENABLED
99   if(gerror)
100     ::Glib::Error::throw_exception(gerror);
101 #else
102   if(gerror)
103     error = ::Glib::Error::throw_exception(gerror);
104 #endif //GLIBMM_EXCEPTIONS_ENABLED
105
106   return retvalue;
107
108 }
109
110
111 }   // namespace Gio
112
113 namespace
114 {
115 } // anonymous namespace
116
117
118 namespace Glib
119 {
120
121 Glib::RefPtr<Gio::BufferedInputStream> wrap(GBufferedInputStream* object, bool take_copy)
122 {
123   return Glib::RefPtr<Gio::BufferedInputStream>( dynamic_cast<Gio::BufferedInputStream*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
124   //We use dynamic_cast<> in case of multiple inheritance.
125 }
126
127 } /* namespace Glib */
128
129
130 namespace Gio
131 {
132
133
134 /* The *_Class implementation: */
135
136 const Glib::Class& BufferedInputStream_Class::init()
137 {
138   if(!gtype_) // create the GType if necessary
139   {
140     // Glib::Class has to know the class init function to clone custom types.
141     class_init_func_ = &BufferedInputStream_Class::class_init_function;
142
143     // This is actually just optimized away, apparently with no harm.
144     // Make sure that the parent type has been created.
145     //CppClassParent::CppObjectType::get_type();
146
147     // Create the wrapper type, with the same class/instance size as the base type.
148     register_derived_type(g_buffered_input_stream_get_type());
149
150     // Add derived versions of interfaces, if the C type implements any interfaces:
151
152   }
153
154   return *this;
155 }
156
157 void BufferedInputStream_Class::class_init_function(void* g_class, void* class_data)
158 {
159   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
160   CppClassParent::class_init_function(klass, class_data);
161
162 #ifdef GLIBMM_VFUNCS_ENABLED
163 #endif //GLIBMM_VFUNCS_ENABLED
164
165 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
166 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
167 }
168
169 #ifdef GLIBMM_VFUNCS_ENABLED
170 #endif //GLIBMM_VFUNCS_ENABLED
171
172 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
173 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
174
175
176 Glib::ObjectBase* BufferedInputStream_Class::wrap_new(GObject* object)
177 {
178   return new BufferedInputStream((GBufferedInputStream*)object);
179 }
180
181
182 /* The implementation: */
183
184 GBufferedInputStream* BufferedInputStream::gobj_copy()
185 {
186   reference();
187   return gobj();
188 }
189
190 BufferedInputStream::BufferedInputStream(const Glib::ConstructParams& construct_params)
191 :
192   Gio::FilterInputStream(construct_params)
193 {
194
195 }
196
197 BufferedInputStream::BufferedInputStream(GBufferedInputStream* castitem)
198 :
199   Gio::FilterInputStream((GFilterInputStream*)(castitem))
200 {}
201
202
203 BufferedInputStream::~BufferedInputStream()
204 {}
205
206
207 BufferedInputStream::CppClassType BufferedInputStream::bufferedinputstream_class_; // initialize static member
208
209 GType BufferedInputStream::get_type()
210 {
211   return bufferedinputstream_class_.init().get_type();
212 }
213
214 GType BufferedInputStream::get_base_type()
215 {
216   return g_buffered_input_stream_get_type();
217 }
218
219
220 BufferedInputStream::BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream)
221 :
222   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
223   Glib::ObjectBase(0),
224   Gio::FilterInputStream(Glib::ConstructParams(bufferedinputstream_class_.init(), "base_stream", const_cast<GInputStream*>(Glib::unwrap(base_stream)), static_cast<char*>(0)))
225 {
226   
227
228 }
229
230 BufferedInputStream::BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream, gsize size)
231 :
232   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
233   Glib::ObjectBase(0),
234   Gio::FilterInputStream(Glib::ConstructParams(bufferedinputstream_class_.init(), "base_stream", const_cast<GInputStream*>(Glib::unwrap(base_stream)), "size", size, static_cast<char*>(0)))
235 {
236   
237
238 }
239
240 Glib::RefPtr<BufferedInputStream> BufferedInputStream::create(const Glib::RefPtr<InputStream>& base_stream)
241 {
242   return Glib::RefPtr<BufferedInputStream>( new BufferedInputStream(base_stream) );
243 }
244 gsize BufferedInputStream::get_buffer_size() const
245 {
246   return g_buffered_input_stream_get_buffer_size(const_cast<GBufferedInputStream*>(gobj()));
247 }
248
249 void BufferedInputStream::set_buffer_size(gsize size)
250 {
251 g_buffered_input_stream_set_buffer_size(gobj(), size); 
252 }
253
254 gsize BufferedInputStream::get_available() const
255 {
256   return g_buffered_input_stream_get_available(const_cast<GBufferedInputStream*>(gobj()));
257 }
258
259 gsize BufferedInputStream::peek(void* buffer, gsize offset, gsize count) const
260 {
261   return g_buffered_input_stream_peek(const_cast<GBufferedInputStream*>(gobj()), buffer, offset, count);
262 }
263
264 const void* BufferedInputStream::peek_buffer(gsize& count) const
265 {
266   return g_buffered_input_stream_peek_buffer(const_cast<GBufferedInputStream*>(gobj()), &(count));
267 }
268
269 #ifdef GLIBMM_EXCEPTIONS_ENABLED
270 gssize BufferedInputStream::fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable)
271 #else
272 gssize BufferedInputStream::fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
273 #endif //GLIBMM_EXCEPTIONS_ENABLED
274 {
275   GError* gerror = 0;
276   gssize retvalue = g_buffered_input_stream_fill(gobj(), count, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
277 #ifdef GLIBMM_EXCEPTIONS_ENABLED
278   if(gerror)
279     ::Glib::Error::throw_exception(gerror);
280 #else
281   if(gerror)
282     error = ::Glib::Error::throw_exception(gerror);
283 #endif //GLIBMM_EXCEPTIONS_ENABLED
284
285   return retvalue;
286
287 }
288
289 #ifdef GLIBMM_EXCEPTIONS_ENABLED
290 gssize BufferedInputStream::fill_finish(const Glib::RefPtr<AsyncResult>& result)
291 #else
292 gssize BufferedInputStream::fill_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
293 #endif //GLIBMM_EXCEPTIONS_ENABLED
294 {
295   GError* gerror = 0;
296   gssize retvalue = g_buffered_input_stream_fill_finish(gobj(), Glib::unwrap(result), &(gerror));
297 #ifdef GLIBMM_EXCEPTIONS_ENABLED
298   if(gerror)
299     ::Glib::Error::throw_exception(gerror);
300 #else
301   if(gerror)
302     error = ::Glib::Error::throw_exception(gerror);
303 #endif //GLIBMM_EXCEPTIONS_ENABLED
304
305   return retvalue;
306
307 }
308
309 #ifdef GLIBMM_EXCEPTIONS_ENABLED
310 int BufferedInputStream::read_byte(const Glib::RefPtr<Cancellable>& cancellable)
311 #else
312 int BufferedInputStream::read_byte(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
313 #endif //GLIBMM_EXCEPTIONS_ENABLED
314 {
315   GError* gerror = 0;
316   int retvalue = g_buffered_input_stream_read_byte(gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
317 #ifdef GLIBMM_EXCEPTIONS_ENABLED
318   if(gerror)
319     ::Glib::Error::throw_exception(gerror);
320 #else
321   if(gerror)
322     error = ::Glib::Error::throw_exception(gerror);
323 #endif //GLIBMM_EXCEPTIONS_ENABLED
324
325   return retvalue;
326
327 }
328
329
330 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
331 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
332
333 #ifdef GLIBMM_VFUNCS_ENABLED
334 #endif //GLIBMM_VFUNCS_ENABLED
335
336
337 } // namespace Gio
338
339