alternative to assert
[gtkD.git] / gtkD / src / atk / StreamableContent.d
blobb3be0b6f40ccea9f4fba50d27ea75bab8f1855e9
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkStreamableContent.html
26 * outPack = atk
27 * outFile = StreamableContent
28 * strct = AtkStreamableContent
29 * realStrct=
30 * ctorStrct=
31 * clss = StreamableContent
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_streamable_content_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.IOChannel
45 * - glib.Str
46 * structWrap:
47 * - GIOChannel* -> IOChannel
48 * module aliases:
49 * local aliases:
52 module atk.StreamableContent;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gtkc.atktypes;
64 private import gtkc.atk;
67 private import glib.IOChannel;
68 private import glib.Str;
73 /**
74 * Description
75 * An interface whereby an object allows its backing content to be streamed to
76 * clients. Typical implementors would be images or icons, HTML content, or
77 * multimedia display/rendering widgets.
78 * Negotiation of content type is allowed. Clients may examine the backing data
79 * and transform, convert, or parse the content in order to present it in an alternate form to end-users.
80 * The AtkStreamableContent interface is particularly useful for saving,
81 * printing, or post-processing entire documents, or for persisting alternate
82 * views of a document. If document content itself is being serialized,
83 * stored, or converted, then use of the AtkStreamableContent interface can help
84 * address performance issues. Unlike most ATK interfaces,
85 * this interface is not strongly tied to the current user-agent view of the
86 * a particular document, but may in some cases give access to the underlying model data.
88 public class StreamableContent
91 /** the main Gtk struct */
92 protected AtkStreamableContent* atkStreamableContent;
95 public AtkStreamableContent* getStreamableContentStruct()
97 return atkStreamableContent;
101 /** the main Gtk struct as a void* */
102 protected void* getStruct()
104 return cast(void*)atkStreamableContent;
108 * Sets our main struct and passes it to the parent class
110 public this (AtkStreamableContent* atkStreamableContent)
112 version(noAssert)
114 if ( atkStreamableContent is null )
116 int zero = 0;
117 version(Tango)
119 Stdout("struct atkStreamableContent is null on constructor").newline;
121 else
123 printf("struct atkStreamableContent is null on constructor");
125 zero = zero / zero;
128 else
130 assert(atkStreamableContent !is null, "struct atkStreamableContent is null on constructor");
132 this.atkStreamableContent = atkStreamableContent;
140 * Gets the number of mime types supported by this object.
141 * streamable:
142 * a GObject instance that implements AtkStreamableContentIface
143 * Returns:
144 * a gint which is the number of mime types supported by the object.
146 public int getNMimeTypes()
148 // gint atk_streamable_content_get_n_mime_types (AtkStreamableContent *streamable);
149 return atk_streamable_content_get_n_mime_types(atkStreamableContent);
153 * Gets the character string of the specified mime type. The first mime
154 * type is at position 0, the second at position 1, and so on.
155 * streamable:
156 * a GObject instance that implements AtkStreamableContent
157 * i:
158 * a gint representing the position of the mime type starting from 0
159 * Returns:
160 * : a gchar* representing the specified mime type; the caller
161 * should not free the character string.
163 public char[] getMimeType(int i)
165 // const gchar* atk_streamable_content_get_mime_type (AtkStreamableContent *streamable, gint i);
166 return Str.toString(atk_streamable_content_get_mime_type(atkStreamableContent, i) );
170 * Gets the content in the specified mime type.
171 * streamable:
172 * a GObject instance that implements AtkStreamableContentIface
173 * mime_type:
174 * a gchar* representing the mime type
175 * Returns:
176 * A GIOChannel which contains the content in the specified mime
177 * type.
179 public IOChannel getStream(char[] mimeType)
181 // GIOChannel* atk_streamable_content_get_stream (AtkStreamableContent *streamable, const gchar *mime_type);
182 return new IOChannel( atk_streamable_content_get_stream(atkStreamableContent, Str.toStringz(mimeType)) );
186 * Get a string representing a URI in IETF standard format
187 * (see http://www.ietf.org/rfc/rfc2396.txt) from which the object's content
188 * may be streamed in the specified mime-type, if one is available.
189 * If mime_type is NULL, the URI for the default (and possibly only) mime-type is
190 * returned.
191 * Note that it is possible for get_uri to return NULL but for
192 * get_stream to work nonetheless, since not all GIOChannels connect to URIs.
193 * streamable:
194 * a GObject instance that implements AtkStreamableContentIface
195 * mime_type:
196 * a gchar* representing the mime type, or NULL to request a URI
197 * for the default mime type.
198 * Returns:
199 * Returns a string representing a URI, or NULL if no corresponding URI
200 * can be constructed.
201 * Since ATK 1.12
203 public char[] getUri(char[] mimeType)
205 // gchar* atk_streamable_content_get_uri (AtkStreamableContent *streamable, const gchar *mime_type);
206 return Str.toString(atk_streamable_content_get_uri(atkStreamableContent, Str.toStringz(mimeType)) );