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  * GPollableOutputStream is implemented by GOutputStreams that
77  * can be polled for readiness to write. This can be used when
78  * interfacing with a non-GIO API that expects
79  * UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
80  */
81 public interface PollableOutputStreamIF
82 {
83 	
84 	
85 	public GPollableOutputStream* getPollableOutputStreamTStruct();
86 	
87 	/** the main Gtk struct as a void* */
88 	protected void* getStruct();
89 	
90 	
91 	/**
92 	 */
93 	
94 	/**
95 	 * Checks if stream is actually pollable. Some classes may implement
96 	 * GPollableOutputStream but have only certain instances of that
97 	 * class be pollable. If this method returns FALSE, then the behavior
98 	 * of other GPollableOutputStream methods is undefined.
99 	 * For any given stream, the value returned by this method is constant;
100 	 * a stream cannot switch from pollable to non-pollable or vice versa.
101 	 * Since 2.28
102 	 * Returns: TRUE if stream is pollable, FALSE if not.
103 	 */
104 	public int gPollableOutputStreamCanPoll();
105 	
106 	/**
107 	 * Checks if stream can be written.
108 	 * Note that some stream types may not be able to implement this 100%
109 	 * reliably, and it is possible that a call to g_output_stream_write()
110 	 * after this returns TRUE would still block. To guarantee
111 	 * non-blocking behavior, you should always use
112 	 * g_pollable_output_stream_write_nonblocking(), which will return a
113 	 * G_IO_ERROR_WOULD_BLOCK error rather than blocking.
114 	 * Since 2.28
115 	 * 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.
116 	 */
117 	public int gPollableOutputStreamIsWritable();
118 	
119 	/**
120 	 * Creates a GSource that triggers when stream can be written, or
121 	 * cancellable is triggered or an error occurs. The callback on the
122 	 * source is of the GPollableSourceFunc type.
123 	 * As with g_pollable_output_stream_is_writable(), it is possible that
124 	 * the stream may not actually be writable even after the source
125 	 * triggers, so you should use g_pollable_output_stream_write_nonblocking()
126 	 * rather than g_output_stream_write() from the callback.
127 	 * Since 2.28
128 	 * Params:
129 	 * cancellable = a GCancellable, or NULL. [allow-none]
130 	 * Returns: a new GSource. [transfer full]
131 	 */
132 	public Source gPollableOutputStreamCreateSource(Cancellable cancellable);
133 	
134 	/**
135 	 * Attempts to write up to count bytes from buffer to stream, as
136 	 * with g_output_stream_write(). If stream is not currently writable,
137 	 * this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can
138 	 * use g_pollable_output_stream_create_source() to create a GSource
139 	 * that will be triggered when stream is writable.
140 	 * Note that since this method never blocks, you cannot actually
141 	 * use cancellable to cancel it. However, it will return an error
142 	 * if cancellable has already been cancelled when you call, which
143 	 * may happen if you call this method after a source triggers due
144 	 * to having been cancelled.
145 	 * Virtual: write_nonblocking
146 	 * Params:
147 	 * buffer = a buffer to write
148 	 * data from. [array length=count][element-type guint8]
149 	 * count = the number of bytes you want to write
150 	 * cancellable = a GCancellable, or NULL. [allow-none]
151 	 * Returns: the number of bytes written, or -1 on error (including G_IO_ERROR_WOULD_BLOCK).
152 	 * Throws: GException on failure.
153 	 */
154 	public gssize gPollableOutputStreamWriteNonblocking(void[] buffer, gsize count, Cancellable cancellable);
155 }