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  = GConverter.html
27  * outPack = gio
28  * outFile = ConverterIF
29  * strct   = GConverter
30  * realStrct=
31  * ctorStrct=
32  * clss    = ConverterT
33  * interf  = ConverterIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_converter_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.ErrorG
47  * 	- glib.GException
48  * structWrap:
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gio.ConverterIF;
55 
56 public  import gtkc.giotypes;
57 
58 private import gtkc.gio;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 private import glib.ErrorG;
63 private import glib.GException;
64 
65 
66 
67 /**
68  * GConverter is implemented by objects that convert
69  * binary data in various ways. The conversion can be
70  * stateful and may fail at any place.
71  *
72  * Some example conversions are: character set conversion,
73  * compression, decompression and regular expression
74  * replace.
75  */
76 public interface ConverterIF
77 {
78 	
79 	
80 	/** Get the main Gtk struct */
81 	public GConverter* getConverterTStruct();
82 	
83 	/** the main Gtk struct as a void* */
84 	protected void* getStruct();
85 	
86 	
87 	/**
88 	 */
89 	
90 	/**
91 	 * This is the main operation used when converting data. It is to be called
92 	 * multiple times in a loop, and each time it will do some work, i.e.
93 	 * producing some output (in outbuf) or consuming some input (from inbuf) or
94 	 * both. If its not possible to do any work an error is returned.
95 	 * Note that a single call may not consume all input (or any input at all).
96 	 * Also a call may produce output even if given no input, due to state stored
97 	 * in the converter producing output.
98 	 * If any data was either produced or consumed, and then an error happens, then
99 	 * only the successful conversion is reported and the error is returned on the
100 	 * next call.
101 	 * A full conversion loop involves calling this method repeatedly, each time
102 	 * giving it new input and space output space. When there is no more input
103 	 * data after the data in inbuf, the flag G_CONVERTER_INPUT_AT_END must be set.
104 	 * The loop will be (unless some error happens) returning G_CONVERTER_CONVERTED
105 	 * each time until all data is consumed and all output is produced, then
106 	 * G_CONVERTER_FINISHED is returned instead. Note, that G_CONVERTER_FINISHED
107 	 * may be returned even if G_CONVERTER_INPUT_AT_END is not set, for instance
108 	 * in a decompression converter where the end of data is detectable from the
109 	 * data (and there might even be other data after the end of the compressed data).
110 	 * When some data has successfully been converted bytes_read and is set to
111 	 * the number of bytes read from inbuf, and bytes_written is set to indicate
112 	 * how many bytes was written to outbuf. If there are more data to output
113 	 * or consume (i.e. unless the G_CONVERTER_INPUT_AT_END is specified) then
114 	 * G_CONVERTER_CONVERTED is returned, and if no more data is to be output
115 	 * then G_CONVERTER_FINISHED is returned.
116 	 * On error G_CONVERTER_ERROR is returned and error is set accordingly.
117 	 * Since 2.24
118 	 * Params:
119 	 * inbuf = the buffer
120 	 * containing the data to convert. [array length=inbuf_size][element-type guint8]
121 	 * outbuf = a buffer to write converted data in.
122 	 * flags = a GConverterFlags controlling the conversion details
123 	 * bytesRead = will be set to the number of bytes read from inbuf on success. [out]
124 	 * bytesWritten = will be set to the number of bytes written to outbuf on success. [out]
125 	 * Returns: a GConverterResult, G_CONVERTER_ERROR on error.
126 	 * Throws: GException on failure.
127 	 */
128 	public GConverterResult convert(void[] inbuf, void[] outbuf, GConverterFlags flags, out gsize bytesRead, out gsize bytesWritten);
129 	
130 	/**
131 	 * Resets all internal state in the converter, making it behave
132 	 * as if it was just created. If the converter has any internal
133 	 * state that would produce output then that output is lost.
134 	 * Since 2.24
135 	 */
136 	public void reset();
137 }