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