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 = 27 * outPack = glib 28 * outFile = Directory 29 * strct = GDir 30 * realStrct= 31 * ctorStrct= 32 * clss = Directory 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_dir_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * structWrap: 50 * - GDir* -> Directory 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module glib.Directory; 57 58 public import gtkc.glibtypes; 59 60 private import gtkc.glib; 61 private import glib.ConstructionException; 62 63 64 private import glib.Str; 65 private import glib.ErrorG; 66 private import glib.GException; 67 68 69 70 71 /** 72 * Description 73 * There is a group of functions which wrap the common POSIX functions 74 * dealing with filenames (g_open(), g_rename(), g_mkdir(), g_stat(), 75 * g_unlink(), g_remove(), g_fopen(), g_freopen()). The point of these 76 * wrappers is to make it possible to handle file names with any Unicode 77 * characters in them on Windows without having to use ifdefs and the 78 * wide character API in the application code. 79 * The pathname argument should be in the GLib file name encoding. On 80 * POSIX this is the actual on-disk encoding which might correspond to 81 * the locale settings of the process (or the 82 * G_FILENAME_ENCODING environment variable), or not. 83 * On Windows the GLib file name encoding is UTF-8. Note that the 84 * Microsoft C library does not use UTF-8, but has separate APIs for 85 * current system code page and wide characters (UTF-16). The GLib 86 * wrappers call the wide character API if present (on modern Windows 87 * systems), otherwise convert to/from the system code page. 88 * Another group of functions allows to open and read directories 89 * in the GLib file name encoding. These are g_dir_open(), 90 * g_dir_read_name(), g_dir_rewind(), g_dir_close(). 91 */ 92 public class Directory 93 { 94 95 /** the main Gtk struct */ 96 protected GDir* gDir; 97 98 99 public GDir* getDirectoryStruct() 100 { 101 return gDir; 102 } 103 104 105 /** the main Gtk struct as a void* */ 106 protected void* getStruct() 107 { 108 return cast(void*)gDir; 109 } 110 111 /** 112 * Sets our main struct and passes it to the parent class 113 */ 114 public this (GDir* gDir) 115 { 116 this.gDir = gDir; 117 } 118 119 /** 120 */ 121 122 /** 123 * Resets the given directory. The next call to g_dir_read_name() 124 * will return the first entry again. 125 */ 126 public void rewind() 127 { 128 // void g_dir_rewind (GDir *dir); 129 g_dir_rewind(gDir); 130 } 131 132 /** 133 * Closes the directory and deallocates all related resources. 134 */ 135 public void close() 136 { 137 // void g_dir_close (GDir *dir); 138 g_dir_close(gDir); 139 } 140 }