root/trunk/src/gio/MemoryInputStream.d

Revision 938, 4.6 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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  = GMemoryInputStream.html
27  * outPack = gio
28  * outFile = MemoryInputStream
29  * strct   = GMemoryInputStream
30  * realStrct=
31  * ctorStrct=GInputStream
32  * clss    = MemoryInputStream
33  * interf  =
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  *  - SeekableIF
40  * prefixes:
41  *  - g_memory_input_stream_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - gio.SeekableT
48  *  - gio.SeekableIF
49  * structWrap:
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54
55 module gio.MemoryInputStream;
56
57 public  import gtkc.giotypes;
58
59 private import gtkc.gio;
60 private import glib.ConstructionException;
61
62
63 private import gio.SeekableT;
64 private import gio.SeekableIF;
65
66
67
68 private import gio.InputStream;
69
70 /**
71  * Description
72  * GMemoryInputStream is a class for using arbitrary
73  * memory chunks as input for GIO streaming input operations.
74  */
75 public class MemoryInputStream : InputStream, SeekableIF
76 {
77    
78     /** the main Gtk struct */
79     protected GMemoryInputStream* gMemoryInputStream;
80    
81    
82     public GMemoryInputStream* getMemoryInputStreamStruct()
83     {
84         return gMemoryInputStream;
85     }
86    
87    
88     /** the main Gtk struct as a void* */
89     protected override void* getStruct()
90     {
91         return cast(void*)gMemoryInputStream;
92     }
93    
94     /**
95      * Sets our main struct and passes it to the parent class
96      */
97     public this (GMemoryInputStream* gMemoryInputStream)
98     {
99         if(gMemoryInputStream is null)
100         {
101             this = null;
102             return;
103         }
104         //Check if there already is a D object for this gtk struct
105         void* ptr = getDObject(cast(GObject*)gMemoryInputStream);
106         if( ptr !is null )
107         {
108             this = cast(MemoryInputStream)ptr;
109             return;
110         }
111         super(cast(GInputStream*)gMemoryInputStream);
112         this.gMemoryInputStream = gMemoryInputStream;
113     }
114    
115     protected override void setStruct(GObject* obj)
116     {
117         super.setStruct(obj);
118         gMemoryInputStream = cast(GMemoryInputStream*)obj;
119     }
120    
121     // add the Seekable capabilities
122     mixin SeekableT!(GMemoryInputStream);
123    
124     /**
125      */
126    
127     /**
128      * Creates a new empty GMemoryInputStream.
129      * Throws: ConstructionException GTK+ fails to create the object.
130      */
131     public this ()
132     {
133         // GInputStream * g_memory_input_stream_new (void);
134         auto p = g_memory_input_stream_new();
135         if(p is null)
136         {
137             throw new ConstructionException("null returned by g_memory_input_stream_new()");
138         }
139         this(cast(GMemoryInputStream*) p);
140     }
141    
142     /**
143      * Creates a new GMemoryInputStream with data in memory of a given size.
144      * Params:
145      * data = input data. [array length=len][element-type guint8]
146      * len = length of the data, may be -1 if data is a nul-terminated string
147      * destroy = function that is called to free data, or NULL. [allow-none]
148      * Throws: ConstructionException GTK+ fails to create the object.
149      */
150     public this (void* data, gssize len, GDestroyNotify destroy)
151     {
152         // GInputStream * g_memory_input_stream_new_from_data (const void *data,  gssize len,  GDestroyNotify destroy);
153         auto p = g_memory_input_stream_new_from_data(data, len, destroy);
154         if(p is null)
155         {
156             throw new ConstructionException("null returned by g_memory_input_stream_new_from_data(data, len, destroy)");
157         }
158         this(cast(GMemoryInputStream*) p);
159     }
160    
161     /**
162      * Appends data to data that can be read from the input stream
163      * Params:
164      * data = input data. [array length=len][element-type guint8]
165      * len = length of the data, may be -1 if data is a nul-terminated string
166      * destroy = function that is called to free data, or NULL. [allow-none]
167      */
168     public void addData(void* data, gssize len, GDestroyNotify destroy)
169     {
170         // void g_memory_input_stream_add_data (GMemoryInputStream *stream,  const void *data,  gssize len,  GDestroyNotify destroy);
171         g_memory_input_stream_add_data(gMemoryInputStream, data, len, destroy);
172     }
173 }
Note: See TracBrowser for help on using the browser.