root/trunk/src/gio/NetworkService.d

Revision 937, 5.8 kB (checked in by Mike Wey, 3 months ago)

Mention the exceptions to the LGPL in the source files.

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  = GNetworkService.html
27  * outPack = gio
28  * outFile = NetworkService
29  * strct   = GNetworkService
30  * realStrct=
31  * ctorStrct=GSocketConnectable
32  * clss    = NetworkService
33  * interf  =
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  *  - SocketConnectableIF
40  * prefixes:
41  *  - g_network_service_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - glib.Str
48  *  - gio.SocketConnectableT
49  *  - gio.SocketConnectableIF
50  * structWrap:
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55
56 module gio.NetworkService;
57
58 public  import gtkc.giotypes;
59
60 private import gtkc.gio;
61 private import glib.ConstructionException;
62
63
64 private import glib.Str;
65 private import gio.SocketConnectableT;
66 private import gio.SocketConnectableIF;
67
68
69
70 private import gobject.ObjectG;
71
72 /**
73  * Description
74  * Like GNetworkAddress does with hostnames, GNetworkService
75  * provides an easy way to resolve a SRV record, and then attempt to
76  * connect to one of the hosts that implements that service, handling
77  * service priority/weighting, multiple IP addresses, and multiple
78  * address families.
79  * See GSrvTarget for more information about SRV records, and see
80  * GSocketConnectable for and example of using the connectable
81  * interface.
82  */
83 public class NetworkService : ObjectG, SocketConnectableIF
84 {
85    
86     /** the main Gtk struct */
87     protected GNetworkService* gNetworkService;
88    
89    
90     public GNetworkService* getNetworkServiceStruct()
91     {
92         return gNetworkService;
93     }
94    
95    
96     /** the main Gtk struct as a void* */
97     protected override void* getStruct()
98     {
99         return cast(void*)gNetworkService;
100     }
101    
102     /**
103      * Sets our main struct and passes it to the parent class
104      */
105     public this (GNetworkService* gNetworkService)
106     {
107         if(gNetworkService is null)
108         {
109             this = null;
110             return;
111         }
112         //Check if there already is a D object for this gtk struct
113         void* ptr = getDObject(cast(GObject*)gNetworkService);
114         if( ptr !is null )
115         {
116             this = cast(NetworkService)ptr;
117             return;
118         }
119         super(cast(GObject*)gNetworkService);
120         this.gNetworkService = gNetworkService;
121     }
122    
123     protected override void setStruct(GObject* obj)
124     {
125         super.setStruct(obj);
126         gNetworkService = cast(GNetworkService*)obj;
127     }
128    
129     // add the SocketConnectable capabilities
130     mixin SocketConnectableT!(GNetworkService);
131    
132     /**
133      */
134    
135     /**
136      * Creates a new GNetworkService representing the given service,
137      * protocol, and domain. This will initially be unresolved; use the
138      * GSocketConnectable interface to resolve it.
139      * Since 2.22
140      * Params:
141      * service = the service type to look up (eg, "ldap")
142      * protocol = the networking protocol to use for service (eg, "tcp")
143      * domain = the DNS domain to look up the service in
144      * Throws: ConstructionException GTK+ fails to create the object.
145      */
146     public this (string service, string protocol, string domain)
147     {
148         // GSocketConnectable * g_network_service_new (const gchar *service,  const gchar *protocol,  const gchar *domain);
149         auto p = g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain));
150         if(p is null)
151         {
152             throw new ConstructionException("null returned by g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain))");
153         }
154         this(cast(GNetworkService*) p);
155     }
156    
157     /**
158      * Gets srv's service name (eg, "ldap").
159      * Since 2.22
160      * Returns: srv's service name
161      */
162     public string getService()
163     {
164         // const gchar * g_network_service_get_service (GNetworkService *srv);
165         return Str.toString(g_network_service_get_service(gNetworkService));
166     }
167    
168     /**
169      * Gets srv's protocol name (eg, "tcp").
170      * Since 2.22
171      * Returns: srv's protocol name
172      */
173     public string getProtocol()
174     {
175         // const gchar * g_network_service_get_protocol (GNetworkService *srv);
176         return Str.toString(g_network_service_get_protocol(gNetworkService));
177     }
178    
179     /**
180      * Gets the domain that srv serves. This might be either UTF-8 or
181      * ASCII-encoded, depending on what srv was created with.
182      * Since 2.22
183      * Returns: srv's domain name
184      */
185     public string getDomain()
186     {
187         // const gchar * g_network_service_get_domain (GNetworkService *srv);
188         return Str.toString(g_network_service_get_domain(gNetworkService));
189     }
190    
191     /**
192      * Get's the URI scheme used to resolve proxies. By default, the service name
193      * is used as scheme.
194      * Since 2.26
195      * Returns: srv's scheme name
196      */
197     public string getScheme()
198     {
199         // const gchar * g_network_service_get_scheme (GNetworkService *srv);
200         return Str.toString(g_network_service_get_scheme(gNetworkService));
201     }
202    
203     /**
204      * Set's the URI scheme used to resolve proxies. By default, the service name
205      * is used as scheme.
206      * Since 2.26
207      * Params:
208      * scheme = a URI scheme
209      */
210     public void setScheme(string scheme)
211     {
212         // void g_network_service_set_scheme (GNetworkService *srv,  const gchar *scheme);
213         g_network_service_set_scheme(gNetworkService, Str.toStringz(scheme));
214     }
215 }
Note: See TracBrowser for help on using the browser.