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