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