root/trunk/src/gio/SeekableT.d

Revision 938, 5.0 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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 change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23
24 /*
25  * Conversion parameters:
26  * inFile  = GSeekable.html
27  * outPack = gio
28  * outFile = SeekableT
29  * strct   = GSeekable
30  * realStrct=
31  * ctorStrct=
32  * clss    = SeekableT
33  * interf  = SeekableIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  *  - TStruct
38  * extend  =
39  * implements:
40  * prefixes:
41  *  - g_seekable_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - glib.ErrorG
48  *  - glib.GException
49  *  - gio.Cancellable
50  * structWrap:
51  *  - GCancellable* -> Cancellable
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56
57 module gio.SeekableT;
58
59 public  import gtkc.giotypes;
60
61 public import gtkc.gio;
62 public import glib.ConstructionException;
63
64
65 public import glib.ErrorG;
66 public import glib.GException;
67 public import gio.Cancellable;
68
69
70
71
72 /**
73  * Description
74  * GSeekable is implemented by streams (implementations of
75  * GInputStream or GOutputStream) that support seeking.
76  */
77 public template SeekableT(TStruct)
78 {
79    
80     /** the main Gtk struct */
81     protected GSeekable* gSeekable;
82    
83    
84     public GSeekable* getSeekableTStruct()
85     {
86         return cast(GSeekable*)getStruct();
87     }
88    
89    
90     /**
91      */
92    
93     /**
94      * Tells the current position within the stream.
95      * Returns: the offset from the beginning of the buffer.
96      */
97     public long tell()
98     {
99         // goffset g_seekable_tell (GSeekable *seekable);
100         return g_seekable_tell(getSeekableTStruct());
101     }
102    
103     /**
104      * Tests if the stream supports the GSeekableIface.
105      * Returns: TRUE if seekable can be seeked. FALSE otherwise.
106      */
107     public int canSeek()
108     {
109         // gboolean g_seekable_can_seek (GSeekable *seekable);
110         return g_seekable_can_seek(getSeekableTStruct());
111     }
112    
113     /**
114      * Seeks in the stream by the given offset, modified by type.
115      * If cancellable is not NULL, then the operation can be cancelled by
116      * triggering the cancellable object from another thread. If the operation
117      * was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
118      * Params:
119      * offset = a goffset.
120      * type = a GSeekType.
121      * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
122      * Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present.
123      * Throws: GException on failure.
124      */
125     public int seek(long offset, GSeekType type, Cancellable cancellable)
126     {
127         // gboolean g_seekable_seek (GSeekable *seekable,  goffset offset,  GSeekType type,  GCancellable *cancellable,  GError **error);
128         GError* err = null;
129        
130         auto p = g_seekable_seek(getSeekableTStruct(), offset, type, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
131        
132         if (err !is null)
133         {
134             throw new GException( new ErrorG(err) );
135         }
136        
137         return p;
138     }
139    
140     /**
141      * Tests if the stream can be truncated.
142      * Returns: TRUE if the stream can be truncated, FALSE otherwise.
143      */
144     public int canTruncate()
145     {
146         // gboolean g_seekable_can_truncate (GSeekable *seekable);
147         return g_seekable_can_truncate(getSeekableTStruct());
148     }
149    
150     /**
151      * Truncates a stream with a given offset.
152      * If cancellable is not NULL, then the operation can be cancelled by
153      * triggering the cancellable object from another thread. If the operation
154      * was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an
155      * operation was partially finished when the operation was cancelled the
156      * partial result will be returned, without an error.
157      * Virtual: truncate_fn
158      * Params:
159      * offset = a goffset.
160      * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
161      * Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present.
162      * Throws: GException on failure.
163      */
164     public int truncate(long offset, Cancellable cancellable)
165     {
166         // gboolean g_seekable_truncate (GSeekable *seekable,  goffset offset,  GCancellable *cancellable,  GError **error);
167         GError* err = null;
168        
169         auto p = g_seekable_truncate(getSeekableTStruct(), offset, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
170        
171         if (err !is null)
172         {
173             throw new GException( new ErrorG(err) );
174         }
175        
176         return p;
177     }
178 }
Note: See TracBrowser for help on using the browser.