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 = GUnixInputStream.html 27 * outPack = gio 28 * outFile = UnixInputStream 29 * strct = GUnixInputStream 30 * realStrct= 31 * ctorStrct=GInputStream 32 * clss = UnixInputStream 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - PollableInputStreamIF 40 * prefixes: 41 * - g_unix_input_stream_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gio.PollableInputStreamT 48 * - gio.PollableInputStreamIF 49 * structWrap: 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gio.UnixInputStream; 56 57 public import gtkc.giotypes; 58 59 private import gtkc.gio; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import gio.PollableInputStreamT; 65 private import gio.PollableInputStreamIF; 66 67 68 69 private import gio.InputStream; 70 71 /** 72 * Description 73 * GUnixInputStream implements GInputStream for reading from a 74 * UNIX file descriptor, including asynchronous operations. The file 75 * descriptor must be selectable, so it doesn't work with opened files. 76 * Note that <gio/gunixinputstream.h> belongs 77 * to the UNIX-specific GIO interfaces, thus you have to use the 78 * gio-unix-2.0.pc pkg-config file when using it. 79 */ 80 public class UnixInputStream : InputStream, PollableInputStreamIF 81 { 82 83 /** the main Gtk struct */ 84 protected GUnixInputStream* gUnixInputStream; 85 86 87 public GUnixInputStream* getUnixInputStreamStruct() 88 { 89 return gUnixInputStream; 90 } 91 92 93 /** the main Gtk struct as a void* */ 94 protected override void* getStruct() 95 { 96 return cast(void*)gUnixInputStream; 97 } 98 99 /** 100 * Sets our main struct and passes it to the parent class 101 */ 102 public this (GUnixInputStream* gUnixInputStream) 103 { 104 super(cast(GInputStream*)gUnixInputStream); 105 this.gUnixInputStream = gUnixInputStream; 106 } 107 108 protected override void setStruct(GObject* obj) 109 { 110 super.setStruct(obj); 111 gUnixInputStream = cast(GUnixInputStream*)obj; 112 } 113 114 // add the PollableInputStream capabilities 115 mixin PollableInputStreamT!(GUnixInputStream); 116 117 /** 118 */ 119 120 /** 121 * Creates a new GUnixInputStream for the given fd. 122 * If close_fd is TRUE, the file descriptor will be closed 123 * when the stream is closed. 124 * Params: 125 * fd = a UNIX file descriptor 126 * closeFd = TRUE to close the file descriptor when done 127 * Throws: ConstructionException GTK+ fails to create the object. 128 */ 129 public this (int fd, int closeFd) 130 { 131 // GInputStream * g_unix_input_stream_new (gint fd, gboolean close_fd); 132 auto p = g_unix_input_stream_new(fd, closeFd); 133 if(p is null) 134 { 135 throw new ConstructionException("null returned by g_unix_input_stream_new(fd, closeFd)"); 136 } 137 this(cast(GUnixInputStream*) p); 138 } 139 140 /** 141 * Sets whether the file descriptor of stream shall be closed 142 * when the stream is closed. 143 * Since 2.20 144 * Params: 145 * closeFd = TRUE to close the file descriptor when done 146 */ 147 public void setCloseFd(int closeFd) 148 { 149 // void g_unix_input_stream_set_close_fd (GUnixInputStream *stream, gboolean close_fd); 150 g_unix_input_stream_set_close_fd(gUnixInputStream, closeFd); 151 } 152 153 /** 154 * Returns whether the file descriptor of stream will be 155 * closed when the stream is closed. 156 * Since 2.20 157 * Returns: TRUE if the file descriptor is closed when done 158 */ 159 public int getCloseFd() 160 { 161 // gboolean g_unix_input_stream_get_close_fd (GUnixInputStream *stream); 162 return g_unix_input_stream_get_close_fd(gUnixInputStream); 163 } 164 165 /** 166 * Return the UNIX file descriptor that the stream reads from. 167 * Since 2.20 168 * Returns: The file descriptor of stream 169 */ 170 public int getFd() 171 { 172 // gint g_unix_input_stream_get_fd (GUnixInputStream *stream); 173 return g_unix_input_stream_get_fd(gUnixInputStream); 174 } 175 }