root/trunk/src/gio/InetSocketAddress.d

Revision 938, 4.1 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  = GInetSocketAddress.html
27  * outPack = gio
28  * outFile = InetSocketAddress
29  * strct   = GInetSocketAddress
30  * realStrct=
31  * ctorStrct=GSocketAddress
32  * clss    = InetSocketAddress
33  * interf  =
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_inet_socket_address_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  *  - gio.InetAddress
47  * structWrap:
48  *  - GInetAddress* -> InetAddress
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53
54 module gio.InetSocketAddress;
55
56 public  import gtkc.giotypes;
57
58 private import gtkc.gio;
59 private import glib.ConstructionException;
60
61
62 private import gio.InetAddress;
63
64
65
66 private import gio.SocketAddress;
67
68 /**
69  * Description
70  * An IPv4 or IPv6 socket address; that is, the combination of a
71  * GInetAddress and a port number.
72  */
73 public class InetSocketAddress : SocketAddress
74 {
75    
76     /** the main Gtk struct */
77     protected GInetSocketAddress* gInetSocketAddress;
78    
79    
80     public GInetSocketAddress* getInetSocketAddressStruct()
81     {
82         return gInetSocketAddress;
83     }
84    
85    
86     /** the main Gtk struct as a void* */
87     protected override void* getStruct()
88     {
89         return cast(void*)gInetSocketAddress;
90     }
91    
92     /**
93      * Sets our main struct and passes it to the parent class
94      */
95     public this (GInetSocketAddress* gInetSocketAddress)
96     {
97         if(gInetSocketAddress is null)
98         {
99             this = null;
100             return;
101         }
102         //Check if there already is a D object for this gtk struct
103         void* ptr = getDObject(cast(GObject*)gInetSocketAddress);
104         if( ptr !is null )
105         {
106             this = cast(InetSocketAddress)ptr;
107             return;
108         }
109         super(cast(GSocketAddress*)gInetSocketAddress);
110         this.gInetSocketAddress = gInetSocketAddress;
111     }
112    
113     protected override void setStruct(GObject* obj)
114     {
115         super.setStruct(obj);
116         gInetSocketAddress = cast(GInetSocketAddress*)obj;
117     }
118    
119     /**
120      */
121    
122     /**
123      * Creates a new GInetSocketAddress for address and port.
124      * Since 2.22
125      * Params:
126      * address = a GInetAddress
127      * port = a port number
128      * Throws: ConstructionException GTK+ fails to create the object.
129      */
130     public this (InetAddress address, ushort port)
131     {
132         // GSocketAddress * g_inet_socket_address_new (GInetAddress *address,  guint16 port);
133         auto p = g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port);
134         if(p is null)
135         {
136             throw new ConstructionException("null returned by g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port)");
137         }
138         this(cast(GInetSocketAddress*) p);
139     }
140    
141     /**
142      * Gets address's GInetAddress.
143      * Since 2.22
144      * Returns: the GInetAddress for address, which must be g_object_ref()'d if it will be stored. [transfer none]
145      */
146     public InetAddress getAddress()
147     {
148         // GInetAddress * g_inet_socket_address_get_address (GInetSocketAddress *address);
149         auto p = g_inet_socket_address_get_address(gInetSocketAddress);
150         if(p is null)
151         {
152             return null;
153         }
154         return new InetAddress(cast(GInetAddress*) p);
155     }
156    
157     /**
158      * Gets address's port.
159      * Since 2.22
160      * Returns: the port for address
161      */
162     public ushort getPort()
163     {
164         // guint16 g_inet_socket_address_get_port (GInetSocketAddress *address);
165         return g_inet_socket_address_get_port(gInetSocketAddress);
166     }
167 }
Note: See TracBrowser for help on using the browser.