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