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