root/trunk/src/gio/Vfs.d

Revision 938, 5.1 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  = GVfs.html
27  * outPack = gio
28  * outFile = Vfs
29  * strct   = GVfs
30  * realStrct=
31  * ctorStrct=
32  * clss    = Vfs
33  * interf  =
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_vfs_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  *  - glib.Str
47  *  - gio.File
48  * structWrap:
49  *  - GFile* -> File
50  *  - GVfs* -> Vfs
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55
56 module gio.Vfs;
57
58 public  import gtkc.giotypes;
59
60 private import gtkc.gio;
61 private import glib.ConstructionException;
62
63
64 private import glib.Str;
65 private import gio.File;
66
67
68
69 private import gobject.ObjectG;
70
71 /**
72  * Description
73  * Entry point for using GIO functionality.
74  */
75 public class Vfs : ObjectG
76 {
77    
78     /** the main Gtk struct */
79     protected GVfs* gVfs;
80    
81    
82     public GVfs* getVfsStruct()
83     {
84         return gVfs;
85     }
86    
87    
88     /** the main Gtk struct as a void* */
89     protected override void* getStruct()
90     {
91         return cast(void*)gVfs;
92     }
93    
94     /**
95      * Sets our main struct and passes it to the parent class
96      */
97     public this (GVfs* gVfs)
98     {
99         if(gVfs is null)
100         {
101             this = null;
102             return;
103         }
104         //Check if there already is a D object for this gtk struct
105         void* ptr = getDObject(cast(GObject*)gVfs);
106         if( ptr !is null )
107         {
108             this = cast(Vfs)ptr;
109             return;
110         }
111         super(cast(GObject*)gVfs);
112         this.gVfs = gVfs;
113     }
114    
115     protected override void setStruct(GObject* obj)
116     {
117         super.setStruct(obj);
118         gVfs = cast(GVfs*)obj;
119     }
120    
121     /**
122      */
123    
124     /**
125      * Gets a GFile for path.
126      * Params:
127      * path = a string containing a VFS path.
128      * Returns: a GFile. Free the returned object with g_object_unref(). [transfer full]
129      */
130     public File getFileForPath(string path)
131     {
132         // GFile * g_vfs_get_file_for_path (GVfs *vfs,  const char *path);
133         auto p = g_vfs_get_file_for_path(gVfs, Str.toStringz(path));
134         if(p is null)
135         {
136             return null;
137         }
138         return new File(cast(GFile*) p);
139     }
140    
141     /**
142      * Gets a GFile for uri.
143      * This operation never fails, but the returned object
144      * might not support any I/O operation if the URI
145      * is malformed or if the URI scheme is not supported.
146      * Params:
147      * uri = a string containing a URI
148      * Returns: a GFile. Free the returned object with g_object_unref(). [transfer full]
149      */
150     public File getFileForUri(string uri)
151     {
152         // GFile * g_vfs_get_file_for_uri (GVfs *vfs,  const char *uri);
153         auto p = g_vfs_get_file_for_uri(gVfs, Str.toStringz(uri));
154         if(p is null)
155         {
156             return null;
157         }
158         return new File(cast(GFile*) p);
159     }
160    
161     /**
162      * This operation never fails, but the returned object might
163      * not support any I/O operations if the parse_name cannot
164      * be parsed by the GVfs module.
165      * Params:
166      * parseName = a string to be parsed by the VFS module.
167      * Returns: a GFile for the given parse_name. Free the returned object with g_object_unref(). [transfer full]
168      */
169     public File parseName(string parseName)
170     {
171         // GFile * g_vfs_parse_name (GVfs *vfs,  const char *parse_name);
172         auto p = g_vfs_parse_name(gVfs, Str.toStringz(parseName));
173         if(p is null)
174         {
175             return null;
176         }
177         return new File(cast(GFile*) p);
178     }
179    
180     /**
181      * Gets the default GVfs for the system.
182      * Returns: a GVfs. [transfer none]
183      */
184     public static Vfs getDefault()
185     {
186         // GVfs * g_vfs_get_default (void);
187         auto p = g_vfs_get_default();
188         if(p is null)
189         {
190             return null;
191         }
192         return new Vfs(cast(GVfs*) p);
193     }
194    
195     /**
196      * Gets the local GVfs for the system.
197      * Returns: a GVfs. [transfer none]
198      */
199     public static Vfs getLocal()
200     {
201         // GVfs * g_vfs_get_local (void);
202         auto p = g_vfs_get_local();
203         if(p is null)
204         {
205             return null;
206         }
207         return new Vfs(cast(GVfs*) p);
208     }
209    
210     /**
211      * Checks if the VFS is active.
212      * Returns: TRUE if construction of the vfs was successful and it is now active.
213      */
214     public int isActive()
215     {
216         // gboolean g_vfs_is_active (GVfs *vfs);
217         return g_vfs_is_active(gVfs);
218     }
219    
220     /**
221      * Gets a list of URI schemes supported by vfs.
222      * Returns: a NULL-terminated array of strings. The returned array belongs to GIO and must not be freed or modified. [transfer none]
223      */
224     public string[] getSupportedUriSchemes()
225     {
226         // const gchar * const * g_vfs_get_supported_uri_schemes (GVfs *vfs);
227         return Str.toStringArray(g_vfs_get_supported_uri_schemes(gVfs));
228     }
229 }
Note: See TracBrowser for help on using the browser.