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