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  = GPollableOutputStream.html
27  * outPack = gio
28  * outFile = PollableOutputStreamIF
29  * strct   = GPollableOutputStream
30  * realStrct=
31  * ctorStrct=
32  * clss    = PollableOutputStreamT
33  * interf  = PollableOutputStreamIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_pollable_input_stream_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.ErrorG
47  * 	- glib.GException
48  * 	- glib.Source
49  * 	- gio.Cancellable
50  * structWrap:
51  * 	- GCancellable* -> Cancellable
52  * 	- GSource* -> Source
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gio.PollableOutputStreamIF;
59 
60 public  import gtkc.giotypes;
61 
62 private import gtkc.gio;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glib.ErrorG;
68 private import glib.GException;
69 private import glib.Source;
70 private import gio.Cancellable;
71 
72 
73 
74 
75 /**
76  * Description
77  * GPollableOutputStream is implemented by GOutputStreams that
78  * can be polled for readiness to write. This can be used when
79  * interfacing with a non-GIO API that expects
80  * UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
81  */
82 public interface PollableOutputStreamIF
83 {
84 	
85 	
86 	public GPollableOutputStream* getPollableOutputStreamTStruct();
87 	
88 	/** the main Gtk struct as a void* */
89 	protected void* getStruct();
90 	
91 	
92 	/**
93 	 */
94 	
95 	/**
96 	 * Checks if stream is actually pollable. Some classes may implement
97 	 * GPollableOutputStream but have only certain instances of that
98 	 * class be pollable. If this method returns FALSE, then the behavior
99 	 * of other GPollableOutputStream methods is undefined.
100 	 * For any given stream, the value returned by this method is constant;
101 	 * a stream cannot switch from pollable to non-pollable or vice versa.
102 	 * Since 2.28
103 	 * Returns: TRUE if stream is pollable, FALSE if not.
104 	 */
105 	public int gPollableOutputStreamCanPoll();
106 	
107 	/**
108 	 * Checks if stream can be written.
109 	 * Note that some stream types may not be able to implement this 100%
110 	 * reliably, and it is possible that a call to g_output_stream_write()
111 	 * after this returns TRUE would still block. To guarantee
112 	 * non-blocking behavior, you should always use
113 	 * g_pollable_output_stream_write_nonblocking(), which will return a
114 	 * G_IO_ERROR_WOULD_BLOCK error rather than blocking.
115 	 * Since 2.28
116 	 * Returns: TRUE if stream is writable, FALSE if not. If an error has occurred on stream, this will result in g_pollable_output_stream_is_writable() returning TRUE, and the next attempt to write will return the error.
117 	 */
118 	public int gPollableOutputStreamIsWritable();
119 	
120 	/**
121 	 * Creates a GSource that triggers when stream can be written, or
122 	 * cancellable is triggered or an error occurs. The callback on the
123 	 * source is of the GPollableSourceFunc type.
124 	 * As with g_pollable_output_stream_is_writable(), it is possible that
125 	 * the stream may not actually be writable even after the source
126 	 * triggers, so you should use g_pollable_output_stream_write_nonblocking()
127 	 * rather than g_output_stream_write() from the callback.
128 	 * Since 2.28
129 	 * Params:
130 	 * cancellable = a GCancellable, or NULL. [allow-none]
131 	 * Returns: a new GSource. [transfer full]
132 	 */
133 	public Source gPollableOutputStreamCreateSource(Cancellable cancellable);
134 	
135 	/**
136 	 * Attempts to write up to size bytes from buffer to stream, as
137 	 * with g_output_stream_write(). If stream is not currently writable,
138 	 * this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can
139 	 * use g_pollable_output_stream_create_source() to create a GSource
140 	 * that will be triggered when stream is writable.
141 	 * Note that since this method never blocks, you cannot actually
142 	 * use cancellable to cancel it. However, it will return an error
143 	 * if cancellable has already been cancelled when you call, which
144 	 * may happen if you call this method after a source triggers due
145 	 * to having been cancelled.
146 	 * Virtual: write_nonblocking
147 	 * Params:
148 	 * buffer = a buffer to write
149 	 * data from. [array length=size][element-type guint8]
150 	 * size = the number of bytes you want to write
151 	 * cancellable = a GCancellable, or NULL. [allow-none]
152 	 * Returns: the number of bytes written, or -1 on error (including G_IO_ERROR_WOULD_BLOCK).
153 	 * Throws: GException on failure.
154 	 */
155 	public gssize gPollableOutputStreamWriteNonblocking(void[] buffer, Cancellable cancellable);
156 }