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 * Description 80 * Data output stream implements GOutputStream and includes functions for 81 * writing data directly to an output stream. 82 */ 83 public class DataOutputStream : FilterOutputStream 84 { 85 86 /** the main Gtk struct */ 87 protected GDataOutputStream* gDataOutputStream; 88 89 90 public GDataOutputStream* getDataOutputStreamStruct() 91 { 92 return gDataOutputStream; 93 } 94 95 96 /** the main Gtk struct as a void* */ 97 protected override void* getStruct() 98 { 99 return cast(void*)gDataOutputStream; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class 104 */ 105 public this (GDataOutputStream* gDataOutputStream) 106 { 107 super(cast(GFilterOutputStream*)gDataOutputStream); 108 this.gDataOutputStream = gDataOutputStream; 109 } 110 111 protected override void setStruct(GObject* obj) 112 { 113 super.setStruct(obj); 114 gDataOutputStream = cast(GDataOutputStream*)obj; 115 } 116 117 /** 118 */ 119 120 /** 121 * Creates a new data output stream for base_stream. 122 * Params: 123 * baseStream = a GOutputStream. 124 * Throws: ConstructionException GTK+ fails to create the object. 125 */ 126 public this (OutputStream baseStream) 127 { 128 // GDataOutputStream * g_data_output_stream_new (GOutputStream *base_stream); 129 auto p = g_data_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct()); 130 if(p is null) 131 { 132 throw new ConstructionException("null returned by g_data_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct())"); 133 } 134 this(cast(GDataOutputStream*) p); 135 } 136 137 /** 138 * Sets the byte order of the data output stream to order. 139 * Params: 140 * order = a GDataStreamByteOrder. 141 */ 142 public void setByteOrder(GDataStreamByteOrder order) 143 { 144 // void g_data_output_stream_set_byte_order (GDataOutputStream *stream, GDataStreamByteOrder order); 145 g_data_output_stream_set_byte_order(gDataOutputStream, order); 146 } 147 148 /** 149 * Gets the byte order for the stream. 150 * Returns: the GDataStreamByteOrder for the stream. 151 */ 152 public GDataStreamByteOrder getByteOrder() 153 { 154 // GDataStreamByteOrder g_data_output_stream_get_byte_order (GDataOutputStream *stream); 155 return g_data_output_stream_get_byte_order(gDataOutputStream); 156 } 157 158 /** 159 * Puts a byte into the output stream. 160 * Params: 161 * data = a guchar. 162 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 163 * Returns: TRUE if data was successfully added to the stream. 164 * Throws: GException on failure. 165 */ 166 public int putByte(char data, Cancellable cancellable) 167 { 168 // gboolean g_data_output_stream_put_byte (GDataOutputStream *stream, guchar data, GCancellable *cancellable, GError **error); 169 GError* err = null; 170 171 auto p = g_data_output_stream_put_byte(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 172 173 if (err !is null) 174 { 175 throw new GException( new ErrorG(err) ); 176 } 177 178 return p; 179 } 180 181 /** 182 * Puts a signed 16-bit integer into the output stream. 183 * Params: 184 * data = a gint16. 185 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 186 * Returns: TRUE if data was successfully added to the stream. 187 * Throws: GException on failure. 188 */ 189 public int putInt16(short data, Cancellable cancellable) 190 { 191 // gboolean g_data_output_stream_put_int16 (GDataOutputStream *stream, gint16 data, GCancellable *cancellable, GError **error); 192 GError* err = null; 193 194 auto p = g_data_output_stream_put_int16(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 195 196 if (err !is null) 197 { 198 throw new GException( new ErrorG(err) ); 199 } 200 201 return p; 202 } 203 204 /** 205 * Puts an unsigned 16-bit integer into the output stream. 206 * Params: 207 * data = a guint16. 208 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 209 * Returns: TRUE if data was successfully added to the stream. 210 * Throws: GException on failure. 211 */ 212 public int putUint16(ushort data, Cancellable cancellable) 213 { 214 // gboolean g_data_output_stream_put_uint16 (GDataOutputStream *stream, guint16 data, GCancellable *cancellable, GError **error); 215 GError* err = null; 216 217 auto p = g_data_output_stream_put_uint16(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 218 219 if (err !is null) 220 { 221 throw new GException( new ErrorG(err) ); 222 } 223 224 return p; 225 } 226 227 /** 228 * Puts a signed 32-bit integer into the output stream. 229 * Params: 230 * data = a gint32. 231 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 232 * Returns: TRUE if data was successfully added to the stream. 233 * Throws: GException on failure. 234 */ 235 public int putInt32(int data, Cancellable cancellable) 236 { 237 // gboolean g_data_output_stream_put_int32 (GDataOutputStream *stream, gint32 data, GCancellable *cancellable, GError **error); 238 GError* err = null; 239 240 auto p = g_data_output_stream_put_int32(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 241 242 if (err !is null) 243 { 244 throw new GException( new ErrorG(err) ); 245 } 246 247 return p; 248 } 249 250 /** 251 * Puts an unsigned 32-bit integer into the stream. 252 * Params: 253 * data = a guint32. 254 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 255 * Returns: TRUE if data was successfully added to the stream. 256 * Throws: GException on failure. 257 */ 258 public int putUint32(uint data, Cancellable cancellable) 259 { 260 // gboolean g_data_output_stream_put_uint32 (GDataOutputStream *stream, guint32 data, GCancellable *cancellable, GError **error); 261 GError* err = null; 262 263 auto p = g_data_output_stream_put_uint32(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 264 265 if (err !is null) 266 { 267 throw new GException( new ErrorG(err) ); 268 } 269 270 return p; 271 } 272 273 /** 274 * Puts a signed 64-bit integer into the stream. 275 * Params: 276 * data = a gint64. 277 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 278 * Returns: TRUE if data was successfully added to the stream. 279 * Throws: GException on failure. 280 */ 281 public int putInt64(long data, Cancellable cancellable) 282 { 283 // gboolean g_data_output_stream_put_int64 (GDataOutputStream *stream, gint64 data, GCancellable *cancellable, GError **error); 284 GError* err = null; 285 286 auto p = g_data_output_stream_put_int64(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 287 288 if (err !is null) 289 { 290 throw new GException( new ErrorG(err) ); 291 } 292 293 return p; 294 } 295 296 /** 297 * Puts an unsigned 64-bit integer into the stream. 298 * Params: 299 * data = a guint64. 300 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 301 * Returns: TRUE if data was successfully added to the stream. 302 * Throws: GException on failure. 303 */ 304 public int putUint64(ulong data, Cancellable cancellable) 305 { 306 // gboolean g_data_output_stream_put_uint64 (GDataOutputStream *stream, guint64 data, GCancellable *cancellable, GError **error); 307 GError* err = null; 308 309 auto p = g_data_output_stream_put_uint64(gDataOutputStream, data, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 310 311 if (err !is null) 312 { 313 throw new GException( new ErrorG(err) ); 314 } 315 316 return p; 317 } 318 319 /** 320 * Puts a string into the output stream. 321 * Params: 322 * str = a string. 323 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 324 * Returns: TRUE if string was successfully added to the stream. 325 * Throws: GException on failure. 326 */ 327 public int putString(string str, Cancellable cancellable) 328 { 329 // gboolean g_data_output_stream_put_string (GDataOutputStream *stream, const char *str, GCancellable *cancellable, GError **error); 330 GError* err = null; 331 332 auto p = g_data_output_stream_put_string(gDataOutputStream, Str.toStringz(str), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 333 334 if (err !is null) 335 { 336 throw new GException( new ErrorG(err) ); 337 } 338 339 return p; 340 } 341 }