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 module gio.SimpleIOStream; 26 27 private import gio.IOStream; 28 private import gio.InputStream; 29 private import gio.OutputStream; 30 private import gio.c.functions; 31 public import gio.c.types; 32 private import glib.ConstructionException; 33 private import gobject.ObjectG; 34 35 36 /** 37 * GSimpleIOStream creates a #GIOStream from an arbitrary #GInputStream and 38 * #GOutputStream. This allows any pair of input and output streams to be used 39 * with #GIOStream methods. 40 * 41 * This is useful when you obtained a #GInputStream and a #GOutputStream 42 * by other means, for instance creating them with platform specific methods as 43 * g_unix_input_stream_new() or g_win32_input_stream_new(), and you want 44 * to take advantage of the methods provided by #GIOStream. 45 * 46 * Since: 2.44 47 */ 48 public class SimpleIOStream : IOStream 49 { 50 /** the main Gtk struct */ 51 protected GSimpleIOStream* gSimpleIOStream; 52 53 /** Get the main Gtk struct */ 54 public GSimpleIOStream* getSimpleIOStreamStruct(bool transferOwnership = false) 55 { 56 if (transferOwnership) 57 ownedRef = false; 58 return gSimpleIOStream; 59 } 60 61 /** the main Gtk struct as a void* */ 62 protected override void* getStruct() 63 { 64 return cast(void*)gSimpleIOStream; 65 } 66 67 /** 68 * Sets our main struct and passes it to the parent class. 69 */ 70 public this (GSimpleIOStream* gSimpleIOStream, bool ownedRef = false) 71 { 72 this.gSimpleIOStream = gSimpleIOStream; 73 super(cast(GIOStream*)gSimpleIOStream, ownedRef); 74 } 75 76 77 /** */ 78 public static GType getType() 79 { 80 return g_simple_io_stream_get_type(); 81 } 82 83 /** 84 * Creates a new #GSimpleIOStream wrapping @input_stream and @output_stream. 85 * See also #GIOStream. 86 * 87 * Params: 88 * inputStream = a #GInputStream. 89 * outputStream = a #GOutputStream. 90 * 91 * Returns: a new #GSimpleIOStream instance. 92 * 93 * Since: 2.44 94 * 95 * Throws: ConstructionException GTK+ fails to create the object. 96 */ 97 public this(InputStream inputStream, OutputStream outputStream) 98 { 99 auto __p = g_simple_io_stream_new((inputStream is null) ? null : inputStream.getInputStreamStruct(), (outputStream is null) ? null : outputStream.getOutputStreamStruct()); 100 101 if(__p is null) 102 { 103 throw new ConstructionException("null returned by new"); 104 } 105 106 this(cast(GSimpleIOStream*) __p, true); 107 } 108 }