1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GDataOutputStream.html
27  * outPack = gio
28  * outFile = DataOutputStream
29  * strct   = GDataOutputStream
30  * realStrct=
31  * ctorStrct=
32  * clss    = DataOutputStream
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_data_output_stream_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- gio.Cancellable
50  * 	- gio.OutputStream
51  * structWrap:
52  * 	- GCancellable* -> Cancellable
53  * 	- GOutputStream* -> OutputStream
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gio.DataOutputStream;
60 
61 public  import gtkc.giotypes;
62 
63 private import gtkc.gio;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import glib.ErrorG;
70 private import glib.GException;
71 private import gio.Cancellable;
72 private import gio.OutputStream;
73 
74 
75 
76 private import gio.FilterOutputStream;
77 
78 /**
79  * Data output stream implements GOutputStream and includes functions for
80  * writing data directly to an output stream.
81  */
82 public class DataOutputStream : FilterOutputStream
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GDataOutputStream* gDataOutputStream;
87 	
88 	
89 	public GDataOutputStream* getDataOutputStreamStruct()
90 	{
91 		return gDataOutputStream;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected override void* getStruct()
97 	{
98 		return cast(void*)gDataOutputStream;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GDataOutputStream* gDataOutputStream)
105 	{
106 		super(cast(GFilterOutputStream*)gDataOutputStream);
107 		this.gDataOutputStream = gDataOutputStream;
108 	}
109 	
110 	protected override void setStruct(GObject* obj)
111 	{
112 		super.setStruct(obj);
113 		gDataOutputStream = cast(GDataOutputStream*)obj;
114 	}
115 	
116 	/**
117 	 */
118 	
119 	/**
120 	 * Creates a new data output stream for base_stream.
121 	 * Params:
122 	 * baseStream = a GOutputStream.
123 	 * Throws: ConstructionException GTK+ fails to create the object.
124 	 */
125 	public this (OutputStream baseStream)
126 	{
127 		// GDataOutputStream * g_data_output_stream_new (GOutputStream *base_stream);
128 		auto p = g_data_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct());
129 		if(p is null)
130 		{
131 			throw new ConstructionException("null returned by g_data_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct())");
132 		}
133 		this(cast(GDataOutputStream*) p);
134 	}
135 	
136 	/**
137 	 * Sets the byte order of the data output stream to order.
138 	 * Params:
139 	 * order = a GDataStreamByteOrder.
140 	 */
141 	public void setByteOrder(GDataStreamByteOrder order)
142 	{
143 		// void g_data_output_stream_set_byte_order (GDataOutputStream *stream,  GDataStreamByteOrder order);
144 		g_data_output_stream_set_byte_order(gDataOutputStream, order);
145 	}
146 	
147 	/**
148 	 * Gets the byte order for the stream.
149 	 * Returns: the GDataStreamByteOrder for the stream.
150 	 */
151 	public GDataStreamByteOrder getByteOrder()
152 	{
153 		// GDataStreamByteOrder g_data_output_stream_get_byte_order  (GDataOutputStream *stream);
154 		return g_data_output_stream_get_byte_order(gDataOutputStream);
155 	}
156 	
157 	/**
158 	 * Puts a byte into the output stream.
159 	 * Params:
160 	 * data = a guchar.
161 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
162 	 * Returns: TRUE if data was successfully added to the stream.
163 	 * Throws: GException on failure.
164 	 */
165 	public int putByte(char data, Cancellable cancellable)
166 	{
167 		// gboolean g_data_output_stream_put_byte (GDataOutputStream *stream,  guchar data,  GCancellable *cancellable,  GError **error);
168 		GError* err = null;
169 		
170 		auto p = g_data_output_stream_put_byte(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
171 		
172 		if (err !is null)
173 		{
174 			throw new GException( new ErrorG(err) );
175 		}
176 		
177 		return p;
178 	}
179 	
180 	/**
181 	 * Puts a signed 16-bit integer into the output stream.
182 	 * Params:
183 	 * data = a gint16.
184 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
185 	 * Returns: TRUE if data was successfully added to the stream.
186 	 * Throws: GException on failure.
187 	 */
188 	public int putInt16(short data, Cancellable cancellable)
189 	{
190 		// gboolean g_data_output_stream_put_int16 (GDataOutputStream *stream,  gint16 data,  GCancellable *cancellable,  GError **error);
191 		GError* err = null;
192 		
193 		auto p = g_data_output_stream_put_int16(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
194 		
195 		if (err !is null)
196 		{
197 			throw new GException( new ErrorG(err) );
198 		}
199 		
200 		return p;
201 	}
202 	
203 	/**
204 	 * Puts an unsigned 16-bit integer into the output stream.
205 	 * Params:
206 	 * data = a guint16.
207 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
208 	 * Returns: TRUE if data was successfully added to the stream.
209 	 * Throws: GException on failure.
210 	 */
211 	public int putUint16(ushort data, Cancellable cancellable)
212 	{
213 		// gboolean g_data_output_stream_put_uint16 (GDataOutputStream *stream,  guint16 data,  GCancellable *cancellable,  GError **error);
214 		GError* err = null;
215 		
216 		auto p = g_data_output_stream_put_uint16(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
217 		
218 		if (err !is null)
219 		{
220 			throw new GException( new ErrorG(err) );
221 		}
222 		
223 		return p;
224 	}
225 	
226 	/**
227 	 * Puts a signed 32-bit integer into the output stream.
228 	 * Params:
229 	 * data = a gint32.
230 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
231 	 * Returns: TRUE if data was successfully added to the stream.
232 	 * Throws: GException on failure.
233 	 */
234 	public int putInt32(int data, Cancellable cancellable)
235 	{
236 		// gboolean g_data_output_stream_put_int32 (GDataOutputStream *stream,  gint32 data,  GCancellable *cancellable,  GError **error);
237 		GError* err = null;
238 		
239 		auto p = g_data_output_stream_put_int32(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
240 		
241 		if (err !is null)
242 		{
243 			throw new GException( new ErrorG(err) );
244 		}
245 		
246 		return p;
247 	}
248 	
249 	/**
250 	 * Puts an unsigned 32-bit integer into the stream.
251 	 * Params:
252 	 * data = a guint32.
253 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
254 	 * Returns: TRUE if data was successfully added to the stream.
255 	 * Throws: GException on failure.
256 	 */
257 	public int putUint32(uint data, Cancellable cancellable)
258 	{
259 		// gboolean g_data_output_stream_put_uint32 (GDataOutputStream *stream,  guint32 data,  GCancellable *cancellable,  GError **error);
260 		GError* err = null;
261 		
262 		auto p = g_data_output_stream_put_uint32(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
263 		
264 		if (err !is null)
265 		{
266 			throw new GException( new ErrorG(err) );
267 		}
268 		
269 		return p;
270 	}
271 	
272 	/**
273 	 * Puts a signed 64-bit integer into the stream.
274 	 * Params:
275 	 * data = a gint64.
276 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
277 	 * Returns: TRUE if data was successfully added to the stream.
278 	 * Throws: GException on failure.
279 	 */
280 	public int putInt64(long data, Cancellable cancellable)
281 	{
282 		// gboolean g_data_output_stream_put_int64 (GDataOutputStream *stream,  gint64 data,  GCancellable *cancellable,  GError **error);
283 		GError* err = null;
284 		
285 		auto p = g_data_output_stream_put_int64(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
286 		
287 		if (err !is null)
288 		{
289 			throw new GException( new ErrorG(err) );
290 		}
291 		
292 		return p;
293 	}
294 	
295 	/**
296 	 * Puts an unsigned 64-bit integer into the stream.
297 	 * Params:
298 	 * data = a guint64.
299 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
300 	 * Returns: TRUE if data was successfully added to the stream.
301 	 * Throws: GException on failure.
302 	 */
303 	public int putUint64(ulong data, Cancellable cancellable)
304 	{
305 		// gboolean g_data_output_stream_put_uint64 (GDataOutputStream *stream,  guint64 data,  GCancellable *cancellable,  GError **error);
306 		GError* err = null;
307 		
308 		auto p = g_data_output_stream_put_uint64(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
309 		
310 		if (err !is null)
311 		{
312 			throw new GException( new ErrorG(err) );
313 		}
314 		
315 		return p;
316 	}
317 	
318 	/**
319 	 * Puts a string into the output stream.
320 	 * Params:
321 	 * str = a string.
322 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
323 	 * Returns: TRUE if string was successfully added to the stream.
324 	 * Throws: GException on failure.
325 	 */
326 	public int putString(string str, Cancellable cancellable)
327 	{
328 		// gboolean g_data_output_stream_put_string (GDataOutputStream *stream,  const char *str,  GCancellable *cancellable,  GError **error);
329 		GError* err = null;
330 		
331 		auto p = g_data_output_stream_put_string(gDataOutputStream, Str.toStringz(str), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
332 		
333 		if (err !is null)
334 		{
335 			throw new GException( new ErrorG(err) );
336 		}
337 		
338 		return p;
339 	}
340 }