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-field.html 27 * outPack = gda 28 * outFile = FieldAttributes 29 * strct = GdaFieldAttributes 30 * realStrct= 31 * ctorStrct= 32 * clss = FieldAttributes 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gda_field_attributes_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gda.Value 48 * structWrap: 49 * - GdaFieldAttributes* -> FieldAttributes 50 * - GdaValue* -> Value 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gda.FieldAttributes; 57 58 public import gdac.gdatypes; 59 60 private import gdac.gda; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 65 private import glib.Str; 66 private import gda.Value; 67 68 69 70 71 /** 72 * Description 73 */ 74 public class FieldAttributes 75 { 76 77 /** the main Gtk struct */ 78 protected GdaFieldAttributes* gdaFieldAttributes; 79 80 81 public GdaFieldAttributes* getFieldAttributesStruct() 82 { 83 return gdaFieldAttributes; 84 } 85 86 87 /** the main Gtk struct as a void* */ 88 protected void* getStruct() 89 { 90 return cast(void*)gdaFieldAttributes; 91 } 92 93 /** 94 * Sets our main struct and passes it to the parent class 95 */ 96 public this (GdaFieldAttributes* gdaFieldAttributes) 97 { 98 this.gdaFieldAttributes = gdaFieldAttributes; 99 } 100 101 /** 102 */ 103 104 /** 105 * Returns: 106 */ 107 public static GType getType() 108 { 109 // GType gda_field_attributes_get_type (void); 110 return gda_field_attributes_get_type(); 111 } 112 113 /** 114 * Throws: ConstructionException GTK+ fails to create the object. 115 */ 116 public this () 117 { 118 // GdaFieldAttributes* gda_field_attributes_new (void); 119 auto p = gda_field_attributes_new(); 120 if(p is null) 121 { 122 throw new ConstructionException("null returned by gda_field_attributes_new()"); 123 } 124 this(cast(GdaFieldAttributes*) p); 125 } 126 127 /** 128 * Creates a new GdaFieldAttributes object from an existing one. 129 * Returns: a newly allocated GdaFieldAttributes with a copy of the data in fa. 130 */ 131 public FieldAttributes copy() 132 { 133 // GdaFieldAttributes* gda_field_attributes_copy (GdaFieldAttributes *fa); 134 auto p = gda_field_attributes_copy(gdaFieldAttributes); 135 136 if(p is null) 137 { 138 return null; 139 } 140 141 return ObjectG.getDObject!(FieldAttributes)(cast(GdaFieldAttributes*) p); 142 } 143 144 /** 145 * Deallocates all memory associated to the given GdaFieldAttributes object. 146 */ 147 public void free() 148 { 149 // void gda_field_attributes_free (GdaFieldAttributes *fa); 150 gda_field_attributes_free(gdaFieldAttributes); 151 } 152 153 /** 154 * Tests whether two field attributes are equal. 155 * Params: 156 * rhs = another GdaFieldAttributes 157 * Returns: TRUE if the field attributes contain the same information. 158 */ 159 public int equal(FieldAttributes rhs) 160 { 161 // gboolean gda_field_attributes_equal (const GdaFieldAttributes *lhs, const GdaFieldAttributes *rhs); 162 return gda_field_attributes_equal(gdaFieldAttributes, (rhs is null) ? null : rhs.getFieldAttributesStruct()); 163 } 164 165 /** 166 * Returns: the defined size of fa. 167 */ 168 public glong getDefinedSize() 169 { 170 // glong gda_field_attributes_get_defined_size (GdaFieldAttributes *fa); 171 return gda_field_attributes_get_defined_size(gdaFieldAttributes); 172 } 173 174 /** 175 * Sets the defined size of a GdaFieldAttributes. 176 * Params: 177 * size = the defined size we want to set. 178 */ 179 public void setDefinedSize(glong size) 180 { 181 // void gda_field_attributes_set_defined_size (GdaFieldAttributes *fa, glong size); 182 gda_field_attributes_set_defined_size(gdaFieldAttributes, size); 183 } 184 185 /** 186 * Returns: the name of fa. 187 */ 188 public string getName() 189 { 190 // const gchar* gda_field_attributes_get_name (GdaFieldAttributes *fa); 191 return Str.toString(gda_field_attributes_get_name(gdaFieldAttributes)); 192 } 193 194 /** 195 * Sets the name of fa to name. 196 * Params: 197 * name = the new name of fa. 198 */ 199 public void setName(string name) 200 { 201 // void gda_field_attributes_set_name (GdaFieldAttributes *fa, const gchar *name); 202 gda_field_attributes_set_name(gdaFieldAttributes, Str.toStringz(name)); 203 } 204 205 /** 206 * Returns: the name of the table to which this field belongs. 207 */ 208 public string getTable() 209 { 210 // const gchar* gda_field_attributes_get_table (GdaFieldAttributes *fa); 211 return Str.toString(gda_field_attributes_get_table(gdaFieldAttributes)); 212 } 213 214 /** 215 * Sets the name of the table to which the given field belongs. 216 * Params: 217 * table = table name. 218 */ 219 public void setTable(string table) 220 { 221 // void gda_field_attributes_set_table (GdaFieldAttributes *fa, const gchar *table); 222 gda_field_attributes_set_table(gdaFieldAttributes, Str.toStringz(table)); 223 } 224 225 /** 226 * Returns: fa's caption. 227 */ 228 public string getCaption() 229 { 230 // const gchar* gda_field_attributes_get_caption (GdaFieldAttributes *fa); 231 return Str.toString(gda_field_attributes_get_caption(gdaFieldAttributes)); 232 } 233 234 /** 235 * Sets fa's caption. 236 * Params: 237 * caption = caption. 238 */ 239 public void setCaption(string caption) 240 { 241 // void gda_field_attributes_set_caption (GdaFieldAttributes *fa, const gchar *caption); 242 gda_field_attributes_set_caption(gdaFieldAttributes, Str.toStringz(caption)); 243 } 244 245 /** 246 * Returns: the number of decimals of fa. 247 */ 248 public glong getScale() 249 { 250 // glong gda_field_attributes_get_scale (GdaFieldAttributes *fa); 251 return gda_field_attributes_get_scale(gdaFieldAttributes); 252 } 253 254 /** 255 * Sets the scale of fa to scale. 256 * Params: 257 * scale = number of decimals. 258 */ 259 public void setScale(glong scale) 260 { 261 // void gda_field_attributes_set_scale (GdaFieldAttributes *fa, glong scale); 262 gda_field_attributes_set_scale(gdaFieldAttributes, scale); 263 } 264 265 /** 266 * Returns: the type of fa. 267 */ 268 public GdaValueType getGdatype() 269 { 270 // GdaValueType gda_field_attributes_get_gdatype (GdaFieldAttributes *fa); 271 return gda_field_attributes_get_gdatype(gdaFieldAttributes); 272 } 273 274 /** 275 * Sets the type of fa to type. 276 * Params: 277 * type = the new type of fa. 278 */ 279 public void setGdatype(GdaValueType type) 280 { 281 // void gda_field_attributes_set_gdatype (GdaFieldAttributes *fa, GdaValueType type); 282 gda_field_attributes_set_gdatype(gdaFieldAttributes, type); 283 } 284 285 /** 286 * Gets the 'allow null' flag of the given field attributes. 287 * Returns: whether the given field allows null values or not (TRUE or FALSE). 288 */ 289 public int getAllowNull() 290 { 291 // gboolean gda_field_attributes_get_allow_null (GdaFieldAttributes *fa); 292 return gda_field_attributes_get_allow_null(gdaFieldAttributes); 293 } 294 295 /** 296 * Sets the 'allow null' flag of the given field attributes. 297 * Params: 298 * allow = whether the given field should allows null values or not. 299 */ 300 public void setAllowNull(int allow) 301 { 302 // void gda_field_attributes_set_allow_null (GdaFieldAttributes *fa, gboolean allow); 303 gda_field_attributes_set_allow_null(gdaFieldAttributes, allow); 304 } 305 306 /** 307 * Returns: whether if the given field is a primary key (TRUE or FALSE). 308 */ 309 public int getPrimaryKey() 310 { 311 // gboolean gda_field_attributes_get_primary_key (GdaFieldAttributes *fa); 312 return gda_field_attributes_get_primary_key(gdaFieldAttributes); 313 } 314 315 /** 316 * Sets the 'primary key' flag of the given field attributes. 317 * Params: 318 * pk = whether if the given field should be a primary key. 319 */ 320 public void setPrimaryKey(int pk) 321 { 322 // void gda_field_attributes_set_primary_key (GdaFieldAttributes *fa, gboolean pk); 323 gda_field_attributes_set_primary_key(gdaFieldAttributes, pk); 324 } 325 326 /** 327 * Returns: whether if the given field is an unique key (TRUE or FALSE). 328 */ 329 public int getUniqueKey() 330 { 331 // gboolean gda_field_attributes_get_unique_key (GdaFieldAttributes *fa); 332 return gda_field_attributes_get_unique_key(gdaFieldAttributes); 333 } 334 335 /** 336 * Sets the 'unique key' flag of the given field attributes. 337 * Params: 338 * uk = whether if the given field should be an unique key. 339 */ 340 public void setUniqueKey(int uk) 341 { 342 // void gda_field_attributes_set_unique_key (GdaFieldAttributes *fa, gboolean uk); 343 gda_field_attributes_set_unique_key(gdaFieldAttributes, uk); 344 } 345 346 /** 347 * Returns: fa's references. 348 */ 349 public string getReferences() 350 { 351 // const gchar* gda_field_attributes_get_references (GdaFieldAttributes *fa); 352 return Str.toString(gda_field_attributes_get_references(gdaFieldAttributes)); 353 } 354 355 /** 356 * Sets fa's references. 357 * Params: 358 * ref = references. 359 */ 360 public void setReferences(string doref) 361 { 362 // void gda_field_attributes_set_references (GdaFieldAttributes *fa, const gchar *ref); 363 gda_field_attributes_set_references(gdaFieldAttributes, Str.toStringz(doref)); 364 } 365 366 /** 367 * Returns: whether the given field is an auto incremented one (TRUE or FALSE). 368 */ 369 public int getAutoIncrement() 370 { 371 // gboolean gda_field_attributes_get_auto_increment (GdaFieldAttributes *fa); 372 return gda_field_attributes_get_auto_increment(gdaFieldAttributes); 373 } 374 375 /** 376 * Sets the auto increment flag for the given field. 377 * Params: 378 * isAuto = auto increment status. 379 */ 380 public void setAutoIncrement(int isAuto) 381 { 382 // void gda_field_attributes_set_auto_increment (GdaFieldAttributes *fa, gboolean is_auto); 383 gda_field_attributes_set_auto_increment(gdaFieldAttributes, isAuto); 384 } 385 386 /** 387 * Returns: the position of the field the attributes refer to in the containing data model. 388 */ 389 public int getPosition() 390 { 391 // gint gda_field_attributes_get_position (GdaFieldAttributes *fa); 392 return gda_field_attributes_get_position(gdaFieldAttributes); 393 } 394 395 /** 396 * Sets the position of the field the attributes refer to in the containing 397 * data model. 398 * Params: 399 * position = the wanted position of the field in the containing data model. 400 */ 401 public void setPosition(int position) 402 { 403 // void gda_field_attributes_set_position (GdaFieldAttributes *fa, gint position); 404 gda_field_attributes_set_position(gdaFieldAttributes, position); 405 } 406 407 /** 408 * Params: 409 * fa = a GdaFieldAttributes. 410 * Returns: fa's default value, as a GdaValue object. 411 */ 412 public Value getDefaultValue() 413 { 414 // const GdaValue* gda_field_attributes_get_default_value (GdaFieldAttributes *fa); 415 auto p = gda_field_attributes_get_default_value(gdaFieldAttributes); 416 417 if(p is null) 418 { 419 return null; 420 } 421 422 return ObjectG.getDObject!(Value)(cast(GdaValue*) p); 423 } 424 425 /** 426 * Sets fa's default GdaValue. 427 * Params: 428 * fa = a GdaFieldAttributes. 429 * defaultValue = default GdaValue for the field 430 */ 431 public void setDefaultValue(Value defaultValue) 432 { 433 // void gda_field_attributes_set_default_value (GdaFieldAttributes *fa, const GdaValue *default_value); 434 gda_field_attributes_set_default_value(gdaFieldAttributes, (defaultValue is null) ? null : defaultValue.getValueStruct()); 435 } 436 }