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