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 private import gio.PollableInputStreamT; 64 private import gio.PollableInputStreamIF; 65 66 67 private import gio.InputStream; 68 69 /** 70 * GUnixInputStream implements GInputStream for reading from a UNIX 71 * file descriptor, including asynchronous operations. (If the file 72 * descriptor refers to a socket or pipe, this will use poll() to do 73 * asynchronous I/O. If it refers to a regular file, it will fall back 74 * to doing asynchronous I/O in another thread.) 75 * 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 /** Get the main Gtk struct */ 88 public GUnixInputStream* getUnixInputStreamStruct() 89 { 90 return gUnixInputStream; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gUnixInputStream; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GUnixInputStream* gUnixInputStream) 104 { 105 super(cast(GInputStream*)gUnixInputStream); 106 this.gUnixInputStream = gUnixInputStream; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gUnixInputStream = cast(GUnixInputStream*)obj; 113 } 114 115 // add the PollableInputStream capabilities 116 mixin PollableInputStreamT!(GUnixInputStream); 117 118 /** 119 */ 120 121 /** 122 * Creates a new GUnixInputStream for the given fd. 123 * If close_fd is TRUE, the file descriptor will be closed 124 * when the stream is closed. 125 * Params: 126 * fd = a UNIX file descriptor 127 * closeFd = TRUE to close the file descriptor when done 128 * Throws: ConstructionException GTK+ fails to create the object. 129 */ 130 public this (int fd, int closeFd) 131 { 132 // GInputStream * g_unix_input_stream_new (gint fd, gboolean close_fd); 133 auto p = g_unix_input_stream_new(fd, closeFd); 134 if(p is null) 135 { 136 throw new ConstructionException("null returned by g_unix_input_stream_new(fd, closeFd)"); 137 } 138 this(cast(GUnixInputStream*) p); 139 } 140 141 /** 142 * Sets whether the file descriptor of stream shall be closed 143 * when the stream is closed. 144 * Since 2.20 145 * Params: 146 * closeFd = TRUE to close the file descriptor when done 147 */ 148 public void setCloseFd(int closeFd) 149 { 150 // void g_unix_input_stream_set_close_fd (GUnixInputStream *stream, gboolean close_fd); 151 g_unix_input_stream_set_close_fd(gUnixInputStream, closeFd); 152 } 153 154 /** 155 * Returns whether the file descriptor of stream will be 156 * closed when the stream is closed. 157 * Since 2.20 158 * Returns: TRUE if the file descriptor is closed when done 159 */ 160 public int getCloseFd() 161 { 162 // gboolean g_unix_input_stream_get_close_fd (GUnixInputStream *stream); 163 return g_unix_input_stream_get_close_fd(gUnixInputStream); 164 } 165 166 /** 167 * Return the UNIX file descriptor that the stream reads from. 168 * Since 2.20 169 * Returns: The file descriptor of stream 170 */ 171 public int getFd() 172 { 173 // gint g_unix_input_stream_get_fd (GUnixInputStream *stream); 174 return g_unix_input_stream_get_fd(gUnixInputStream); 175 } 176 }