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