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 private import gobject.ObjectG; 63 64 65 private import glib.Str; 66 private import gio.SocketConnectableT; 67 private import gio.SocketConnectableIF; 68 69 70 71 private import gobject.ObjectG; 72 73 /** 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 * 80 * See GSrvTarget for more information about SRV records, and see 81 * GSocketConnectable for and example of using the connectable 82 * interface. 83 */ 84 public class NetworkService : ObjectG, SocketConnectableIF 85 { 86 87 /** the main Gtk struct */ 88 protected GNetworkService* gNetworkService; 89 90 91 public GNetworkService* getNetworkServiceStruct() 92 { 93 return gNetworkService; 94 } 95 96 97 /** the main Gtk struct as a void* */ 98 protected override void* getStruct() 99 { 100 return cast(void*)gNetworkService; 101 } 102 103 /** 104 * Sets our main struct and passes it to the parent class 105 */ 106 public this (GNetworkService* gNetworkService) 107 { 108 super(cast(GObject*)gNetworkService); 109 this.gNetworkService = gNetworkService; 110 } 111 112 protected override void setStruct(GObject* obj) 113 { 114 super.setStruct(obj); 115 gNetworkService = cast(GNetworkService*)obj; 116 } 117 118 // add the SocketConnectable capabilities 119 mixin SocketConnectableT!(GNetworkService); 120 121 /** 122 */ 123 124 /** 125 * Creates a new GNetworkService representing the given service, 126 * protocol, and domain. This will initially be unresolved; use the 127 * GSocketConnectable interface to resolve it. 128 * Since 2.22 129 * Params: 130 * service = the service type to look up (eg, "ldap") 131 * protocol = the networking protocol to use for service (eg, "tcp") 132 * domain = the DNS domain to look up the service in 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this (string service, string protocol, string domain) 136 { 137 // GSocketConnectable * g_network_service_new (const gchar *service, const gchar *protocol, const gchar *domain); 138 auto p = g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain)); 139 if(p is null) 140 { 141 throw new ConstructionException("null returned by g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain))"); 142 } 143 this(cast(GNetworkService*) p); 144 } 145 146 /** 147 * Gets srv's service name (eg, "ldap"). 148 * Since 2.22 149 * Returns: srv's service name 150 */ 151 public string getService() 152 { 153 // const gchar * g_network_service_get_service (GNetworkService *srv); 154 return Str.toString(g_network_service_get_service(gNetworkService)); 155 } 156 157 /** 158 * Gets srv's protocol name (eg, "tcp"). 159 * Since 2.22 160 * Returns: srv's protocol name 161 */ 162 public string getProtocol() 163 { 164 // const gchar * g_network_service_get_protocol (GNetworkService *srv); 165 return Str.toString(g_network_service_get_protocol(gNetworkService)); 166 } 167 168 /** 169 * Gets the domain that srv serves. This might be either UTF-8 or 170 * ASCII-encoded, depending on what srv was created with. 171 * Since 2.22 172 * Returns: srv's domain name 173 */ 174 public string getDomain() 175 { 176 // const gchar * g_network_service_get_domain (GNetworkService *srv); 177 return Str.toString(g_network_service_get_domain(gNetworkService)); 178 } 179 180 /** 181 * Get's the URI scheme used to resolve proxies. By default, the service name 182 * is used as scheme. 183 * Since 2.26 184 * Returns: srv's scheme name 185 */ 186 public string getScheme() 187 { 188 // const gchar * g_network_service_get_scheme (GNetworkService *srv); 189 return Str.toString(g_network_service_get_scheme(gNetworkService)); 190 } 191 192 /** 193 * Set's the URI scheme used to resolve proxies. By default, the service name 194 * is used as scheme. 195 * Since 2.26 196 * Params: 197 * scheme = a URI scheme 198 */ 199 public void setScheme(string scheme) 200 { 201 // void g_network_service_set_scheme (GNetworkService *srv, const gchar *scheme); 202 g_network_service_set_scheme(gNetworkService, Str.toStringz(scheme)); 203 } 204 }