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

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

Initial release

File size: 5.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.FileInputStream;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.AsyncResultIF;
26private import gio.Cancellable;
27private import gio.FileInfo;
28private import gio.InputStream;
29private import gio.SeekableIF;
30private import gio.SeekableT;
31private import glib.ErrorG;
32private import glib.GException;
33private import glib.Str;
34private import gobject.ObjectG;
35
36
37/**
38 * GFileInputStream provides input streams that take their
39 * content from a file.
40 *
41 * GFileInputStream implements #GSeekable, which allows the input
42 * stream to jump to arbitrary positions in the file, provided the
43 * filesystem of the file allows it. To find the position of a file
44 * input stream, use g_seekable_tell(). To find out if a file input
45 * stream supports seeking, use g_seekable_can_seek().
46 * To position a file input stream, use g_seekable_seek().
47 */
48public class FileInputStream : InputStream, SeekableIF
49{
50        /** the main Gtk struct */
51        protected GFileInputStream* gFileInputStream;
52
53        /** Get the main Gtk struct */
54        public GFileInputStream* getFileInputStreamStruct()
55        {
56                return gFileInputStream;
57        }
58
59        /** the main Gtk struct as a void* */
60        protected override void* getStruct()
61        {
62                return cast(void*)gFileInputStream;
63        }
64
65        protected override void setStruct(GObject* obj)
66        {
67                gFileInputStream = cast(GFileInputStream*)obj;
68                super.setStruct(obj);
69        }
70
71        /**
72         * Sets our main struct and passes it to the parent class.
73         */
74        public this (GFileInputStream* gFileInputStream, bool ownedRef = false)
75        {
76                this.gFileInputStream = gFileInputStream;
77                super(cast(GInputStream*)gFileInputStream, ownedRef);
78        }
79
80        // add the Seekable capabilities
81        mixin SeekableT!(GFileInputStream);
82
83
84        /** */
85        public static GType getType()
86        {
87                return g_file_input_stream_get_type();
88        }
89
90        /**
91         * Queries a file input stream the given @attributes. This function blocks
92         * while querying the stream. For the asynchronous (non-blocking) version
93         * of this function, see g_file_input_stream_query_info_async(). While the
94         * stream is blocked, the stream will set the pending flag internally, and
95         * any other operations on the stream will fail with %G_IO_ERROR_PENDING.
96         *
97         * Params:
98         *     attributes = a file attribute query string.
99         *     cancellable = optional #GCancellable object, %NULL to ignore.
100         *
101         * Returns: a #GFileInfo, or %NULL on error.
102         *
103         * Throws: GException on failure.
104         */
105        public FileInfo queryInfo(string attributes, Cancellable cancellable)
106        {
107                GError* err = null;
108               
109                auto p = g_file_input_stream_query_info(gFileInputStream, Str.toStringz(attributes), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
110               
111                if (err !is null)
112                {
113                        throw new GException( new ErrorG(err) );
114                }
115               
116                if(p is null)
117                {
118                        return null;
119                }
120               
121                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
122        }
123
124        /**
125         * Queries the stream information asynchronously.
126         * When the operation is finished @callback will be called.
127         * You can then call g_file_input_stream_query_info_finish()
128         * to get the result of the operation.
129         *
130         * For the synchronous version of this function,
131         * see g_file_input_stream_query_info().
132         *
133         * If @cancellable is not %NULL, then the operation can be cancelled by
134         * triggering the cancellable object from another thread. If the operation
135         * was cancelled, the error %G_IO_ERROR_CANCELLED will be set
136         *
137         * Params:
138         *     attributes = a file attribute query string.
139         *     ioPriority = the [I/O priority][io-priority] of the request
140         *     cancellable = optional #GCancellable object, %NULL to ignore.
141         *     callback = callback to call when the request is satisfied
142         *     userData = the data to pass to callback function
143         */
144        public void queryInfoAsync(string attributes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
145        {
146                g_file_input_stream_query_info_async(gFileInputStream, Str.toStringz(attributes), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
147        }
148
149        /**
150         * Finishes an asynchronous info query operation.
151         *
152         * Params:
153         *     result = a #GAsyncResult.
154         *
155         * Returns: #GFileInfo.
156         *
157         * Throws: GException on failure.
158         */
159        public FileInfo queryInfoFinish(AsyncResultIF result)
160        {
161                GError* err = null;
162               
163                auto p = g_file_input_stream_query_info_finish(gFileInputStream, (result is null) ? null : result.getAsyncResultStruct(), &err);
164               
165                if (err !is null)
166                {
167                        throw new GException( new ErrorG(err) );
168                }
169               
170                if(p is null)
171                {
172                        return null;
173                }
174               
175                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
176        }
177}
Note: See TracBrowser for help on using the repository browser.