source: appstream-generator/build/girepo/gio/PollableOutputStreamIF.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 4.3 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.PollableOutputStreamIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.Cancellable;
26private import glib.ErrorG;
27private import glib.GException;
28private import glib.Source;
29
30
31/**
32 * #GPollableOutputStream is implemented by #GOutputStreams that
33 * can be polled for readiness to write. This can be used when
34 * interfacing with a non-GIO API that expects
35 * UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
36 *
37 * Since: 2.28
38 */
39public interface PollableOutputStreamIF{
40        /** Get the main Gtk struct */
41        public GPollableOutputStream* getPollableOutputStreamStruct();
42
43        /** the main Gtk struct as a void* */
44        protected void* getStruct();
45
46
47        /**
48         * Checks if @stream is actually pollable. Some classes may implement
49         * #GPollableOutputStream but have only certain instances of that
50         * class be pollable. If this method returns %FALSE, then the behavior
51         * of other #GPollableOutputStream methods is undefined.
52         *
53         * For any given stream, the value returned by this method is constant;
54         * a stream cannot switch from pollable to non-pollable or vice versa.
55         *
56         * Returns: %TRUE if @stream is pollable, %FALSE if not.
57         *
58         * Since: 2.28
59         */
60        public bool canPoll();
61
62        /**
63         * Creates a #GSource that triggers when @stream can be written, or
64         * @cancellable is triggered or an error occurs. The callback on the
65         * source is of the #GPollableSourceFunc type.
66         *
67         * As with g_pollable_output_stream_is_writable(), it is possible that
68         * the stream may not actually be writable even after the source
69         * triggers, so you should use g_pollable_output_stream_write_nonblocking()
70         * rather than g_output_stream_write() from the callback.
71         *
72         * Params:
73         *     cancellable = a #GCancellable, or %NULL
74         *
75         * Returns: a new #GSource
76         *
77         * Since: 2.28
78         */
79        public Source createSource(Cancellable cancellable);
80
81        /**
82         * Checks if @stream can be written.
83         *
84         * Note that some stream types may not be able to implement this 100%
85         * reliably, and it is possible that a call to g_output_stream_write()
86         * after this returns %TRUE would still block. To guarantee
87         * non-blocking behavior, you should always use
88         * g_pollable_output_stream_write_nonblocking(), which will return a
89         * %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
90         *
91         * Returns: %TRUE if @stream is writable, %FALSE if not. If an error
92         *     has occurred on @stream, this will result in
93         *     g_pollable_output_stream_is_writable() returning %TRUE, and the
94         *     next attempt to write will return the error.
95         *
96         * Since: 2.28
97         */
98        public bool isWritable();
99
100        /**
101         * Attempts to write up to @count bytes from @buffer to @stream, as
102         * with g_output_stream_write(). If @stream is not currently writable,
103         * this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
104         * use g_pollable_output_stream_create_source() to create a #GSource
105         * that will be triggered when @stream is writable.
106         *
107         * Note that since this method never blocks, you cannot actually
108         * use @cancellable to cancel it. However, it will return an error
109         * if @cancellable has already been cancelled when you call, which
110         * may happen if you call this method after a source triggers due
111         * to having been cancelled.
112         *
113         * Params:
114         *     buffer = a buffer to write
115         *         data from
116         *     count = the number of bytes you want to write
117         *     cancellable = a #GCancellable, or %NULL
118         *
119         * Returns: the number of bytes written, or -1 on error (including
120         *     %G_IO_ERROR_WOULD_BLOCK).
121         *
122         * Throws: GException on failure.
123         */
124        public ptrdiff_t writeNonblocking(ubyte[] buffer, Cancellable cancellable);
125}
Note: See TracBrowser for help on using the repository browser.