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