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 private import gio.PollableOutputStreamT;
64 private import gio.PollableOutputStreamIF;
65 
66 
67 private import gio.OutputStream;
68 
69 /**
70  * GUnixOutputStream implements GOutputStream for writing to 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/gunixoutputstream.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 UnixOutputStream : OutputStream, PollableOutputStreamIF
81 {
82 	
83 	/** the main Gtk struct */
84 	protected GUnixOutputStream* gUnixOutputStream;
85 	
86 	
87 	/** Get the main Gtk struct */
88 	public GUnixOutputStream* getUnixOutputStreamStruct()
89 	{
90 		return gUnixOutputStream;
91 	}
92 	
93 	
94 	/** the main Gtk struct as a void* */
95 	protected override void* getStruct()
96 	{
97 		return cast(void*)gUnixOutputStream;
98 	}
99 	
100 	/**
101 	 * Sets our main struct and passes it to the parent class
102 	 */
103 	public this (GUnixOutputStream* gUnixOutputStream)
104 	{
105 		super(cast(GOutputStream*)gUnixOutputStream);
106 		this.gUnixOutputStream = gUnixOutputStream;
107 	}
108 	
109 	protected override void setStruct(GObject* obj)
110 	{
111 		super.setStruct(obj);
112 		gUnixOutputStream = cast(GUnixOutputStream*)obj;
113 	}
114 	
115 	// add the PollableOutputStream capabilities
116 	mixin PollableOutputStreamT!(GUnixOutputStream);
117 	
118 	/**
119 	 */
120 	
121 	/**
122 	 * Creates a new GUnixOutputStream for the given fd.
123 	 * If close_fd, is TRUE, the file descriptor will be closed when
124 	 * the output stream is destroyed.
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 		// GOutputStream * g_unix_output_stream_new (gint fd,  gboolean close_fd);
133 		auto p = g_unix_output_stream_new(fd, closeFd);
134 		if(p is null)
135 		{
136 			throw new ConstructionException("null returned by g_unix_output_stream_new(fd, closeFd)");
137 		}
138 		this(cast(GUnixOutputStream*) 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_output_stream_set_close_fd (GUnixOutputStream *stream,  gboolean close_fd);
151 		g_unix_output_stream_set_close_fd(gUnixOutputStream, 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_output_stream_get_close_fd (GUnixOutputStream *stream);
163 		return g_unix_output_stream_get_close_fd(gUnixOutputStream);
164 	}
165 	
166 	/**
167 	 * Return the UNIX file descriptor that the stream writes to.
168 	 * Since 2.20
169 	 * Returns: The file descriptor of stream
170 	 */
171 	public int getFd()
172 	{
173 		// gint g_unix_output_stream_get_fd (GUnixOutputStream *stream);
174 		return g_unix_output_stream_get_fd(gUnixOutputStream);
175 	}
176 }