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-blob.html 27 * outPack = gda 28 * outFile = Blob 29 * strct = GdaBlob 30 * realStrct= 31 * ctorStrct= 32 * clss = Blob 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gda_blob_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * module aliases: 48 * local aliases: 49 * overrides: 50 */ 51 52 module gda.Blob; 53 54 public import gdac.gdatypes; 55 56 private import gdac.gda; 57 private import glib.ConstructionException; 58 private import gobject.ObjectG; 59 60 61 62 63 64 65 /** 66 * Description 67 */ 68 public class Blob 69 { 70 71 /** the main Gtk struct */ 72 protected GdaBlob* gdaBlob; 73 74 75 public GdaBlob* getBlobStruct() 76 { 77 return gdaBlob; 78 } 79 80 81 /** the main Gtk struct as a void* */ 82 protected void* getStruct() 83 { 84 return cast(void*)gdaBlob; 85 } 86 87 /** 88 * Sets our main struct and passes it to the parent class 89 */ 90 public this (GdaBlob* gdaBlob) 91 { 92 this.gdaBlob = gdaBlob; 93 } 94 95 /** 96 */ 97 98 /** 99 * Opens an existing BLOB. The BLOB must be initialized by 100 * gda_connection_create_blob or obtained from a GdaValue. 101 * Params: 102 * mode = see GdaBlobMode. 103 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection. 104 */ 105 public int open(GdaBlobMode mode) 106 { 107 // gint gda_blob_open (GdaBlob *blob, GdaBlobMode mode); 108 return gda_blob_open(gdaBlob, mode); 109 } 110 111 /** 112 * Reads a chunk of bytes from the BLOB into a user-provided location. 113 * Params: 114 * buf = buffer to read the data into. 115 * size = maximum number of bytes to read. 116 * bytesRead = on return it will point to the number of bytes actually read. 117 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection. 118 */ 119 public int read(void* buf, int size, out int bytesRead) 120 { 121 // gint gda_blob_read (GdaBlob *blob, gpointer buf, gint size, gint *bytes_read); 122 return gda_blob_read(gdaBlob, buf, size, &bytesRead); 123 } 124 125 /** 126 * Writes a chunk of bytes from a user-provided location to the BLOB. 127 * Params: 128 * buf = buffer to write the data from. 129 * size = maximum number of bytes to read. 130 * bytesWritten = on return it will point to the number of bytes actually written. 131 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection. 132 */ 133 public int write(void* buf, int size, out int bytesWritten) 134 { 135 // gint gda_blob_write (GdaBlob *blob, gpointer buf, gint size, gint *bytes_written); 136 return gda_blob_write(gdaBlob, buf, size, &bytesWritten); 137 } 138 139 /** 140 * Sets the blob read/write position. 141 * Params: 142 * offset = offset added to the position specified by whence. 143 * whence = SEEK_SET, SEEK_CUR or SEEK_END with the same meaning as in fseek(3). 144 * Returns: the current position in the blob or < 0 in case of error. In case of error the provider should have added an error to the connection. 145 */ 146 public int lseek(int offset, int whence) 147 { 148 // gint gda_blob_lseek (GdaBlob *blob, gint offset, gint whence); 149 return gda_blob_lseek(gdaBlob, offset, whence); 150 } 151 152 /** 153 * Closes the BLOB. After calling this function, blob should no longer be used. 154 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection. 155 */ 156 public int close() 157 { 158 // gint gda_blob_close (GdaBlob *blob); 159 return gda_blob_close(gdaBlob); 160 } 161 162 /** 163 * Removes the BLOB from the database. After calling this function, blob 164 * should no longer be used. 165 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection. 166 */ 167 public int remove() 168 { 169 // gint gda_blob_remove (GdaBlob *blob); 170 return gda_blob_remove(gdaBlob); 171 } 172 173 /** 174 * Let the provider free any internal data stored in blob. The user 175 * is still responsible for deallocating blob itself. 176 */ 177 public void freeData() 178 { 179 // void gda_blob_free_data (GdaBlob *blob); 180 gda_blob_free_data(gdaBlob); 181 } 182 }