Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / giomm / fileoutputstream.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/fileoutputstream.h>
5 #include <giomm/private/fileoutputstream_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 <glib.h>
28 #include <glibmm/error.h>
29 #include <glibmm/exceptionhandler.h>
30 #include "slot_async.h"
31
32 namespace Gio
33 {
34
35 #ifdef GLIBMM_EXCEPTIONS_ENABLED
36 Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
37 #else
38 Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error)
39 #endif //GLIBMM_EXCEPTIONS_ENABLED
40 {
41   GError* gerror = 0;
42   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
43 #ifdef GLIBMM_EXCEPTIONS_ENABLED
44   if(gerror)
45     ::Glib::Error::throw_exception(gerror);
46 #else
47   if(gerror)
48     error = ::Glib::Error::throw_exception(gerror);
49 #endif //GLIBMM_EXCEPTIONS_ENABLED
50
51   if(retvalue)
52     retvalue->reference(); //The function does not do a ref for us.
53   return retvalue;
54 }
55
56 #ifdef GLIBMM_EXCEPTIONS_ENABLED
57 Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes)
58 #else
59 Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error)
60 #endif //GLIBMM_EXCEPTIONS_ENABLED
61 {
62   GError* gerror = 0;
63   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), NULL, &(gerror)));
64 #ifdef GLIBMM_EXCEPTIONS_ENABLED
65   if(gerror)
66     ::Glib::Error::throw_exception(gerror);
67 #else
68   if(gerror)
69     error = ::Glib::Error::throw_exception(gerror);
70 #endif //GLIBMM_EXCEPTIONS_ENABLED
71
72   if(retvalue)
73     retvalue->reference(); //The function does not do a ref for us.
74   return retvalue;
75 }
76
77 void
78 FileOutputStream::query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, int io_priority)
79 {
80   // Create a copy of the slot.
81   // A pointer to it will be passed through the callback's data parameter
82   // and deleted in the callback.
83   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
84
85   g_file_output_stream_query_info_async(gobj(),
86                                         const_cast<char*>(attributes.c_str()),
87                                         io_priority,
88                                         cancellable->gobj(),
89                                         &SignalProxy_async_callback,
90                                         slot_copy);
91 }
92
93 void
94 FileOutputStream::query_info_async(const SlotAsyncReady& slot, const std::string& attributes, int io_priority)
95 {
96   // Create a copy of the slot.
97   // A pointer to it will be passed through the callback's data parameter
98   // and deleted in the callback.
99   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
100
101   g_file_output_stream_query_info_async(gobj(),
102                                         const_cast<char*>(attributes.c_str()),
103                                         io_priority,
104                                         NULL,
105                                         &SignalProxy_async_callback,
106                                         slot_copy);
107 }
108
109 } // namespace Gio
110
111 namespace
112 {
113 } // anonymous namespace
114
115
116 namespace Glib
117 {
118
119 Glib::RefPtr<Gio::FileOutputStream> wrap(GFileOutputStream* object, bool take_copy)
120 {
121   return Glib::RefPtr<Gio::FileOutputStream>( dynamic_cast<Gio::FileOutputStream*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
122   //We use dynamic_cast<> in case of multiple inheritance.
123 }
124
125 } /* namespace Glib */
126
127
128 namespace Gio
129 {
130
131
132 /* The *_Class implementation: */
133
134 const Glib::Class& FileOutputStream_Class::init()
135 {
136   if(!gtype_) // create the GType if necessary
137   {
138     // Glib::Class has to know the class init function to clone custom types.
139     class_init_func_ = &FileOutputStream_Class::class_init_function;
140
141     // This is actually just optimized away, apparently with no harm.
142     // Make sure that the parent type has been created.
143     //CppClassParent::CppObjectType::get_type();
144
145     // Create the wrapper type, with the same class/instance size as the base type.
146     register_derived_type(g_file_output_stream_get_type());
147
148     // Add derived versions of interfaces, if the C type implements any interfaces:
149   Seekable::add_interface(get_type());
150
151   }
152
153   return *this;
154 }
155
156 void FileOutputStream_Class::class_init_function(void* g_class, void* class_data)
157 {
158   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
159   CppClassParent::class_init_function(klass, class_data);
160
161 #ifdef GLIBMM_VFUNCS_ENABLED
162 #endif //GLIBMM_VFUNCS_ENABLED
163
164 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
165 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
166 }
167
168 #ifdef GLIBMM_VFUNCS_ENABLED
169 #endif //GLIBMM_VFUNCS_ENABLED
170
171 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
172 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
173
174
175 Glib::ObjectBase* FileOutputStream_Class::wrap_new(GObject* object)
176 {
177   return new FileOutputStream((GFileOutputStream*)object);
178 }
179
180
181 /* The implementation: */
182
183 GFileOutputStream* FileOutputStream::gobj_copy()
184 {
185   reference();
186   return gobj();
187 }
188
189 FileOutputStream::FileOutputStream(const Glib::ConstructParams& construct_params)
190 :
191   Gio::OutputStream(construct_params)
192 {
193
194 }
195
196 FileOutputStream::FileOutputStream(GFileOutputStream* castitem)
197 :
198   Gio::OutputStream((GOutputStream*)(castitem))
199 {}
200
201
202 FileOutputStream::~FileOutputStream()
203 {}
204
205
206 FileOutputStream::CppClassType FileOutputStream::fileoutputstream_class_; // initialize static member
207
208 GType FileOutputStream::get_type()
209 {
210   return fileoutputstream_class_.init().get_type();
211 }
212
213 GType FileOutputStream::get_base_type()
214 {
215   return g_file_output_stream_get_type();
216 }
217
218
219 #ifdef GLIBMM_EXCEPTIONS_ENABLED
220 Glib::RefPtr<FileInfo> FileOutputStream::query_info_finish(const Glib::RefPtr<AsyncResult>& result)
221 #else
222 Glib::RefPtr<FileInfo> FileOutputStream::query_info_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
223 #endif //GLIBMM_EXCEPTIONS_ENABLED
224 {
225   GError* gerror = 0;
226   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info_finish(gobj(), Glib::unwrap(result), &(gerror)));
227 #ifdef GLIBMM_EXCEPTIONS_ENABLED
228   if(gerror)
229     ::Glib::Error::throw_exception(gerror);
230 #else
231   if(gerror)
232     error = ::Glib::Error::throw_exception(gerror);
233 #endif //GLIBMM_EXCEPTIONS_ENABLED
234
235   if(retvalue)
236     retvalue->reference(); //The function does not do a ref for us.
237   return retvalue;
238
239 }
240
241 std::string FileOutputStream::get_etag() const
242 {
243   return Glib::convert_return_gchar_ptr_to_stdstring(g_file_output_stream_get_etag(const_cast<GFileOutputStream*>(gobj())));
244 }
245
246
247 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
248 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
249
250 #ifdef GLIBMM_VFUNCS_ENABLED
251 #endif //GLIBMM_VFUNCS_ENABLED
252
253
254 } // namespace Gio
255
256