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 change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegio.FileInputStream;
26 27 privateimportgio.AsyncResultIF;
28 privateimportgio.Cancellable;
29 privateimportgio.FileInfo;
30 privateimportgio.InputStream;
31 privateimportgio.SeekableIF;
32 privateimportgio.SeekableT;
33 privateimportgio.c.functions;
34 publicimportgio.c.types;
35 privateimportglib.ErrorG;
36 privateimportglib.GException;
37 privateimportglib.Str;
38 privateimportgobject.ObjectG;
39 40 41 /**
42 * GFileInputStream provides input streams that take their
43 * content from a file.
44 *
45 * GFileInputStream implements #GSeekable, which allows the input
46 * stream to jump to arbitrary positions in the file, provided the
47 * filesystem of the file allows it. To find the position of a file
48 * input stream, use g_seekable_tell(). To find out if a file input
49 * stream supports seeking, use g_seekable_can_seek().
50 * To position a file input stream, use g_seekable_seek().
51 */52 publicclassFileInputStream : InputStream, SeekableIF53 {
54 /** the main Gtk struct */55 protectedGFileInputStream* gFileInputStream;
56 57 /** Get the main Gtk struct */58 publicGFileInputStream* getFileInputStreamStruct(booltransferOwnership = false)
59 {
60 if (transferOwnership)
61 ownedRef = false;
62 returngFileInputStream;
63 }
64 65 /** the main Gtk struct as a void* */66 protectedoverridevoid* getStruct()
67 {
68 returncast(void*)gFileInputStream;
69 }
70 71 /**
72 * Sets our main struct and passes it to the parent class.
73 */74 publicthis (GFileInputStream* gFileInputStream, boolownedRef = false)
75 {
76 this.gFileInputStream = gFileInputStream;
77 super(cast(GInputStream*)gFileInputStream, ownedRef);
78 }
79 80 // add the Seekable capabilities81 mixinSeekableT!(GFileInputStream);
82 83 84 /** */85 publicstaticGTypegetType()
86 {
87 returng_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 publicFileInfoqueryInfo(stringattributes, Cancellablecancellable)
106 {
107 GError* err = null;
108 109 auto__p = g_file_input_stream_query_info(gFileInputStream, Str.toStringz(attributes), (cancellableisnull) ? null : cancellable.getCancellableStruct(), &err);
110 111 if (err !isnull)
112 {
113 thrownewGException( newErrorG(err) );
114 }
115 116 if(__pisnull)
117 {
118 returnnull;
119 }
120 121 returnObjectG.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 publicvoidqueryInfoAsync(stringattributes, intioPriority, Cancellablecancellable, GAsyncReadyCallbackcallback, void* userData)
145 {
146 g_file_input_stream_query_info_async(gFileInputStream, Str.toStringz(attributes), ioPriority, (cancellableisnull) ? 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 publicFileInfoqueryInfoFinish(AsyncResultIFresult)
160 {
161 GError* err = null;
162 163 auto__p = g_file_input_stream_query_info_finish(gFileInputStream, (resultisnull) ? null : result.getAsyncResultStruct(), &err);
164 165 if (err !isnull)
166 {
167 thrownewGException( newErrorG(err) );
168 }
169 170 if(__pisnull)
171 {
172 returnnull;
173 }
174 175 returnObjectG.getDObject!(FileInfo)(cast(GFileInfo*) __p, true);
176 }
177 }