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 = gda 28 * outFile = ParameterList 29 * strct = GdaParameterList 30 * realStrct= 31 * ctorStrct= 32 * clss = ParameterList 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gda_parameter_list_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ListG 48 * - gda.Parameter 49 * structWrap: 50 * - GList* -> ListG 51 * - GdaParameter* -> Parameter 52 * - GdaParameterList* -> ParameterList 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gda.ParameterList; 59 60 public import gdac.gdatypes; 61 62 private import gdac.gda; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import glib.Str; 67 private import glib.ListG; 68 private import gda.Parameter; 69 70 71 72 /** 73 * Parameters are the way clients have to send an unlimited number 74 * of arguments to the providers. 75 */ 76 public class ParameterList 77 { 78 79 /** the main Gtk struct */ 80 protected GdaParameterList* gdaParameterList; 81 82 83 /** Get the main Gtk struct */ 84 public GdaParameterList* getParameterListStruct() 85 { 86 return gdaParameterList; 87 } 88 89 90 /** the main Gtk struct as a void* */ 91 protected void* getStruct() 92 { 93 return cast(void*)gdaParameterList; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class 98 */ 99 public this (GdaParameterList* gdaParameterList) 100 { 101 this.gdaParameterList = gdaParameterList; 102 } 103 104 /** 105 */ 106 107 /** 108 * Returns: 109 */ 110 public static GType getType() 111 { 112 // GType gda_parameter_list_get_type (void); 113 return gda_parameter_list_get_type(); 114 } 115 116 /** 117 * Creates a new GdaParameterList. 118 * Throws: ConstructionException GTK+ fails to create the object. 119 */ 120 public this () 121 { 122 // GdaParameterList* gda_parameter_list_new (void); 123 auto p = gda_parameter_list_new(); 124 if(p is null) 125 { 126 throw new ConstructionException("null returned by gda_parameter_list_new()"); 127 } 128 this(cast(GdaParameterList*) p); 129 } 130 131 /** 132 * Releases all memory occupied by the given GdaParameterList. 133 */ 134 public void free() 135 { 136 // void gda_parameter_list_free (GdaParameterList *plist); 137 gda_parameter_list_free(gdaParameterList); 138 } 139 140 /** 141 * Creates a new GdaParameterList from an existing one. 142 * Returns: a newly allocated GdaParameterList with a copy of the data in plist. 143 */ 144 public ParameterList copy() 145 { 146 // GdaParameterList* gda_parameter_list_copy (GdaParameterList *plist); 147 auto p = gda_parameter_list_copy(gdaParameterList); 148 149 if(p is null) 150 { 151 return null; 152 } 153 154 return ObjectG.getDObject!(ParameterList)(cast(GdaParameterList*) p); 155 } 156 157 /** 158 * Adds a new parameter to the given GdaParameterList. Note that param is, 159 * when calling this function, is owned by the GdaParameterList, so the 160 * caller should just forget about it and not try to free the parameter once 161 * it's been added to the GdaParameterList. 162 * Params: 163 * param = the GdaParameter to be added to the list. 164 */ 165 public void addParameter(Parameter param) 166 { 167 // void gda_parameter_list_add_parameter (GdaParameterList *plist, GdaParameter *param); 168 gda_parameter_list_add_parameter(gdaParameterList, (param is null) ? null : param.getParameterStruct()); 169 } 170 171 /** 172 * Gets the names of all parameters in the parameter list. 173 * Returns: a GList containing the names of the parameters. After using it, you should free this list by calling g_list_free. 174 */ 175 public ListG getNames() 176 { 177 // GList* gda_parameter_list_get_names (GdaParameterList *plist); 178 auto p = gda_parameter_list_get_names(gdaParameterList); 179 180 if(p is null) 181 { 182 return null; 183 } 184 185 return ObjectG.getDObject!(ListG)(cast(GList*) p); 186 } 187 188 /** 189 * Gets a GdaParameter from the parameter list given its name. 190 * Params: 191 * name = name of the parameter to search for. 192 * Returns: the GdaParameter identified by name, if found, or NULL if not found. 193 */ 194 public Parameter find(string name) 195 { 196 // GdaParameter* gda_parameter_list_find (GdaParameterList *plist, const gchar *name); 197 auto p = gda_parameter_list_find(gdaParameterList, Str.toStringz(name)); 198 199 if(p is null) 200 { 201 return null; 202 } 203 204 return ObjectG.getDObject!(Parameter)(cast(GdaParameter*) p); 205 } 206 207 /** 208 * Clears the parameter list. This means removing all GdaParameter's currently 209 * being stored in the parameter list. After calling this function, 210 * the parameter list is empty. 211 */ 212 public void clear() 213 { 214 // void gda_parameter_list_clear (GdaParameterList *plist); 215 gda_parameter_list_clear(gdaParameterList); 216 } 217 218 /** 219 * Returns: the number of parameters stored in the given parameter list. 220 */ 221 public uint getLength() 222 { 223 // guint gda_parameter_list_get_length (GdaParameterList *plist); 224 return gda_parameter_list_get_length(gdaParameterList); 225 } 226 }