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 module gio.FileAttributeInfoList; 26 27 private import gio.c.functions; 28 public import gio.c.types; 29 private import glib.ConstructionException; 30 private import glib.MemorySlice; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gtkd.Loader; 34 35 36 /** 37 * Acts as a lightweight registry for possible valid file attributes. 38 * The registry stores Key-Value pair formats as #GFileAttributeInfos. 39 */ 40 public final class FileAttributeInfoList 41 { 42 /** the main Gtk struct */ 43 protected GFileAttributeInfoList* gFileAttributeInfoList; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public GFileAttributeInfoList* getFileAttributeInfoListStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gFileAttributeInfoList; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gFileAttributeInfoList; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GFileAttributeInfoList* gFileAttributeInfoList, bool ownedRef = false) 64 { 65 this.gFileAttributeInfoList = gFileAttributeInfoList; 66 this.ownedRef = ownedRef; 67 } 68 69 ~this () 70 { 71 if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef ) 72 g_file_attribute_info_list_unref(gFileAttributeInfoList); 73 } 74 75 76 /** 77 * an array of #GFileAttributeInfos. 78 */ 79 public @property GFileAttributeInfo[] infos() 80 { 81 return gFileAttributeInfoList.infos[0..gFileAttributeInfoList.nInfos]; 82 } 83 84 /** Ditto */ 85 public @property void infos(GFileAttributeInfo[] value) 86 { 87 gFileAttributeInfoList.infos = value.ptr; 88 gFileAttributeInfoList.nInfos = cast(int)value.length; 89 } 90 91 92 /** */ 93 public static GType getType() 94 { 95 return g_file_attribute_info_list_get_type(); 96 } 97 98 /** 99 * Creates a new file attribute info list. 100 * 101 * Returns: a #GFileAttributeInfoList. 102 * 103 * Throws: ConstructionException GTK+ fails to create the object. 104 */ 105 public this() 106 { 107 auto __p = g_file_attribute_info_list_new(); 108 109 if(__p is null) 110 { 111 throw new ConstructionException("null returned by new"); 112 } 113 114 this(cast(GFileAttributeInfoList*) __p); 115 } 116 117 /** 118 * Adds a new attribute with @name to the @list, setting 119 * its @type and @flags. 120 * 121 * Params: 122 * name = the name of the attribute to add. 123 * type = the #GFileAttributeType for the attribute. 124 * flags = #GFileAttributeInfoFlags for the attribute. 125 */ 126 public void add(string name, GFileAttributeType type, GFileAttributeInfoFlags flags) 127 { 128 g_file_attribute_info_list_add(gFileAttributeInfoList, Str.toStringz(name), type, flags); 129 } 130 131 /** 132 * Makes a duplicate of a file attribute info list. 133 * 134 * Returns: a copy of the given @list. 135 */ 136 public FileAttributeInfoList dup() 137 { 138 auto __p = g_file_attribute_info_list_dup(gFileAttributeInfoList); 139 140 if(__p is null) 141 { 142 return null; 143 } 144 145 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) __p, true); 146 } 147 148 /** 149 * Gets the file attribute with the name @name from @list. 150 * 151 * Params: 152 * name = the name of the attribute to look up. 153 * 154 * Returns: a #GFileAttributeInfo for the @name, or %NULL if an 155 * attribute isn't found. 156 */ 157 public GFileAttributeInfo* lookup(string name) 158 { 159 return g_file_attribute_info_list_lookup(gFileAttributeInfoList, Str.toStringz(name)); 160 } 161 162 alias doref = ref_; 163 /** 164 * References a file attribute info list. 165 * 166 * Returns: #GFileAttributeInfoList or %NULL on error. 167 */ 168 public FileAttributeInfoList ref_() 169 { 170 auto __p = g_file_attribute_info_list_ref(gFileAttributeInfoList); 171 172 if(__p is null) 173 { 174 return null; 175 } 176 177 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) __p, true); 178 } 179 180 /** 181 * Removes a reference from the given @list. If the reference count 182 * falls to zero, the @list is deleted. 183 */ 184 public void unref() 185 { 186 g_file_attribute_info_list_unref(gFileAttributeInfoList); 187 } 188 }