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