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