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 = AtkStreamableContent.html 27 * outPack = atk 28 * outFile = StreamableContent 29 * strct = AtkStreamableContent 30 * realStrct= 31 * ctorStrct= 32 * clss = StreamableContent 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - atk_streamable_content_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.IOChannel 47 * - glib.Str 48 * structWrap: 49 * - GIOChannel* -> IOChannel 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module atk.StreamableContent; 56 57 public import gtkc.atktypes; 58 59 private import gtkc.atk; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 private import glib.IOChannel; 64 private import glib.Str; 65 66 67 68 /** 69 * An interface whereby an object allows its backing content to be 70 * streamed to clients. Typical implementors would be images or 71 * icons, HTML content, or multimedia display/rendering widgets. 72 * 73 * Negotiation of content type is allowed. Clients may examine the 74 * backing data and transform, convert, or parse the content in order 75 * to present it in an alternate form to end-users. 76 * 77 * The AtkStreamableContent interface is particularly useful for 78 * saving, printing, or post-processing entire documents, or for 79 * persisting alternate views of a document. If document content 80 * itself is being serialized, stored, or converted, then use of the 81 * AtkStreamableContent interface can help address performance 82 * issues. Unlike most ATK interfaces, this interface is not strongly 83 * tied to the current user-agent view of the a particular document, 84 * but may in some cases give access to the underlying model data. 85 */ 86 public class StreamableContent 87 { 88 89 /** the main Gtk struct */ 90 protected AtkStreamableContent* atkStreamableContent; 91 92 93 /** Get the main Gtk struct */ 94 public AtkStreamableContent* getStreamableContentStruct() 95 { 96 return atkStreamableContent; 97 } 98 99 100 /** the main Gtk struct as a void* */ 101 protected void* getStruct() 102 { 103 return cast(void*)atkStreamableContent; 104 } 105 106 /** 107 * Sets our main struct and passes it to the parent class 108 */ 109 public this (AtkStreamableContent* atkStreamableContent) 110 { 111 this.atkStreamableContent = atkStreamableContent; 112 } 113 114 /** 115 */ 116 117 /** 118 * Gets the number of mime types supported by this object. 119 * Returns: a gint which is the number of mime types supported by the object. 120 */ 121 public int getNMimeTypes() 122 { 123 // gint atk_streamable_content_get_n_mime_types (AtkStreamableContent *streamable); 124 return atk_streamable_content_get_n_mime_types(atkStreamableContent); 125 } 126 127 /** 128 * Gets the character string of the specified mime type. The first mime 129 * type is at position 0, the second at position 1, and so on. 130 * Params: 131 * i = a gint representing the position of the mime type starting from 0 132 * Returns: a gchar* representing the specified mime type; the caller should not free the character string. 133 */ 134 public string getMimeType(int i) 135 { 136 // const gchar * atk_streamable_content_get_mime_type (AtkStreamableContent *streamable, gint i); 137 return Str.toString(atk_streamable_content_get_mime_type(atkStreamableContent, i)); 138 } 139 140 /** 141 * Gets the content in the specified mime type. 142 * Params: 143 * mimeType = a gchar* representing the mime type 144 * Returns: A GIOChannel which contains the content in the specified mime type. [transfer full] 145 */ 146 public IOChannel getStream(string mimeType) 147 { 148 // GIOChannel * atk_streamable_content_get_stream (AtkStreamableContent *streamable, const gchar *mime_type); 149 auto p = atk_streamable_content_get_stream(atkStreamableContent, Str.toStringz(mimeType)); 150 151 if(p is null) 152 { 153 return null; 154 } 155 156 return ObjectG.getDObject!(IOChannel)(cast(GIOChannel*) p); 157 } 158 159 /** 160 * Get a string representing a URI in IETF standard format 161 * (see http://www.ietf.org/rfc/rfc2396.txt) from which the object's content 162 * may be streamed in the specified mime-type, if one is available. 163 * If mime_type is NULL, the URI for the default (and possibly only) mime-type is 164 * returned. 165 * Note that it is possible for get_uri to return NULL but for 166 * get_stream to work nonetheless, since not all GIOChannels connect to URIs. 167 * Since 1.12 168 * Params: 169 * mimeType = a gchar* representing the mime type, or NULL to request a URI 170 * for the default mime type. 171 * Returns: Returns a string representing a URI, or NULL if no corresponding URI can be constructed. 172 */ 173 public string getUri(string mimeType) 174 { 175 // const gchar * atk_streamable_content_get_uri (AtkStreamableContent *streamable, const gchar *mime_type); 176 return Str.toString(atk_streamable_content_get_uri(atkStreamableContent, Str.toStringz(mimeType))); 177 } 178 }