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