Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / giomm / fileenumerator.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/fileenumerator.h>
5 #include <giomm/private/fileenumerator_p.h>
6
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
8
9 /* Copyright (C) 2007 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 <giomm/file.h>
28 #include <glibmm/error.h>
29 #include <glibmm/exceptionhandler.h>
30 #include "slot_async.h"
31
32 namespace Gio
33 {
34
35 void
36 FileEnumerator::next_files_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int num_files, int io_priority)
37 {
38   // Create a copy of the slot.
39   // A pointer to it will be passed through the callback's data parameter
40   // and deleted in the callback.
41   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
42
43   g_file_enumerator_next_files_async(gobj(),
44                                      num_files,
45                                      io_priority,
46                                      cancellable->gobj(),
47                                      &SignalProxy_async_callback,
48                                      slot_copy);
49 }
50
51 void
52 FileEnumerator::next_files_async(const SlotAsyncReady& slot, int num_files, int io_priority)
53 {
54   // Create a copy of the slot.
55   // A pointer to it will be passed through the callback's data parameter
56   // and deleted in the callback.
57   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
58
59   g_file_enumerator_next_files_async(gobj(),
60                                      num_files,
61                                      io_priority,
62                                      NULL, // cancellable
63                                      &SignalProxy_async_callback,
64                                      slot_copy);
65 }
66
67 void
68 FileEnumerator::close_async(int io_priority,
69                             const Glib::RefPtr<Cancellable>& cancellable,
70                             const SlotAsyncReady& slot)
71 {
72 // Create a copy of the slot.
73   // A pointer to it will be passed through the callback's data parameter
74   // and deleted in the callback.
75   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
76
77   g_file_enumerator_close_async(gobj(),
78                                 io_priority,
79                                 cancellable->gobj(),
80                                 &SignalProxy_async_callback,
81                                 slot_copy);
82 }
83
84 void
85 FileEnumerator::close_async(int io_priority,
86                             const SlotAsyncReady& slot)
87 {
88   // Create a copy of the slot.
89   // A pointer to it will be passed through the callback's data parameter
90   // and deleted in the callback.
91   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
92
93   g_file_enumerator_close_async(gobj(),
94                                 io_priority,
95                                 NULL, // cancellable
96                                 &SignalProxy_async_callback,
97                                 slot_copy);
98 }
99
100 #ifdef GLIBMM_EXCEPTIONS_ENABLED
101 Glib::RefPtr<FileInfo> FileEnumerator::next_file()
102 #else
103 Glib::RefPtr<FileInfo> FileEnumerator::next_file(std::auto_ptr<Glib::Error>& error)
104 #endif //GLIBMM_EXCEPTIONS_ENABLED
105 {
106   GError* gerror = 0;
107   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), NULL, &(gerror)));
108 #ifdef GLIBMM_EXCEPTIONS_ENABLED
109   if(gerror)
110     ::Glib::Error::throw_exception(gerror);
111 #else
112   if(gerror)
113     error = ::Glib::Error::throw_exception(gerror);
114 #endif //GLIBMM_EXCEPTIONS_ENABLED
115
116   return retvalue;
117 }
118
119 #ifdef GLIBMM_EXCEPTIONS_ENABLED
120 bool FileEnumerator::close()
121 #else
122 bool FileEnumerator::close(std::auto_ptr<Glib::Error>& error)
123 #endif //GLIBMM_EXCEPTIONS_ENABLED
124 {
125   GError* gerror = 0;
126   bool retvalue = g_file_enumerator_close(gobj(), NULL, &(gerror));
127 #ifdef GLIBMM_EXCEPTIONS_ENABLED
128   if(gerror)
129     ::Glib::Error::throw_exception(gerror);
130 #else
131   if(gerror)
132     error = ::Glib::Error::throw_exception(gerror);
133 #endif //GLIBMM_EXCEPTIONS_ENABLED
134
135   return retvalue;
136 }
137
138 } // namespace Gio
139
140 namespace
141 {
142 } // anonymous namespace
143
144
145 namespace Glib
146 {
147
148 Glib::RefPtr<Gio::FileEnumerator> wrap(GFileEnumerator* object, bool take_copy)
149 {
150   return Glib::RefPtr<Gio::FileEnumerator>( dynamic_cast<Gio::FileEnumerator*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
151   //We use dynamic_cast<> in case of multiple inheritance.
152 }
153
154 } /* namespace Glib */
155
156
157 namespace Gio
158 {
159
160
161 /* The *_Class implementation: */
162
163 const Glib::Class& FileEnumerator_Class::init()
164 {
165   if(!gtype_) // create the GType if necessary
166   {
167     // Glib::Class has to know the class init function to clone custom types.
168     class_init_func_ = &FileEnumerator_Class::class_init_function;
169
170     // This is actually just optimized away, apparently with no harm.
171     // Make sure that the parent type has been created.
172     //CppClassParent::CppObjectType::get_type();
173
174     // Create the wrapper type, with the same class/instance size as the base type.
175     register_derived_type(g_file_enumerator_get_type());
176
177     // Add derived versions of interfaces, if the C type implements any interfaces:
178
179   }
180
181   return *this;
182 }
183
184 void FileEnumerator_Class::class_init_function(void* g_class, void* class_data)
185 {
186   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
187   CppClassParent::class_init_function(klass, class_data);
188
189 #ifdef GLIBMM_VFUNCS_ENABLED
190 #endif //GLIBMM_VFUNCS_ENABLED
191
192 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
193 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
194 }
195
196 #ifdef GLIBMM_VFUNCS_ENABLED
197 #endif //GLIBMM_VFUNCS_ENABLED
198
199 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
200 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
201
202
203 Glib::ObjectBase* FileEnumerator_Class::wrap_new(GObject* object)
204 {
205   return new FileEnumerator((GFileEnumerator*)object);
206 }
207
208
209 /* The implementation: */
210
211 GFileEnumerator* FileEnumerator::gobj_copy()
212 {
213   reference();
214   return gobj();
215 }
216
217 FileEnumerator::FileEnumerator(const Glib::ConstructParams& construct_params)
218 :
219   Glib::Object(construct_params)
220 {
221
222 }
223
224 FileEnumerator::FileEnumerator(GFileEnumerator* castitem)
225 :
226   Glib::Object((GObject*)(castitem))
227 {}
228
229
230 FileEnumerator::~FileEnumerator()
231 {}
232
233
234 FileEnumerator::CppClassType FileEnumerator::fileenumerator_class_; // initialize static member
235
236 GType FileEnumerator::get_type()
237 {
238   return fileenumerator_class_.init().get_type();
239 }
240
241 GType FileEnumerator::get_base_type()
242 {
243   return g_file_enumerator_get_type();
244 }
245
246
247 #ifdef GLIBMM_EXCEPTIONS_ENABLED
248 Glib::RefPtr<FileInfo> FileEnumerator::next_file(const Glib::RefPtr<Cancellable>& cancellable)
249 #else
250 Glib::RefPtr<FileInfo> FileEnumerator::next_file(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
251 #endif //GLIBMM_EXCEPTIONS_ENABLED
252 {
253   GError* gerror = 0;
254   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
255 #ifdef GLIBMM_EXCEPTIONS_ENABLED
256   if(gerror)
257     ::Glib::Error::throw_exception(gerror);
258 #else
259   if(gerror)
260     error = ::Glib::Error::throw_exception(gerror);
261 #endif //GLIBMM_EXCEPTIONS_ENABLED
262
263   return retvalue;
264
265 }
266
267 #ifdef GLIBMM_EXCEPTIONS_ENABLED
268 bool FileEnumerator::close(const Glib::RefPtr<Cancellable>& cancellable)
269 #else
270 bool FileEnumerator::close(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
271 #endif //GLIBMM_EXCEPTIONS_ENABLED
272 {
273   GError* gerror = 0;
274   bool retvalue = g_file_enumerator_close(gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
275 #ifdef GLIBMM_EXCEPTIONS_ENABLED
276   if(gerror)
277     ::Glib::Error::throw_exception(gerror);
278 #else
279   if(gerror)
280     error = ::Glib::Error::throw_exception(gerror);
281 #endif //GLIBMM_EXCEPTIONS_ENABLED
282
283   return retvalue;
284
285 }
286
287 #ifdef GLIBMM_EXCEPTIONS_ENABLED
288 Glib::ListHandle< Glib::RefPtr<FileInfo> > FileEnumerator::next_files_finish(const Glib::RefPtr<AsyncResult>& result)
289 #else
290 Glib::ListHandle< Glib::RefPtr<FileInfo> > FileEnumerator::next_files_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
291 #endif //GLIBMM_EXCEPTIONS_ENABLED
292 {
293   GError* gerror = 0;
294   Glib::ListHandle< Glib::RefPtr<FileInfo> > retvalue = Glib::ListHandle< Glib::RefPtr<FileInfo> >((g_file_enumerator_next_files_finish(gobj(), Glib::unwrap(result), &(gerror))), Glib::OWNERSHIP_DEEP);
295 #ifdef GLIBMM_EXCEPTIONS_ENABLED
296   if(gerror)
297     ::Glib::Error::throw_exception(gerror);
298 #else
299   if(gerror)
300     error = ::Glib::Error::throw_exception(gerror);
301 #endif //GLIBMM_EXCEPTIONS_ENABLED
302
303   return retvalue;
304
305 }
306
307 #ifdef GLIBMM_EXCEPTIONS_ENABLED
308 bool FileEnumerator::close_finish(const Glib::RefPtr<AsyncResult>& result)
309 #else
310 bool FileEnumerator::close_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
311 #endif //GLIBMM_EXCEPTIONS_ENABLED
312 {
313   GError* gerror = 0;
314   bool retvalue = g_file_enumerator_close_finish(gobj(), Glib::unwrap(result), &(gerror));
315 #ifdef GLIBMM_EXCEPTIONS_ENABLED
316   if(gerror)
317     ::Glib::Error::throw_exception(gerror);
318 #else
319   if(gerror)
320     error = ::Glib::Error::throw_exception(gerror);
321 #endif //GLIBMM_EXCEPTIONS_ENABLED
322
323   return retvalue;
324
325 }
326
327 bool FileEnumerator::is_closed() const
328 {
329   return g_file_enumerator_is_closed(const_cast<GFileEnumerator*>(gobj()));
330 }
331
332 bool FileEnumerator::has_pending() const
333 {
334   return g_file_enumerator_has_pending(const_cast<GFileEnumerator*>(gobj()));
335 }
336
337 void FileEnumerator::set_pending(bool pending)
338 {
339 g_file_enumerator_set_pending(gobj(), static_cast<int>(pending)); 
340 }
341
342 Glib::RefPtr<File> FileEnumerator::get_container()
343 {
344
345   Glib::RefPtr<File> retvalue = Glib::wrap(g_file_enumerator_get_container(gobj()));
346   if(retvalue)
347     retvalue->reference(); //The function does not do a ref for us.
348   return retvalue;
349
350 }
351
352 Glib::RefPtr<const File> FileEnumerator::get_container() const
353 {
354
355   Glib::RefPtr<const File> retvalue = Glib::wrap(g_file_enumerator_get_container(const_cast<GFileEnumerator*>(gobj())));
356   if(retvalue)
357     retvalue->reference(); //The function does not do a ref for us.
358   return retvalue;
359
360 }
361
362
363 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
364 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
365
366 #ifdef GLIBMM_VFUNCS_ENABLED
367 #endif //GLIBMM_VFUNCS_ENABLED
368
369
370 } // namespace Gio
371
372