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