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  */
67 public class Blob
68 {
69 	
70 	/** the main Gtk struct */
71 	protected GdaBlob* gdaBlob;
72 	
73 	
74 	public GdaBlob* getBlobStruct()
75 	{
76 		return gdaBlob;
77 	}
78 	
79 	
80 	/** the main Gtk struct as a void* */
81 	protected void* getStruct()
82 	{
83 		return cast(void*)gdaBlob;
84 	}
85 	
86 	/**
87 	 * Sets our main struct and passes it to the parent class
88 	 */
89 	public this (GdaBlob* gdaBlob)
90 	{
91 		this.gdaBlob = gdaBlob;
92 	}
93 	
94 	/**
95 	 */
96 	
97 	/**
98 	 * Opens an existing BLOB. The BLOB must be initialized by
99 	 * gda_connection_create_blob or obtained from a GdaValue.
100 	 * Params:
101 	 * mode = see GdaBlobMode.
102 	 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection.
103 	 */
104 	public int open(GdaBlobMode mode)
105 	{
106 		// gint gda_blob_open (GdaBlob *blob,  GdaBlobMode mode);
107 		return gda_blob_open(gdaBlob, mode);
108 	}
109 	
110 	/**
111 	 * Reads a chunk of bytes from the BLOB into a user-provided location.
112 	 * Params:
113 	 * buf = buffer to read the data into.
114 	 * size = maximum number of bytes to read.
115 	 * bytesRead = on return it will point to the number of bytes actually read.
116 	 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection.
117 	 */
118 	public int read(void* buf, int size, out int bytesRead)
119 	{
120 		// gint gda_blob_read (GdaBlob *blob,  gpointer buf,  gint size,  gint *bytes_read);
121 		return gda_blob_read(gdaBlob, buf, size, &bytesRead);
122 	}
123 	
124 	/**
125 	 * Writes a chunk of bytes from a user-provided location to the BLOB.
126 	 * Params:
127 	 * buf = buffer to write the data from.
128 	 * size = maximum number of bytes to read.
129 	 * bytesWritten = on return it will point to the number of bytes actually written.
130 	 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection.
131 	 */
132 	public int write(void* buf, int size, out int bytesWritten)
133 	{
134 		// gint gda_blob_write (GdaBlob *blob,  gpointer buf,  gint size,  gint *bytes_written);
135 		return gda_blob_write(gdaBlob, buf, size, &bytesWritten);
136 	}
137 	
138 	/**
139 	 * Sets the blob read/write position.
140 	 * Params:
141 	 * offset = offset added to the position specified by whence.
142 	 * whence = SEEK_SET, SEEK_CUR or SEEK_END with the same meaning as in fseek(3).
143 	 * 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.
144 	 */
145 	public int lseek(int offset, int whence)
146 	{
147 		// gint gda_blob_lseek (GdaBlob *blob,  gint offset,  gint whence);
148 		return gda_blob_lseek(gdaBlob, offset, whence);
149 	}
150 	
151 	/**
152 	 * Closes the BLOB. After calling this function, blob should no longer be used.
153 	 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection.
154 	 */
155 	public int close()
156 	{
157 		// gint gda_blob_close (GdaBlob *blob);
158 		return gda_blob_close(gdaBlob);
159 	}
160 	
161 	/**
162 	 * Removes the BLOB from the database. After calling this function, blob
163 	 * should no longer be used.
164 	 * Returns: 0 if everything's ok. In case of error, -1 is returned and the provider should have added an error to the connection.
165 	 */
166 	public int remove()
167 	{
168 		// gint gda_blob_remove (GdaBlob *blob);
169 		return gda_blob_remove(gdaBlob);
170 	}
171 	
172 	/**
173 	 * Let the provider free any internal data stored in blob. The user
174 	 * is still responsible for deallocating blob itself.
175 	 */
176 	public void freeData()
177 	{
178 		// void gda_blob_free_data (GdaBlob *blob);
179 		gda_blob_free_data(gdaBlob);
180 	}
181 }