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