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

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

Initial release

File size: 4.4 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.NetworkService;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.SocketConnectableIF;
26private import gio.SocketConnectableT;
27private import glib.ConstructionException;
28private import glib.Str;
29private import gobject.ObjectG;
30
31
32/**
33 * Like #GNetworkAddress does with hostnames, #GNetworkService
34 * provides an easy way to resolve a SRV record, and then attempt to
35 * connect to one of the hosts that implements that service, handling
36 * service priority/weighting, multiple IP addresses, and multiple
37 * address families.
38 *
39 * See #GSrvTarget for more information about SRV records, and see
40 * #GSocketConnectable for and example of using the connectable
41 * interface.
42 */
43public class NetworkService : ObjectG, SocketConnectableIF
44{
45        /** the main Gtk struct */
46        protected GNetworkService* gNetworkService;
47
48        /** Get the main Gtk struct */
49        public GNetworkService* getNetworkServiceStruct()
50        {
51                return gNetworkService;
52        }
53
54        /** the main Gtk struct as a void* */
55        protected override void* getStruct()
56        {
57                return cast(void*)gNetworkService;
58        }
59
60        protected override void setStruct(GObject* obj)
61        {
62                gNetworkService = cast(GNetworkService*)obj;
63                super.setStruct(obj);
64        }
65
66        /**
67         * Sets our main struct and passes it to the parent class.
68         */
69        public this (GNetworkService* gNetworkService, bool ownedRef = false)
70        {
71                this.gNetworkService = gNetworkService;
72                super(cast(GObject*)gNetworkService, ownedRef);
73        }
74
75        // add the SocketConnectable capabilities
76        mixin SocketConnectableT!(GNetworkService);
77
78
79        /** */
80        public static GType getType()
81        {
82                return g_network_service_get_type();
83        }
84
85        /**
86         * Creates a new #GNetworkService representing the given @service,
87         * @protocol, and @domain. This will initially be unresolved; use the
88         * #GSocketConnectable interface to resolve it.
89         *
90         * Params:
91         *     service = the service type to look up (eg, "ldap")
92         *     protocol = the networking protocol to use for @service (eg, "tcp")
93         *     domain = the DNS domain to look up the service in
94         *
95         * Returns: a new #GNetworkService
96         *
97         * Since: 2.22
98         *
99         * Throws: ConstructionException GTK+ fails to create the object.
100         */
101        public this(string service, string protocol, string domain)
102        {
103                auto p = g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain));
104               
105                if(p is null)
106                {
107                        throw new ConstructionException("null returned by new");
108                }
109               
110                this(cast(GNetworkService*) p, true);
111        }
112
113        /**
114         * Gets the domain that @srv serves. This might be either UTF-8 or
115         * ASCII-encoded, depending on what @srv was created with.
116         *
117         * Returns: @srv's domain name
118         *
119         * Since: 2.22
120         */
121        public string getDomain()
122        {
123                return Str.toString(g_network_service_get_domain(gNetworkService));
124        }
125
126        /**
127         * Gets @srv's protocol name (eg, "tcp").
128         *
129         * Returns: @srv's protocol name
130         *
131         * Since: 2.22
132         */
133        public string getProtocol()
134        {
135                return Str.toString(g_network_service_get_protocol(gNetworkService));
136        }
137
138        /**
139         * Get's the URI scheme used to resolve proxies. By default, the service name
140         * is used as scheme.
141         *
142         * Returns: @srv's scheme name
143         *
144         * Since: 2.26
145         */
146        public string getScheme()
147        {
148                return Str.toString(g_network_service_get_scheme(gNetworkService));
149        }
150
151        /**
152         * Gets @srv's service name (eg, "ldap").
153         *
154         * Returns: @srv's service name
155         *
156         * Since: 2.22
157         */
158        public string getService()
159        {
160                return Str.toString(g_network_service_get_service(gNetworkService));
161        }
162
163        /**
164         * Set's the URI scheme used to resolve proxies. By default, the service name
165         * is used as scheme.
166         *
167         * Params:
168         *     scheme = a URI scheme
169         *
170         * Since: 2.26
171         */
172        public void setScheme(string scheme)
173        {
174                g_network_service_set_scheme(gNetworkService, Str.toStringz(scheme));
175        }
176}
Note: See TracBrowser for help on using the repository browser.