source: appstream-generator/build/girepo/gio/TcpWrapperConnection.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.2 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library 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 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.TcpWrapperConnection;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.IOStream;
26private import gio.Socket;
27private import gio.SocketConnection;
28private import gio.TcpConnection;
29private import glib.ConstructionException;
30private import gobject.ObjectG;
31
32
33/**
34 * A #GTcpWrapperConnection can be used to wrap a #GIOStream that is
35 * based on a #GSocket, but which is not actually a
36 * #GSocketConnection. This is used by #GSocketClient so that it can
37 * always return a #GSocketConnection, even when the connection it has
38 * actually created is not directly a #GSocketConnection.
39 */
40public class TcpWrapperConnection : TcpConnection
41{
42        /** the main Gtk struct */
43        protected GTcpWrapperConnection* gTcpWrapperConnection;
44
45        /** Get the main Gtk struct */
46        public GTcpWrapperConnection* getTcpWrapperConnectionStruct()
47        {
48                return gTcpWrapperConnection;
49        }
50
51        /** the main Gtk struct as a void* */
52        protected override void* getStruct()
53        {
54                return cast(void*)gTcpWrapperConnection;
55        }
56
57        protected override void setStruct(GObject* obj)
58        {
59                gTcpWrapperConnection = cast(GTcpWrapperConnection*)obj;
60                super.setStruct(obj);
61        }
62
63        /**
64         * Sets our main struct and passes it to the parent class.
65         */
66        public this (GTcpWrapperConnection* gTcpWrapperConnection, bool ownedRef = false)
67        {
68                this.gTcpWrapperConnection = gTcpWrapperConnection;
69                super(cast(GTcpConnection*)gTcpWrapperConnection, ownedRef);
70        }
71
72
73        /** */
74        public static GType getType()
75        {
76                return g_tcp_wrapper_connection_get_type();
77        }
78
79        /**
80         * Wraps @base_io_stream and @socket together as a #GSocketConnection.
81         *
82         * Params:
83         *     baseIoStream = the #GIOStream to wrap
84         *     socket = the #GSocket associated with @base_io_stream
85         *
86         * Returns: the new #GSocketConnection.
87         *
88         * Since: 2.28
89         *
90         * Throws: ConstructionException GTK+ fails to create the object.
91         */
92        public this(IOStream baseIoStream, Socket socket)
93        {
94                auto p = g_tcp_wrapper_connection_new((baseIoStream is null) ? null : baseIoStream.getIOStreamStruct(), (socket is null) ? null : socket.getSocketStruct());
95               
96                if(p is null)
97                {
98                        throw new ConstructionException("null returned by new");
99                }
100               
101                this(cast(GTcpWrapperConnection*) p, true);
102        }
103
104        /**
105         * Get's @conn's base #GIOStream
106         *
107         * Returns: @conn's base #GIOStream
108         */
109        public IOStream getBaseIoStream()
110        {
111                auto p = g_tcp_wrapper_connection_get_base_io_stream(gTcpWrapperConnection);
112               
113                if(p is null)
114                {
115                        return null;
116                }
117               
118                return ObjectG.getDObject!(IOStream)(cast(GIOStream*) p);
119        }
120}
Note: See TracBrowser for help on using the repository browser.