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