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-gda-blob.html
56 import tango
.io
.Stdout
; // use the tango loging?
60 private import gdac
.gdatypes
;
62 private import gdac
.gda
;
75 /** the main Gtk struct */
76 protected GdaBlob
* gdaBlob
;
79 public GdaBlob
* getBlobStruct()
85 /** the main Gtk struct as a void* */
86 protected void* getStruct()
88 return cast(void*)gdaBlob
;
92 * Sets our main struct and passes it to the parent class
94 public this (GdaBlob
* gdaBlob
)
98 if ( gdaBlob
is null )
103 Stdout("struct gdaBlob is null on constructor").newline
;
107 printf("struct gdaBlob is null on constructor");
114 assert(gdaBlob
!is null, "struct gdaBlob is null on constructor");
116 this.gdaBlob
= gdaBlob
;
125 * Opens an existing BLOB. The BLOB must be initialized by
126 * gda_connection_create_blob or obtained from a GdaValue.
128 * a GdaBlob structure obtained from a GdaValue or allocated by the
129 * user when he/she wants to create a new GdaBlob.
133 * 0 if everything's ok. In case of error, -1 is returned and the
134 * provider should have added an error to the connection.
136 public int open(GdaBlobMode mode
)
138 // gint gda_blob_open (GdaBlob *blob, GdaBlobMode mode);
139 return gda_blob_open(gdaBlob
, mode
);
143 * Reads a chunk of bytes from the BLOB into a user-provided location.
145 * a GdaBlob which is opened with the flag GDA_BLOB_MODE_READ set.
147 * buffer to read the data into.
149 * maximum number of bytes to read.
151 * on return it will point to the number of bytes actually read.
153 * 0 if everything's ok. In case of error, -1 is returned and the
154 * provider should have added an error to the connection.
156 public int read(void* buf
, int size
, int* bytesRead
)
158 // gint gda_blob_read (GdaBlob *blob, gpointer buf, gint size, gint *bytes_read);
159 return gda_blob_read(gdaBlob
, buf
, size
, bytesRead
);
163 * Writes a chunk of bytes from a user-provided location to the BLOB.
165 * a GdaBlob which is opened with the flag GDA_BLOB_MODE_WRITE set.
167 * buffer to write the data from.
169 * maximum number of bytes to read.
171 * on return it will point to the number of bytes actually written.
173 * 0 if everything's ok. In case of error, -1 is returned and the
174 * provider should have added an error to the connection.
176 public int write(void* buf
, int size
, int* bytesWritten
)
178 // gint gda_blob_write (GdaBlob *blob, gpointer buf, gint size, gint *bytes_written);
179 return gda_blob_write(gdaBlob
, buf
, size
, bytesWritten
);
183 * Sets the blob read/write position.
187 * offset added to the position specified by whence.
189 * SEEK_SET, SEEK_CUR or SEEK_END with the same meaning as in fseek(3).
191 * the current position in the blob or < 0 in case of error. In case
192 * of error the provider should have added an error to the connection.
194 public int lseek(int offset
, int whence
)
196 // gint gda_blob_lseek (GdaBlob *blob, gint offset, gint whence);
197 return gda_blob_lseek(gdaBlob
, offset
, whence
);
201 * Closes the BLOB. After calling this function, blob should no longer be used.
205 * 0 if everything's ok. In case of error, -1 is returned and the
206 * provider should have added an error to the connection.
210 // gint gda_blob_close (GdaBlob *blob);
211 return gda_blob_close(gdaBlob
);
215 * Removes the BLOB from the database. After calling this function, blob
216 * should no longer be used.
220 * 0 if everything's ok. In case of error, -1 is returned and the
221 * provider should have added an error to the connection.
225 // gint gda_blob_remove (GdaBlob *blob);
226 return gda_blob_remove(gdaBlob
);
230 * Let the provider free any internal data stored in blob. The user
231 * is still responsible for deallocating blob itself.
235 public void freeData()
237 // void gda_blob_free_data (GdaBlob *blob);
238 gda_blob_free_data(gdaBlob
);