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 = GUnixOutputStream.html 27 * outPack = gio 28 * outFile = UnixOutputStream 29 * strct = GUnixOutputStream 30 * realStrct= 31 * ctorStrct=GOutputStream 32 * clss = UnixOutputStream 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - PollableOutputStreamIF 40 * prefixes: 41 * - g_unix_output_stream_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gio.PollableOutputStreamT 48 * - gio.PollableOutputStreamIF 49 * structWrap: 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gio.UnixOutputStream; 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.PollableOutputStreamT; 65 private import gio.PollableOutputStreamIF; 66 67 68 69 private import gio.OutputStream; 70 71 /** 72 * GUnixOutputStream implements GOutputStream for writing to a UNIX 73 * file descriptor, including asynchronous operations. (If the file 74 * descriptor refers to a socket or pipe, this will use poll() to do 75 * asynchronous I/O. If it refers to a regular file, it will fall back 76 * to doing asynchronous I/O in another thread.) 77 * 78 * Note that <gio/gunixoutputstream.h> belongs 79 * to the UNIX-specific GIO interfaces, thus you have to use the 80 * gio-unix-2.0.pc pkg-config file when using it. 81 */ 82 public class UnixOutputStream : OutputStream, PollableOutputStreamIF 83 { 84 85 /** the main Gtk struct */ 86 protected GUnixOutputStream* gUnixOutputStream; 87 88 89 public GUnixOutputStream* getUnixOutputStreamStruct() 90 { 91 return gUnixOutputStream; 92 } 93 94 95 /** the main Gtk struct as a void* */ 96 protected override void* getStruct() 97 { 98 return cast(void*)gUnixOutputStream; 99 } 100 101 /** 102 * Sets our main struct and passes it to the parent class 103 */ 104 public this (GUnixOutputStream* gUnixOutputStream) 105 { 106 super(cast(GOutputStream*)gUnixOutputStream); 107 this.gUnixOutputStream = gUnixOutputStream; 108 } 109 110 protected override void setStruct(GObject* obj) 111 { 112 super.setStruct(obj); 113 gUnixOutputStream = cast(GUnixOutputStream*)obj; 114 } 115 116 // add the PollableOutputStream capabilities 117 mixin PollableOutputStreamT!(GUnixOutputStream); 118 119 /** 120 */ 121 122 /** 123 * Creates a new GUnixOutputStream for the given fd. 124 * If close_fd, is TRUE, the file descriptor will be closed when 125 * the output stream is destroyed. 126 * Params: 127 * fd = a UNIX file descriptor 128 * closeFd = TRUE to close the file descriptor when done 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this (int fd, int closeFd) 132 { 133 // GOutputStream * g_unix_output_stream_new (gint fd, gboolean close_fd); 134 auto p = g_unix_output_stream_new(fd, closeFd); 135 if(p is null) 136 { 137 throw new ConstructionException("null returned by g_unix_output_stream_new(fd, closeFd)"); 138 } 139 this(cast(GUnixOutputStream*) p); 140 } 141 142 /** 143 * Sets whether the file descriptor of stream shall be closed 144 * when the stream is closed. 145 * Since 2.20 146 * Params: 147 * closeFd = TRUE to close the file descriptor when done 148 */ 149 public void setCloseFd(int closeFd) 150 { 151 // void g_unix_output_stream_set_close_fd (GUnixOutputStream *stream, gboolean close_fd); 152 g_unix_output_stream_set_close_fd(gUnixOutputStream, closeFd); 153 } 154 155 /** 156 * Returns whether the file descriptor of stream will be 157 * closed when the stream is closed. 158 * Since 2.20 159 * Returns: TRUE if the file descriptor is closed when done 160 */ 161 public int getCloseFd() 162 { 163 // gboolean g_unix_output_stream_get_close_fd (GUnixOutputStream *stream); 164 return g_unix_output_stream_get_close_fd(gUnixOutputStream); 165 } 166 167 /** 168 * Return the UNIX file descriptor that the stream writes to. 169 * Since 2.20 170 * Returns: The file descriptor of stream 171 */ 172 public int getFd() 173 { 174 // gint g_unix_output_stream_get_fd (GUnixOutputStream *stream); 175 return g_unix_output_stream_get_fd(gUnixOutputStream); 176 } 177 }