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