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