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 module gdk.ContentDeserializer; 26 27 private import gdk.c.functions; 28 public import gdk.c.types; 29 private import gio.AsyncResultIF; 30 private import gio.AsyncResultT; 31 private import gio.Cancellable; 32 private import gio.InputStream; 33 private import glib.ErrorG; 34 private import glib.Str; 35 private import glib.c.functions; 36 private import gobject.ObjectG; 37 private import gobject.Value; 38 39 40 /** 41 * A `GdkContentDeserializer` is used to deserialize content received via 42 * inter-application data transfers. 43 * 44 * The `GdkContentDeserializer` transforms serialized content that is 45 * identified by a mime type into an object identified by a GType. 46 * 47 * GTK provides serializers and deserializers for common data types 48 * such as text, colors, images or file lists. To register your own 49 * deserialization functions, use [func@content_register_deserializer]. 50 * 51 * Also see [class@Gdk.ContentSerializer]. 52 */ 53 public class ContentDeserializer : ObjectG, AsyncResultIF 54 { 55 /** the main Gtk struct */ 56 protected GdkContentDeserializer* gdkContentDeserializer; 57 58 /** Get the main Gtk struct */ 59 public GdkContentDeserializer* getContentDeserializerStruct(bool transferOwnership = false) 60 { 61 if (transferOwnership) 62 ownedRef = false; 63 return gdkContentDeserializer; 64 } 65 66 /** the main Gtk struct as a void* */ 67 protected override void* getStruct() 68 { 69 return cast(void*)gdkContentDeserializer; 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GdkContentDeserializer* gdkContentDeserializer, bool ownedRef = false) 76 { 77 this.gdkContentDeserializer = gdkContentDeserializer; 78 super(cast(GObject*)gdkContentDeserializer, ownedRef); 79 } 80 81 // add the AsyncResult capabilities 82 mixin AsyncResultT!(GdkContentDeserializer); 83 84 85 /** */ 86 public static GType getType() 87 { 88 return gdk_content_deserializer_get_type(); 89 } 90 91 /** 92 * Gets the cancellable for the current operation. 93 * 94 * This is the `GCancellable` that was passed to [func@content_deserialize_async]. 95 * 96 * Returns: the cancellable for the current operation 97 */ 98 public Cancellable getCancellable() 99 { 100 auto __p = gdk_content_deserializer_get_cancellable(gdkContentDeserializer); 101 102 if(__p is null) 103 { 104 return null; 105 } 106 107 return ObjectG.getDObject!(Cancellable)(cast(GCancellable*) __p); 108 } 109 110 /** 111 * Gets the GType to create an instance of. 112 * 113 * Returns: the GType for the current operation 114 */ 115 public GType getGtype() 116 { 117 return gdk_content_deserializer_get_gtype(gdkContentDeserializer); 118 } 119 120 /** 121 * Gets the input stream for the current operation. 122 * 123 * This is the stream that was passed to [func@content_deserialize_async]. 124 * 125 * Returns: the input stream for the current operation 126 */ 127 public InputStream getInputStream() 128 { 129 auto __p = gdk_content_deserializer_get_input_stream(gdkContentDeserializer); 130 131 if(__p is null) 132 { 133 return null; 134 } 135 136 return ObjectG.getDObject!(InputStream)(cast(GInputStream*) __p); 137 } 138 139 /** 140 * Gets the mime type to deserialize from. 141 * 142 * Returns: the mime type for the current operation 143 */ 144 public string getMimeType() 145 { 146 return Str.toString(gdk_content_deserializer_get_mime_type(gdkContentDeserializer)); 147 } 148 149 /** 150 * Gets the I/O priority for the current operation. 151 * 152 * This is the priority that was passed to [funccontent_deserialize_async]. 153 * 154 * Returns: the I/O priority for the current operation 155 */ 156 public int getPriority() 157 { 158 return gdk_content_deserializer_get_priority(gdkContentDeserializer); 159 } 160 161 /** 162 * Gets the data that was associated with the current operation. 163 * 164 * See [method@Gdk.ContentDeserializer.set_task_data]. 165 * 166 * Returns: the task data for @deserializer 167 */ 168 public void* getTaskData() 169 { 170 return gdk_content_deserializer_get_task_data(gdkContentDeserializer); 171 } 172 173 /** 174 * Gets the user data that was passed when the deserializer was registered. 175 * 176 * Returns: the user data for this deserializer 177 */ 178 public void* getUserData() 179 { 180 return gdk_content_deserializer_get_user_data(gdkContentDeserializer); 181 } 182 183 /** 184 * Gets the `GValue` to store the deserialized object in. 185 * 186 * Returns: the `GValue` for the current operation 187 */ 188 public Value getValue() 189 { 190 auto __p = gdk_content_deserializer_get_value(gdkContentDeserializer); 191 192 if(__p is null) 193 { 194 return null; 195 } 196 197 return ObjectG.getDObject!(Value)(cast(GValue*) __p); 198 } 199 200 /** 201 * Indicate that the deserialization has ended with an error. 202 * 203 * This function consumes @error. 204 * 205 * Params: 206 * error = a `GError` 207 */ 208 public void returnError(ErrorG error) 209 { 210 gdk_content_deserializer_return_error(gdkContentDeserializer, (error is null) ? null : error.getErrorGStruct()); 211 } 212 213 /** 214 * Indicate that the deserialization has been successfully completed. 215 */ 216 public void returnSuccess() 217 { 218 gdk_content_deserializer_return_success(gdkContentDeserializer); 219 } 220 221 /** 222 * Associate data with the current deserialization operation. 223 * 224 * Params: 225 * data = data to associate with this operation 226 * notify = destroy notify for @data 227 */ 228 public void setTaskData(void* data, GDestroyNotify notify) 229 { 230 gdk_content_deserializer_set_task_data(gdkContentDeserializer, data, notify); 231 } 232 }