alternative to assert
[gtkD.git] / gtkD / srcgda / gda / Error.d
blob9d98cf490d1e37d99cd86dc5d2d0d2a0e1fc5410
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = libgda-GdaError.html
26 * outPack = gda
27 * outFile = Error
28 * strct = GdaError
29 * realStrct=
30 * ctorStrct=
31 * clss = Error
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_error_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.ListG
45 * structWrap:
46 * - GList* -> ListG
47 * module aliases:
48 * local aliases:
51 module gda.Error;
53 version(noAssert)
55 version(Tango)
57 import tango.io.Stdout; // use the tango loging?
61 private import gdac.gdatypes;
63 private import gdac.gda;
66 private import glib.ListG;
71 /**
72 * Description
74 public class Error
77 /** the main Gtk struct */
78 protected GdaError* gdaError;
81 public GdaError* getErrorStruct()
83 return gdaError;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gdaError;
93 /**
94 * Sets our main struct and passes it to the parent class
96 public this (GdaError* gdaError)
98 version(noAssert)
100 if ( gdaError is null )
102 int zero = 0;
103 version(Tango)
105 Stdout("struct gdaError is null on constructor").newline;
107 else
109 printf("struct gdaError is null on constructor");
111 zero = zero / zero;
114 else
116 assert(gdaError !is null, "struct gdaError is null on constructor");
118 this.gdaError = gdaError;
121 this (ListG glist) {
122 this.gdaError = cast(GdaError *) glist.data;
130 * Returns :
132 public this ()
134 // GdaError* gda_error_new (void);
135 this(cast(GdaError*)gda_error_new() );
139 * Frees the memory allocated by the error object.
140 * error :
141 * the error object.
143 public void free()
145 // void gda_error_free (GdaError *error);
146 gda_error_free(gdaError);
150 * Creates a new list which contains the same errors as errors and
151 * adds a reference for each error in the list.
152 * You must free the list using gda_error_list_free.
153 * errors :
154 * a GList holding error objects.
155 * Returns :
156 * a list of errors.
158 public static ListG listCopy(ListG errors)
160 // GList* gda_error_list_copy (const GList *errors);
161 return new ListG( gda_error_list_copy((errors is null) ? null : errors.getListGStruct()) );
165 * Frees all error objects in the list and the list itself.
166 * After this function has been called, the errors parameter doesn't point
167 * to valid storage any more.
168 * errors :
169 * a GList holding error objects.
171 public static void listFree(ListG errors)
173 // void gda_error_list_free (GList *errors);
174 gda_error_list_free((errors is null) ? null : errors.getListGStruct());
178 * error :
179 * a GdaError.
180 * Returns :
181 * error's description.
183 public char[] getDescription()
185 // const gchar* gda_error_get_description (GdaError *error);
186 return Str.toString(gda_error_get_description(gdaError) );
190 * Sets error's description.
191 * error :
192 * a GdaError.
193 * description :
194 * a description.
196 public void setDescription(char[] description)
198 // void gda_error_set_description (GdaError *error, const gchar *description);
199 gda_error_set_description(gdaError, Str.toStringz(description));
203 * error :
204 * a GdaError.
205 * Returns :
206 * error's number.
208 public int getNumber()
210 // glong gda_error_get_number (GdaError *error);
211 return gda_error_get_number(gdaError);
215 * Sets error's number.
216 * error :
217 * a GdaError.
218 * number :
219 * a number.
221 public void setNumber(int number)
223 // void gda_error_set_number (GdaError *error, glong number);
224 gda_error_set_number(gdaError, number);
228 * error :
229 * a GdaError.
230 * Returns :
231 * error's source.
233 public char[] getSource()
235 // const gchar* gda_error_get_source (GdaError *error);
236 return Str.toString(gda_error_get_source(gdaError) );
240 * Sets error's source.
241 * error :
242 * a GdaError.
243 * source :
244 * a source.
246 public void setSource(char[] source)
248 // void gda_error_set_source (GdaError *error, const gchar *source);
249 gda_error_set_source(gdaError, Str.toStringz(source));
253 * error :
254 * a GdaError.
255 * Returns :
256 * error's SQL state.
258 public char[] getSqlstate()
260 // const gchar* gda_error_get_sqlstate (GdaError *error);
261 return Str.toString(gda_error_get_sqlstate(gdaError) );
265 * Sets error's SQL state.
266 * error :
267 * a GdaError.
268 * sqlstate :
269 * SQL state.
271 public void setSqlstate(char[] sqlstate)
273 // void gda_error_set_sqlstate (GdaError *error, const gchar *sqlstate);
274 gda_error_set_sqlstate(gdaError, Str.toStringz(sqlstate));