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-quark-list.html
27  * outPack = gda
28  * outFile = QuarkList
29  * strct   = GdaQuarkList
30  * realStrct=
31  * ctorStrct=
32  * clss    = QuarkList
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gda_quark_list_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * structWrap:
49  * 	- GList* -> ListG
50  * 	- GdaQuarkList* -> QuarkList
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gda.QuarkList;
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 glib.ListG;
67 
68 
69 
70 
71 /**
72  * Description
73  *  Parameter lists are used primary in the parsing and creation
74  *  of connection strings.
75  */
76 public class QuarkList
77 {
78 	
79 	/** the main Gtk struct */
80 	protected GdaQuarkList* gdaQuarkList;
81 	
82 	
83 	public GdaQuarkList* getQuarkListStruct()
84 	{
85 		return gdaQuarkList;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected void* getStruct()
91 	{
92 		return cast(void*)gdaQuarkList;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (GdaQuarkList* gdaQuarkList)
99 	{
100 		this.gdaQuarkList = gdaQuarkList;
101 	}
102 	
103 	/**
104 	 */
105 	
106 	/**
107 	 * Returns:
108 	 */
109 	public static GType getType()
110 	{
111 		// GType gda_quark_list_get_type (void);
112 		return gda_quark_list_get_type();
113 	}
114 	
115 	/**
116 	 * Creates a new GdaQuarkList, which is a set of key->value pairs,
117 	 * very similar to GLib's GHashTable, but with the only purpose to
118 	 * make easier the parsing and creation of data source connection
119 	 * strings.
120 	 * Throws: ConstructionException GTK+ fails to create the object.
121 	 */
122 	public this ()
123 	{
124 		// GdaQuarkList* gda_quark_list_new (void);
125 		auto p = gda_quark_list_new();
126 		if(p is null)
127 		{
128 			throw new ConstructionException("null returned by gda_quark_list_new()");
129 		}
130 		this(cast(GdaQuarkList*) p);
131 	}
132 	
133 	/**
134 	 * Creates a new GdaQuarkList given a connection string.
135 	 * Params:
136 	 * string = a connection string.
137 	 * Throws: ConstructionException GTK+ fails to create the object.
138 	 */
139 	public this (string string)
140 	{
141 		// GdaQuarkList* gda_quark_list_new_from_string (const gchar *string);
142 		auto p = gda_quark_list_new_from_string(Str.toStringz(string));
143 		if(p is null)
144 		{
145 			throw new ConstructionException("null returned by gda_quark_list_new_from_string(Str.toStringz(string))");
146 		}
147 		this(cast(GdaQuarkList*) p);
148 	}
149 	
150 	/**
151 	 * Creates a new GdaQuarkList from an existing one.
152 	 * Returns: a newly allocated GdaQuarkList with a copy of the data in qlist.
153 	 */
154 	public QuarkList copy()
155 	{
156 		// GdaQuarkList* gda_quark_list_copy (GdaQuarkList *qlist);
157 		auto p = gda_quark_list_copy(gdaQuarkList);
158 		
159 		if(p is null)
160 		{
161 			return null;
162 		}
163 		
164 		return ObjectG.getDObject!(QuarkList)(cast(GdaQuarkList*) p);
165 	}
166 	
167 	/**
168 	 * Releases all memory occupied by the given GdaQuarkList.
169 	 */
170 	public void free()
171 	{
172 		// void gda_quark_list_free (GdaQuarkList *qlist);
173 		gda_quark_list_free(gdaQuarkList);
174 	}
175 	
176 	/**
177 	 * Adds new key->value pairs from the given string. If cleanup is
178 	 * set to TRUE, the previous contents will be discarded before adding
179 	 * the new pairs.
180 	 * Params:
181 	 * string = a connection string.
182 	 * cleanup = whether to cleanup the previous content or not.
183 	 */
184 	public void addFromString(string string, int cleanup)
185 	{
186 		// void gda_quark_list_add_from_string (GdaQuarkList *qlist,  const gchar *string,  gboolean cleanup);
187 		gda_quark_list_add_from_string(gdaQuarkList, Str.toStringz(string), cleanup);
188 	}
189 	
190 	/**
191 	 * Searches for the value identified by name in the given GdaQuarkList.
192 	 * Params:
193 	 * name = the name of the value to search for.
194 	 * Returns: the value associated with the given key if found, or NULL if not found.
195 	 */
196 	public string find(string name)
197 	{
198 		// const gchar* gda_quark_list_find (GdaQuarkList *qlist,  const gchar *name);
199 		return Str.toString(gda_quark_list_find(gdaQuarkList, Str.toStringz(name)));
200 	}
201 	
202 	/**
203 	 * Removes an entry from the GdaQuarkList, given its name.
204 	 * Params:
205 	 * name = an entry name.
206 	 */
207 	public void remove(string name)
208 	{
209 		// void gda_quark_list_remove (GdaQuarkList *qlist,  const gchar *name);
210 		gda_quark_list_remove(gdaQuarkList, Str.toStringz(name));
211 	}
212 	
213 	/**
214 	 * Removes all strings in the given GdaQuarkList.
215 	 */
216 	public void clear()
217 	{
218 		// void gda_quark_list_clear (GdaQuarkList *qlist);
219 		gda_quark_list_clear(gdaQuarkList);
220 	}
221 }