source: appstream-generator/build/girepo/gio/SeekableIF.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.SeekableIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.Cancellable;
26private import glib.ErrorG;
27private import glib.GException;
28
29
30/**
31 * #GSeekable is implemented by streams (implementations of
32 * #GInputStream or #GOutputStream) that support seeking.
33 *
34 * Seekable streams largely fall into two categories: resizable and
35 * fixed-size.
36 *
37 * #GSeekable on fixed-sized streams is approximately the same as POSIX
38 * lseek() on a block device (for example: attmepting to seek past the
39 * end of the device is an error).  Fixed streams typically cannot be
40 * truncated.
41 *
42 * #GSeekable on resizable streams is approximately the same as POSIX
43 * lseek() on a normal file.  Seeking past the end and writing data will
44 * usually cause the stream to resize by introducing zero bytes.
45 */
46public interface SeekableIF{
47        /** Get the main Gtk struct */
48        public GSeekable* getSeekableStruct();
49
50        /** the main Gtk struct as a void* */
51        protected void* getStruct();
52
53
54        /**
55         * Tests if the stream supports the #GSeekableIface.
56         *
57         * Returns: %TRUE if @seekable can be seeked. %FALSE otherwise.
58         */
59        public bool canSeek();
60
61        /**
62         * Tests if the stream can be truncated.
63         *
64         * Returns: %TRUE if the stream can be truncated, %FALSE otherwise.
65         */
66        public bool canTruncate();
67
68        /**
69         * Seeks in the stream by the given @offset, modified by @type.
70         *
71         * Attempting to seek past the end of the stream will have different
72         * results depending on if the stream is fixed-sized or resizable.  If
73         * the stream is resizable then seeking past the end and then writing
74         * will result in zeros filling the empty space.  Seeking past the end
75         * of a resizable stream and reading will result in EOF.  Seeking past
76         * the end of a fixed-sized stream will fail.
77         *
78         * Any operation that would result in a negative offset will fail.
79         *
80         * If @cancellable is not %NULL, then the operation can be cancelled by
81         * triggering the cancellable object from another thread. If the operation
82         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
83         *
84         * Params:
85         *     offset = a #goffset.
86         *     type = a #GSeekType.
87         *     cancellable = optional #GCancellable object, %NULL to ignore.
88         *
89         * Returns: %TRUE if successful. If an error
90         *     has occurred, this function will return %FALSE and set @error
91         *     appropriately if present.
92         *
93         * Throws: GException on failure.
94         */
95        public bool seek(long offset, GSeekType type, Cancellable cancellable);
96
97        /**
98         * Tells the current position within the stream.
99         *
100         * Returns: the offset from the beginning of the buffer.
101         */
102        public long tell();
103
104        /**
105         * Truncates a stream with a given #offset.
106         *
107         * If @cancellable is not %NULL, then the operation can be cancelled by
108         * triggering the cancellable object from another thread. If the operation
109         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
110         * operation was partially finished when the operation was cancelled the
111         * partial result will be returned, without an error.
112         *
113         * Params:
114         *     offset = a #goffset.
115         *     cancellable = optional #GCancellable object, %NULL to ignore.
116         *
117         * Returns: %TRUE if successful. If an error
118         *     has occurred, this function will return %FALSE and set @error
119         *     appropriately if present.
120         *
121         * Throws: GException on failure.
122         */
123        public bool truncate(long offset, Cancellable cancellable);
124}
Note: See TracBrowser for help on using the repository browser.