Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / src / dataoutputstream.ccg
1 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
3 /* Copyright (C) 2007 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <gio/gio.h>
21
22 namespace Gio
23 {
24
25 #ifdef GLIBMM_EXCEPTIONS_ENABLED
26 bool DataOutputStream::put_byte(guchar data)
27 #else
28 bool DataOutputStream::put_byte(guchar data, std::auto_ptr<Glib::Error>& error)
29 #endif //GLIBMM_EXCEPTIONS_ENABLED
30 {
31   GError* gerror = 0;
32   guchar retvalue = g_data_output_stream_put_byte(gobj(), data, NULL, &(gerror));
33 #ifdef GLIBMM_EXCEPTIONS_ENABLED
34   if(gerror)
35     ::Glib::Error::throw_exception(gerror);
36 #else
37   if(gerror)
38     error = ::Glib::Error::throw_exception(gerror);
39 #endif //GLIBMM_EXCEPTIONS_ENABLED
40
41   return retvalue;
42 }
43
44 #ifdef GLIBMM_EXCEPTIONS_ENABLED
45 bool DataOutputStream::put_int16(gint16 data)
46 #else
47 bool DataOutputStream::put_int16(gint16 data, std::auto_ptr<Glib::Error>& error)
48 #endif //GLIBMM_EXCEPTIONS_ENABLED
49 {
50   GError* gerror = 0;
51   gint16 retvalue = g_data_output_stream_put_int16(gobj(), data, NULL, &(gerror));
52 #ifdef GLIBMM_EXCEPTIONS_ENABLED
53   if(gerror)
54     ::Glib::Error::throw_exception(gerror);
55 #else
56   if(gerror)
57     error = ::Glib::Error::throw_exception(gerror);
58 #endif //GLIBMM_EXCEPTIONS_ENABLED
59
60   return retvalue;
61 }
62
63 #ifdef GLIBMM_EXCEPTIONS_ENABLED
64 bool DataOutputStream::put_uint16(guint16 data)
65 #else
66 bool DataOutputStream::put_uint16(guint16 data, std::auto_ptr<Glib::Error>& error)
67 #endif //GLIBMM_EXCEPTIONS_ENABLED
68 {
69   GError* gerror = 0;
70   guint16 retvalue = g_data_output_stream_put_uint16(gobj(), data, NULL, &(gerror));
71 #ifdef GLIBMM_EXCEPTIONS_ENABLED
72   if(gerror)
73     ::Glib::Error::throw_exception(gerror);
74 #else
75   if(gerror)
76     error = ::Glib::Error::throw_exception(gerror);
77 #endif //GLIBMM_EXCEPTIONS_ENABLED
78
79   return retvalue;
80 }
81
82 #ifdef GLIBMM_EXCEPTIONS_ENABLED
83 bool DataOutputStream::put_int32(gint32 data)
84 #else
85 bool DataOutputStream::put_int32(gint32 data, std::auto_ptr<Glib::Error>& error)
86 #endif //GLIBMM_EXCEPTIONS_ENABLED
87 {
88   GError* gerror = 0;
89   gint32 retvalue = g_data_output_stream_put_int32(gobj(), data, NULL, &(gerror));
90 #ifdef GLIBMM_EXCEPTIONS_ENABLED
91   if(gerror)
92     ::Glib::Error::throw_exception(gerror);
93 #else
94   if(gerror)
95     error = ::Glib::Error::throw_exception(gerror);
96 #endif //GLIBMM_EXCEPTIONS_ENABLED
97
98   return retvalue;
99 }
100
101 #ifdef GLIBMM_EXCEPTIONS_ENABLED
102 bool DataOutputStream::put_uint32(guint32 data)
103 #else
104 bool DataOutputStream::put_uint32(guint32 data, std::auto_ptr<Glib::Error>& error)
105 #endif //GLIBMM_EXCEPTIONS_ENABLED
106 {
107   GError* gerror = 0;
108   guint32 retvalue = g_data_output_stream_put_uint32(gobj(), data, NULL, &(gerror));
109 #ifdef GLIBMM_EXCEPTIONS_ENABLED
110   if(gerror)
111     ::Glib::Error::throw_exception(gerror);
112 #else
113   if(gerror)
114     error = ::Glib::Error::throw_exception(gerror);
115 #endif //GLIBMM_EXCEPTIONS_ENABLED
116
117   return retvalue;
118 }
119
120 #ifdef GLIBMM_EXCEPTIONS_ENABLED
121 bool DataOutputStream::put_int64(gint64 data)
122 #else
123 bool DataOutputStream::put_int64(gint64 data, std::auto_ptr<Glib::Error>& error)
124 #endif //GLIBMM_EXCEPTIONS_ENABLED
125 {
126   GError* gerror = 0;
127   gint64 retvalue = g_data_output_stream_put_int64(gobj(), data, NULL, &(gerror));
128 #ifdef GLIBMM_EXCEPTIONS_ENABLED
129   if(gerror)
130     ::Glib::Error::throw_exception(gerror);
131 #else
132   if(gerror)
133     error = ::Glib::Error::throw_exception(gerror);
134 #endif //GLIBMM_EXCEPTIONS_ENABLED
135
136   return retvalue;
137 }
138
139 #ifdef GLIBMM_EXCEPTIONS_ENABLED
140 bool DataOutputStream::put_uint64(guint64 data)
141 #else
142 bool DataOutputStream::put_uint64(guint64 data, std::auto_ptr<Glib::Error>& error)
143 #endif //GLIBMM_EXCEPTIONS_ENABLED
144 {
145   GError* gerror = 0;
146   guint64 retvalue = g_data_output_stream_put_uint64(gobj(), data, NULL, &(gerror));
147 #ifdef GLIBMM_EXCEPTIONS_ENABLED
148   if(gerror)
149     ::Glib::Error::throw_exception(gerror);
150 #else
151   if(gerror)
152     error = ::Glib::Error::throw_exception(gerror);
153 #endif //GLIBMM_EXCEPTIONS_ENABLED
154
155   return retvalue;
156 }
157
158 #ifdef GLIBMM_EXCEPTIONS_ENABLED
159 bool DataOutputStream::put_string(std::string str)
160 #else
161 bool DataOutputStream::put_string(std::string str, std::auto_ptr<Glib::Error>& error)
162 #endif //GLIBMM_EXCEPTIONS_ENABLED
163 {
164   GError* gerror = 0;
165   bool retval = g_data_output_stream_put_string(gobj(),
166                                                 str.c_str (),
167                                                 NULL,
168                                                 &gerror);
169 #ifdef GLIBMM_EXCEPTIONS_ENABLED
170   if(gerror)
171     ::Glib::Error::throw_exception(gerror);
172 #else
173   if(gerror)
174     error = ::Glib::Error::throw_exception(gerror);
175 #endif //GLIBMM_EXCEPTIONS_ENABLED
176     return retval;
177 }
178
179
180 } // namespace Gio