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