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

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

Initial release

File size: 4.1 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.UnixInputStream;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.FileDescriptorBasedIF;
26private import gio.FileDescriptorBasedT;
27private import gio.InputStream;
28private import gio.PollableInputStreamIF;
29private import gio.PollableInputStreamT;
30private import glib.ConstructionException;
31private import gobject.ObjectG;
32
33
34/**
35 * #GUnixInputStream implements #GInputStream for reading from a UNIX
36 * file descriptor, including asynchronous operations. (If the file
37 * descriptor refers to a socket or pipe, this will use poll() to do
38 * asynchronous I/O. If it refers to a regular file, it will fall back
39 * to doing asynchronous I/O in another thread.)
40 *
41 * Note that `<gio/gunixinputstream.h>` belongs to the UNIX-specific GIO
42 * interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
43 * file when using it.
44 */
45public class UnixInputStream : InputStream, FileDescriptorBasedIF, PollableInputStreamIF
46{
47        /** the main Gtk struct */
48        protected GUnixInputStream* gUnixInputStream;
49
50        /** Get the main Gtk struct */
51        public GUnixInputStream* getUnixInputStreamStruct()
52        {
53                return gUnixInputStream;
54        }
55
56        /** the main Gtk struct as a void* */
57        protected override void* getStruct()
58        {
59                return cast(void*)gUnixInputStream;
60        }
61
62        protected override void setStruct(GObject* obj)
63        {
64                gUnixInputStream = cast(GUnixInputStream*)obj;
65                super.setStruct(obj);
66        }
67
68        /**
69         * Sets our main struct and passes it to the parent class.
70         */
71        public this (GUnixInputStream* gUnixInputStream, bool ownedRef = false)
72        {
73                this.gUnixInputStream = gUnixInputStream;
74                super(cast(GInputStream*)gUnixInputStream, ownedRef);
75        }
76
77        // add the FileDescriptorBased capabilities
78        mixin FileDescriptorBasedT!(GUnixInputStream);
79
80        // add the PollableInputStream capabilities
81        mixin PollableInputStreamT!(GUnixInputStream);
82
83
84        /** */
85        public static GType getType()
86        {
87                return g_unix_input_stream_get_type();
88        }
89
90        /**
91         * Creates a new #GUnixInputStream for the given @fd.
92         *
93         * If @close_fd is %TRUE, the file descriptor will be closed
94         * when the stream is closed.
95         *
96         * Params:
97         *     fd = a UNIX file descriptor
98         *     closeFd = %TRUE to close the file descriptor when done
99         *
100         * Returns: a new #GUnixInputStream
101         *
102         * Throws: ConstructionException GTK+ fails to create the object.
103         */
104        public this(int fd, bool closeFd)
105        {
106                auto p = g_unix_input_stream_new(fd, closeFd);
107               
108                if(p is null)
109                {
110                        throw new ConstructionException("null returned by new");
111                }
112               
113                this(cast(GUnixInputStream*) p, true);
114        }
115
116        /**
117         * Returns whether the file descriptor of @stream will be
118         * closed when the stream is closed.
119         *
120         * Returns: %TRUE if the file descriptor is closed when done
121         *
122         * Since: 2.20
123         */
124        public bool getCloseFd()
125        {
126                return g_unix_input_stream_get_close_fd(gUnixInputStream) != 0;
127        }
128
129        /**
130         * Return the UNIX file descriptor that the stream reads from.
131         *
132         * Returns: The file descriptor of @stream
133         *
134         * Since: 2.20
135         */
136        public int getFd()
137        {
138                return g_unix_input_stream_get_fd(gUnixInputStream);
139        }
140
141        /**
142         * Sets whether the file descriptor of @stream shall be closed
143         * when the stream is closed.
144         *
145         * Params:
146         *     closeFd = %TRUE to close the file descriptor when done
147         *
148         * Since: 2.20
149         */
150        public void setCloseFd(bool closeFd)
151        {
152                g_unix_input_stream_set_close_fd(gUnixInputStream, closeFd);
153        }
154}
Note: See TracBrowser for help on using the repository browser.