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 = libgda-gda-parameter.html 27 * outPack = gda 28 * outFile = Parameter 29 * strct = GdaParameter 30 * realStrct= 31 * ctorStrct= 32 * clss = Parameter 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gda_parameter_ 41 * omit structs: 42 * omit prefixes: 43 * - gda_parameter_list_ 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gobject.ObjectG 49 * - gda.Value 50 * structWrap: 51 * - GObject* -> ObjectG 52 * - GdaParameter* -> Parameter 53 * - GdaValue* -> Value 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gda.Parameter; 60 61 public import gdac.gdatypes; 62 63 private import gdac.gda; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 68 private import glib.Str; 69 private import gobject.ObjectG; 70 private import gda.Value; 71 72 73 74 75 /** 76 * Description 77 * Parameters are the way clients have to send an unlimited number 78 * of arguments to the providers. 79 */ 80 public class Parameter 81 { 82 83 /** the main Gtk struct */ 84 protected GdaParameter* gdaParameter; 85 86 87 public GdaParameter* getParameterStruct() 88 { 89 return gdaParameter; 90 } 91 92 93 /** the main Gtk struct as a void* */ 94 protected void* getStruct() 95 { 96 return cast(void*)gdaParameter; 97 } 98 99 /** 100 * Sets our main struct and passes it to the parent class 101 */ 102 public this (GdaParameter* gdaParameter) 103 { 104 this.gdaParameter = gdaParameter; 105 } 106 107 /** 108 */ 109 110 /** 111 * Returns: 112 */ 113 public static GType getType() 114 { 115 // GType gda_parameter_get_type (void); 116 return gda_parameter_get_type(); 117 } 118 119 /** 120 * Creates a new GdaParameter object, which is usually used 121 * with GdaParameterList. 122 * Params: 123 * name = name for the parameter being created. 124 * value = a GdaValue for this parameter. 125 * Throws: ConstructionException GTK+ fails to create the object. 126 */ 127 public this (string name, Value value) 128 { 129 // GdaParameter* gda_parameter_new_from_value (const gchar *name, const GdaValue *value); 130 auto p = gda_parameter_new_from_value(Str.toStringz(name), (value is null) ? null : value.getValueStruct()); 131 if(p is null) 132 { 133 throw new ConstructionException("null returned by gda_parameter_new_from_value(Str.toStringz(name), (value is null) ? null : value.getValueStruct())"); 134 } 135 this(cast(GdaParameter*) p); 136 } 137 138 /** 139 * Creates a new GdaParameter from a gboolean value. 140 * Params: 141 * name = name for the parameter being created. 142 * value = a boolean value. 143 * Throws: ConstructionException GTK+ fails to create the object. 144 */ 145 public this (string name, int value) 146 { 147 // GdaParameter* gda_parameter_new_boolean (const gchar *name, gboolean value); 148 auto p = gda_parameter_new_boolean(Str.toStringz(name), value); 149 if(p is null) 150 { 151 throw new ConstructionException("null returned by gda_parameter_new_boolean(Str.toStringz(name), value)"); 152 } 153 this(cast(GdaParameter*) p); 154 } 155 156 /** 157 * Creates a new GdaParameter from a gdouble value. 158 * Params: 159 * name = name for the parameter being created. 160 * value = a gdouble value. 161 * Throws: ConstructionException GTK+ fails to create the object. 162 */ 163 public this (string name, double value) 164 { 165 // GdaParameter* gda_parameter_new_double (const gchar *name, gdouble value); 166 auto p = gda_parameter_new_double(Str.toStringz(name), value); 167 if(p is null) 168 { 169 throw new ConstructionException("null returned by gda_parameter_new_double(Str.toStringz(name), value)"); 170 } 171 this(cast(GdaParameter*) p); 172 } 173 174 /** 175 * Creates a new GdaParameter from a GObject. 176 * Params: 177 * name = name for the parameter being created. 178 * value = a GObject value. 179 * Throws: ConstructionException GTK+ fails to create the object. 180 */ 181 public this (string name, ObjectG value) 182 { 183 // GdaParameter* gda_parameter_new_gobject (const gchar *name, const GObject *value); 184 auto p = gda_parameter_new_gobject(Str.toStringz(name), (value is null) ? null : value.getObjectGStruct()); 185 if(p is null) 186 { 187 throw new ConstructionException("null returned by gda_parameter_new_gobject(Str.toStringz(name), (value is null) ? null : value.getObjectGStruct())"); 188 } 189 this(cast(GdaParameter*) p); 190 } 191 192 /** 193 * Creates a new GdaParameter from a string. 194 * Params: 195 * name = name for the parameter being created. 196 * value = string value. 197 * Throws: ConstructionException GTK+ fails to create the object. 198 */ 199 public this (string name, string value) 200 { 201 // GdaParameter* gda_parameter_new_string (const gchar *name, const gchar *value); 202 auto p = gda_parameter_new_string(Str.toStringz(name), Str.toStringz(value)); 203 if(p is null) 204 { 205 throw new ConstructionException("null returned by gda_parameter_new_string(Str.toStringz(name), Str.toStringz(value))"); 206 } 207 this(cast(GdaParameter*) p); 208 } 209 210 /** 211 * Creates a new GdaParameter from an existing one. 212 * Returns: a newly allocated GdaParameter with a copy of the data in param. 213 */ 214 public Parameter copy() 215 { 216 // GdaParameter* gda_parameter_copy (GdaParameter *param); 217 auto p = gda_parameter_copy(gdaParameter); 218 219 if(p is null) 220 { 221 return null; 222 } 223 224 return ObjectG.getDObject!(Parameter)(cast(GdaParameter*) p); 225 } 226 227 /** 228 * Releases all memory occupied by the given GdaParameter. 229 */ 230 public void free() 231 { 232 // void gda_parameter_free (GdaParameter *param); 233 gda_parameter_free(gdaParameter); 234 } 235 236 /** 237 * Returns: the name of the given GdaParameter. 238 */ 239 public string getName() 240 { 241 // const gchar* gda_parameter_get_name (GdaParameter *param); 242 return Str.toString(gda_parameter_get_name(gdaParameter)); 243 } 244 245 /** 246 * Sets the name of the given GdaParameter. 247 * Params: 248 * name = new name for the parameter. 249 */ 250 public void setName(string name) 251 { 252 // void gda_parameter_set_name (GdaParameter *param, const gchar *name); 253 gda_parameter_set_name(gdaParameter, Str.toStringz(name)); 254 } 255 256 /** 257 * Returns: the value stored in the given param. 258 */ 259 public Value getValue() 260 { 261 // const GdaValue* gda_parameter_get_value (GdaParameter *param); 262 auto p = gda_parameter_get_value(gdaParameter); 263 264 if(p is null) 265 { 266 return null; 267 } 268 269 return ObjectG.getDObject!(Value)(cast(GdaValue*) p); 270 } 271 272 /** 273 * Stores the given value in the given param. 274 * Params: 275 * value = a GdaValue. 276 */ 277 public void setValue(Value value) 278 { 279 // void gda_parameter_set_value (GdaParameter *param, GdaValue *value); 280 gda_parameter_set_value(gdaParameter, (value is null) ? null : value.getValueStruct()); 281 } 282 }