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