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 private import gobject.ObjectG;
63 
64 
65 private import glib.Str;
66 private import gio.File;
67 
68 
69 
70 private import gobject.ObjectG;
71 
72 /**
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 		super(cast(GObject*)gVfs);
100 		this.gVfs = gVfs;
101 	}
102 	
103 	protected override void setStruct(GObject* obj)
104 	{
105 		super.setStruct(obj);
106 		gVfs = cast(GVfs*)obj;
107 	}
108 	
109 	/**
110 	 */
111 	
112 	/**
113 	 * Gets a GFile for path.
114 	 * Params:
115 	 * path = a string containing a VFS path.
116 	 * Returns: a GFile. Free the returned object with g_object_unref(). [transfer full]
117 	 */
118 	public File getFileForPath(string path)
119 	{
120 		// GFile * g_vfs_get_file_for_path (GVfs *vfs,  const char *path);
121 		auto p = g_vfs_get_file_for_path(gVfs, Str.toStringz(path));
122 		
123 		if(p is null)
124 		{
125 			return null;
126 		}
127 		
128 		return ObjectG.getDObject!(File)(cast(GFile*) p);
129 	}
130 	
131 	/**
132 	 * Gets a GFile for uri.
133 	 * This operation never fails, but the returned object
134 	 * might not support any I/O operation if the URI
135 	 * is malformed or if the URI scheme is not supported.
136 	 * Params:
137 	 * uri = a string containing a URI
138 	 * Returns: a GFile. Free the returned object with g_object_unref(). [transfer full]
139 	 */
140 	public File getFileForUri(string uri)
141 	{
142 		// GFile * g_vfs_get_file_for_uri (GVfs *vfs,  const char *uri);
143 		auto p = g_vfs_get_file_for_uri(gVfs, Str.toStringz(uri));
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(File)(cast(GFile*) p);
151 	}
152 	
153 	/**
154 	 * This operation never fails, but the returned object might
155 	 * not support any I/O operations if the parse_name cannot
156 	 * be parsed by the GVfs module.
157 	 * Params:
158 	 * parseName = a string to be parsed by the VFS module.
159 	 * Returns: a GFile for the given parse_name. Free the returned object with g_object_unref(). [transfer full]
160 	 */
161 	public File parseName(string parseName)
162 	{
163 		// GFile * g_vfs_parse_name (GVfs *vfs,  const char *parse_name);
164 		auto p = g_vfs_parse_name(gVfs, Str.toStringz(parseName));
165 		
166 		if(p is null)
167 		{
168 			return null;
169 		}
170 		
171 		return ObjectG.getDObject!(File)(cast(GFile*) p);
172 	}
173 	
174 	/**
175 	 * Gets the default GVfs for the system.
176 	 * Returns: a GVfs. [transfer none]
177 	 */
178 	public static Vfs getDefault()
179 	{
180 		// GVfs * g_vfs_get_default (void);
181 		auto p = g_vfs_get_default();
182 		
183 		if(p is null)
184 		{
185 			return null;
186 		}
187 		
188 		return ObjectG.getDObject!(Vfs)(cast(GVfs*) p);
189 	}
190 	
191 	/**
192 	 * Gets the local GVfs for the system.
193 	 * Returns: a GVfs. [transfer none]
194 	 */
195 	public static Vfs getLocal()
196 	{
197 		// GVfs * g_vfs_get_local (void);
198 		auto p = g_vfs_get_local();
199 		
200 		if(p is null)
201 		{
202 			return null;
203 		}
204 		
205 		return ObjectG.getDObject!(Vfs)(cast(GVfs*) p);
206 	}
207 	
208 	/**
209 	 * Checks if the VFS is active.
210 	 * Returns: TRUE if construction of the vfs was successful and it is now active.
211 	 */
212 	public int isActive()
213 	{
214 		// gboolean g_vfs_is_active (GVfs *vfs);
215 		return g_vfs_is_active(gVfs);
216 	}
217 	
218 	/**
219 	 * Gets a list of URI schemes supported by vfs.
220 	 * Returns: a NULL-terminated array of strings. The returned array belongs to GIO and must not be freed or modified. [transfer none]
221 	 */
222 	public string[] getSupportedUriSchemes()
223 	{
224 		// const gchar * const * g_vfs_get_supported_uri_schemes (GVfs *vfs);
225 		return Str.toStringArray(g_vfs_get_supported_uri_schemes(gVfs));
226 	}
227 }