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  = 
27  * outPack = gda
28  * outFile = ParameterList
29  * strct   = GdaParameterList
30  * realStrct=
31  * ctorStrct=
32  * clss    = ParameterList
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gda_parameter_list_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gda.Parameter
49  * structWrap:
50  * 	- GList* -> ListG
51  * 	- GdaParameter* -> Parameter
52  * 	- GdaParameterList* -> ParameterList
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gda.ParameterList;
59 
60 public  import gdac.gdatypes;
61 
62 private import gdac.gda;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glib.Str;
68 private import glib.ListG;
69 private import gda.Parameter;
70 
71 
72 
73 
74 /**
75  *  Parameters are the way clients have to send an unlimited number
76  *  of arguments to the providers.
77  */
78 public class ParameterList
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GdaParameterList* gdaParameterList;
83 	
84 	
85 	public GdaParameterList* getParameterListStruct()
86 	{
87 		return gdaParameterList;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected void* getStruct()
93 	{
94 		return cast(void*)gdaParameterList;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GdaParameterList* gdaParameterList)
101 	{
102 		this.gdaParameterList = gdaParameterList;
103 	}
104 	
105 	/**
106 	 */
107 	
108 	/**
109 	 * Returns:
110 	 */
111 	public static GType getType()
112 	{
113 		// GType gda_parameter_list_get_type (void);
114 		return gda_parameter_list_get_type();
115 	}
116 	
117 	/**
118 	 * Creates a new GdaParameterList.
119 	 * Throws: ConstructionException GTK+ fails to create the object.
120 	 */
121 	public this ()
122 	{
123 		// GdaParameterList* gda_parameter_list_new (void);
124 		auto p = gda_parameter_list_new();
125 		if(p is null)
126 		{
127 			throw new ConstructionException("null returned by gda_parameter_list_new()");
128 		}
129 		this(cast(GdaParameterList*) p);
130 	}
131 	
132 	/**
133 	 * Releases all memory occupied by the given GdaParameterList.
134 	 */
135 	public void free()
136 	{
137 		// void gda_parameter_list_free (GdaParameterList *plist);
138 		gda_parameter_list_free(gdaParameterList);
139 	}
140 	
141 	/**
142 	 * Creates a new GdaParameterList from an existing one.
143 	 * Returns: a newly allocated GdaParameterList with a copy of the data in plist.
144 	 */
145 	public ParameterList copy()
146 	{
147 		// GdaParameterList* gda_parameter_list_copy (GdaParameterList *plist);
148 		auto p = gda_parameter_list_copy(gdaParameterList);
149 		
150 		if(p is null)
151 		{
152 			return null;
153 		}
154 		
155 		return ObjectG.getDObject!(ParameterList)(cast(GdaParameterList*) p);
156 	}
157 	
158 	/**
159 	 * Adds a new parameter to the given GdaParameterList. Note that param is,
160 	 * when calling this function, is owned by the GdaParameterList, so the
161 	 * caller should just forget about it and not try to free the parameter once
162 	 * it's been added to the GdaParameterList.
163 	 * Params:
164 	 * param = the GdaParameter to be added to the list.
165 	 */
166 	public void addParameter(Parameter param)
167 	{
168 		// void gda_parameter_list_add_parameter (GdaParameterList *plist,  GdaParameter *param);
169 		gda_parameter_list_add_parameter(gdaParameterList, (param is null) ? null : param.getParameterStruct());
170 	}
171 	
172 	/**
173 	 * Gets the names of all parameters in the parameter list.
174 	 * Returns: a GList containing the names of the parameters. After using it, you should free this list by calling g_list_free.
175 	 */
176 	public ListG getNames()
177 	{
178 		// GList* gda_parameter_list_get_names (GdaParameterList *plist);
179 		auto p = gda_parameter_list_get_names(gdaParameterList);
180 		
181 		if(p is null)
182 		{
183 			return null;
184 		}
185 		
186 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
187 	}
188 	
189 	/**
190 	 * Gets a GdaParameter from the parameter list given its name.
191 	 * Params:
192 	 * name = name of the parameter to search for.
193 	 * Returns: the GdaParameter identified by name, if found, or NULL if not found.
194 	 */
195 	public Parameter find(string name)
196 	{
197 		// GdaParameter* gda_parameter_list_find (GdaParameterList *plist,  const gchar *name);
198 		auto p = gda_parameter_list_find(gdaParameterList, Str.toStringz(name));
199 		
200 		if(p is null)
201 		{
202 			return null;
203 		}
204 		
205 		return ObjectG.getDObject!(Parameter)(cast(GdaParameter*) p);
206 	}
207 	
208 	/**
209 	 * Clears the parameter list. This means removing all GdaParameter's currently
210 	 * being stored in the parameter list. After calling this function,
211 	 * the parameter list is empty.
212 	 */
213 	public void clear()
214 	{
215 		// void gda_parameter_list_clear (GdaParameterList *plist);
216 		gda_parameter_list_clear(gdaParameterList);
217 	}
218 	
219 	/**
220 	 * Returns: the number of parameters stored in the given parameter list.
221 	 */
222 	public uint getLength()
223 	{
224 		// guint gda_parameter_list_get_length (GdaParameterList *plist);
225 		return gda_parameter_list_get_length(gdaParameterList);
226 	}
227 }