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 = GZlibCompressor.html 27 * outPack = gio 28 * outFile = ZlibCompressor 29 * strct = GZlibCompressor 30 * realStrct= 31 * ctorStrct= 32 * clss = ZlibCompressor 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - ConverterIF 40 * prefixes: 41 * - g_zlib_compressor_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gio.FileInfo 48 * - gio.ConverterT 49 * - gio.ConverterIF 50 * structWrap: 51 * - GFileInfo* -> FileInfo 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gio.ZlibCompressor; 58 59 public import gtkc.giotypes; 60 61 private import gtkc.gio; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import gio.FileInfo; 66 private import gio.ConverterT; 67 private import gio.ConverterIF; 68 69 70 private import gobject.ObjectG; 71 72 /** 73 * GZlibCompressor is an implementation of GConverter that 74 * compresses data using zlib. 75 */ 76 public class ZlibCompressor : ObjectG, ConverterIF 77 { 78 79 /** the main Gtk struct */ 80 protected GZlibCompressor* gZlibCompressor; 81 82 83 /** Get the main Gtk struct */ 84 public GZlibCompressor* getZlibCompressorStruct() 85 { 86 return gZlibCompressor; 87 } 88 89 90 /** the main Gtk struct as a void* */ 91 protected override void* getStruct() 92 { 93 return cast(void*)gZlibCompressor; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class 98 */ 99 public this (GZlibCompressor* gZlibCompressor) 100 { 101 super(cast(GObject*)gZlibCompressor); 102 this.gZlibCompressor = gZlibCompressor; 103 } 104 105 protected override void setStruct(GObject* obj) 106 { 107 super.setStruct(obj); 108 gZlibCompressor = cast(GZlibCompressor*)obj; 109 } 110 111 // add the Converter capabilities 112 mixin ConverterT!(GZlibCompressor); 113 114 /** 115 */ 116 117 /** 118 * Creates a new GZlibCompressor. 119 * Since 2.24 120 * Params: 121 * format = The format to use for the compressed data 122 * level = compression level (0-9), -1 for default 123 * Throws: ConstructionException GTK+ fails to create the object. 124 */ 125 public this (GZlibCompressorFormat format, int level) 126 { 127 // GZlibCompressor * g_zlib_compressor_new (GZlibCompressorFormat format, int level); 128 auto p = g_zlib_compressor_new(format, level); 129 if(p is null) 130 { 131 throw new ConstructionException("null returned by g_zlib_compressor_new(format, level)"); 132 } 133 this(cast(GZlibCompressor*) p); 134 } 135 136 /** 137 * Returns the "file-info" property. 138 * Since 2.26 139 * Returns: a GFileInfo, or NULL. [transfer none] 140 */ 141 public FileInfo getFileInfo() 142 { 143 // GFileInfo * g_zlib_compressor_get_file_info (GZlibCompressor *compressor); 144 auto p = g_zlib_compressor_get_file_info(gZlibCompressor); 145 146 if(p is null) 147 { 148 return null; 149 } 150 151 return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p); 152 } 153 154 /** 155 * Sets file_info in compressor. If non-NULL, and compressor's 156 * "format" property is G_ZLIB_COMPRESSOR_FORMAT_GZIP, 157 * it will be used to set the file name and modification time in 158 * the GZIP header of the compressed data. 159 * Note: it is an error to call this function while a compression is in 160 * progress; it may only be called immediately after creation of compressor, 161 * or after resetting it with g_converter_reset(). 162 * Since 2.26 163 * Params: 164 * fileInfo = a GFileInfo. [allow-none] 165 */ 166 public void setFileInfo(FileInfo fileInfo) 167 { 168 // void g_zlib_compressor_set_file_info (GZlibCompressor *compressor, GFileInfo *file_info); 169 g_zlib_compressor_set_file_info(gZlibCompressor, (fileInfo is null) ? null : fileInfo.getFileInfoStruct()); 170 } 171 }