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