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-GdaError.html 27 * outPack = gda 28 * outFile = ErrorGda 29 * strct = GdaError 30 * realStrct= 31 * ctorStrct= 32 * clss = ErrorGda 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * prefixes: 40 * - gda_error_ 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 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gda.ErrorGda; 56 57 public import gdac.gdatypes; 58 59 private import gdac.gda; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import glib.Str; 65 private import glib.ListG; 66 67 68 69 private import gobject.ObjectG; 70 71 /** 72 * Description 73 */ 74 public class ErrorGda : ObjectG 75 { 76 77 /** the main Gtk struct */ 78 protected GdaError* gdaError; 79 80 81 public GdaError* getErrorGdaStruct() 82 { 83 return gdaError; 84 } 85 86 87 /** the main Gtk struct as a void* */ 88 protected override void* getStruct() 89 { 90 return cast(void*)gdaError; 91 } 92 93 /** 94 * Sets our main struct and passes it to the parent class 95 */ 96 public this (GdaError* gdaError) 97 { 98 super(cast(GObject*)gdaError); 99 this.gdaError = gdaError; 100 } 101 102 protected override void setStruct(GObject* obj) 103 { 104 super.setStruct(obj); 105 gdaError = cast(GdaError*)obj; 106 } 107 108 /** */ 109 this (ListG glist) { 110 this( cast(GdaError*)glist.data ); 111 } 112 113 /** 114 */ 115 116 /** 117 * Throws: ConstructionException GTK+ fails to create the object. 118 */ 119 public this () 120 { 121 // GdaError* gda_error_new (void); 122 auto p = gda_error_new(); 123 if(p is null) 124 { 125 throw new ConstructionException("null returned by gda_error_new()"); 126 } 127 this(cast(GdaError*) p); 128 } 129 130 /** 131 * Frees the memory allocated by the error object. 132 */ 133 public void free() 134 { 135 // void gda_error_free (GdaError *error); 136 gda_error_free(gdaError); 137 } 138 139 /** 140 * Creates a new list which contains the same errors as errors and 141 * adds a reference for each error in the list. 142 * You must free the list using gda_error_list_free. 143 * Params: 144 * errors = a GList holding error objects. 145 * Returns: a list of errors. 146 */ 147 public static ListG listCopy(ListG errors) 148 { 149 // GList* gda_error_list_copy (const GList *errors); 150 auto p = gda_error_list_copy((errors is null) ? null : errors.getListGStruct()); 151 152 if(p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(ListG)(cast(GList*) p); 158 } 159 160 /** 161 * Frees all error objects in the list and the list itself. 162 * After this function has been called, the errors parameter doesn't point 163 * to valid storage any more. 164 * Params: 165 * errors = a GList holding error objects. 166 */ 167 public static void listFree(ListG errors) 168 { 169 // void gda_error_list_free (GList *errors); 170 gda_error_list_free((errors is null) ? null : errors.getListGStruct()); 171 } 172 173 /** 174 * Returns: error's description. 175 */ 176 public string getDescription() 177 { 178 // const gchar* gda_error_get_description (GdaError *error); 179 return Str.toString(gda_error_get_description(gdaError)); 180 } 181 182 /** 183 * Sets error's description. 184 * Params: 185 * description = a description. 186 */ 187 public void setDescription(string description) 188 { 189 // void gda_error_set_description (GdaError *error, const gchar *description); 190 gda_error_set_description(gdaError, Str.toStringz(description)); 191 } 192 193 /** 194 * Returns: error's number. 195 */ 196 public glong getNumber() 197 { 198 // glong gda_error_get_number (GdaError *error); 199 return gda_error_get_number(gdaError); 200 } 201 202 /** 203 * Sets error's number. 204 * Params: 205 * number = a number. 206 */ 207 public void setNumber(glong number) 208 { 209 // void gda_error_set_number (GdaError *error, glong number); 210 gda_error_set_number(gdaError, number); 211 } 212 213 /** 214 * Returns: error's source. 215 */ 216 public string getSource() 217 { 218 // const gchar* gda_error_get_source (GdaError *error); 219 return Str.toString(gda_error_get_source(gdaError)); 220 } 221 222 /** 223 * Sets error's source. 224 * Params: 225 * source = a source. 226 */ 227 public void setSource(string source) 228 { 229 // void gda_error_set_source (GdaError *error, const gchar *source); 230 gda_error_set_source(gdaError, Str.toStringz(source)); 231 } 232 233 /** 234 * Returns: error's SQL state. 235 */ 236 public string getSqlstate() 237 { 238 // const gchar* gda_error_get_sqlstate (GdaError *error); 239 return Str.toString(gda_error_get_sqlstate(gdaError)); 240 } 241 242 /** 243 * Sets error's SQL state. 244 * Params: 245 * sqlstate = SQL state. 246 */ 247 public void setSqlstate(string sqlstate) 248 { 249 // void gda_error_set_sqlstate (GdaError *error, const gchar *sqlstate); 250 gda_error_set_sqlstate(gdaError, Str.toStringz(sqlstate)); 251 } 252 }