1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <giomm/socketconnection.h>
7 #include <giomm/private/socketconnection_p.h>
8
9
10 /* Copyright (C) 2010 Jonathon Jongsma
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #include <gio/gio.h>
27 #include "slot_async.h"
28
29 namespace Gio
30 {
31
32 void
connect_async(const Glib::RefPtr<SocketAddress> & address,const SlotAsyncReady & slot,const Glib::RefPtr<Cancellable> & cancellable)33 SocketConnection::connect_async(const Glib::RefPtr<SocketAddress>& address,
34 const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
35 {
36 auto slot_copy = new SlotAsyncReady(slot);
37
38 g_socket_connection_connect_async(gobj(), Glib::unwrap(address), Glib::unwrap(cancellable),
39 &SignalProxy_async_callback, slot_copy);
40 }
41
42 void
connect_async(const Glib::RefPtr<SocketAddress> & address,const SlotAsyncReady & slot)43 SocketConnection::connect_async(
44 const Glib::RefPtr<SocketAddress>& address, const SlotAsyncReady& slot)
45 {
46 auto slot_copy = new SlotAsyncReady(slot);
47
48 g_socket_connection_connect_async(
49 gobj(), Glib::unwrap(address), nullptr, &SignalProxy_async_callback, slot_copy);
50 }
51
52 } // namespace Gio
53
54 namespace
55 {
56 } // anonymous namespace
57
58
59 namespace Glib
60 {
61
wrap(GSocketConnection * object,bool take_copy)62 Glib::RefPtr<Gio::SocketConnection> wrap(GSocketConnection* object, bool take_copy)
63 {
64 return Glib::RefPtr<Gio::SocketConnection>( dynamic_cast<Gio::SocketConnection*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
65 //We use dynamic_cast<> in case of multiple inheritance.
66 }
67
68 } /* namespace Glib */
69
70
71 namespace Gio
72 {
73
74
75 /* The *_Class implementation: */
76
init()77 const Glib::Class& SocketConnection_Class::init()
78 {
79 if(!gtype_) // create the GType if necessary
80 {
81 // Glib::Class has to know the class init function to clone custom types.
82 class_init_func_ = &SocketConnection_Class::class_init_function;
83
84 // This is actually just optimized away, apparently with no harm.
85 // Make sure that the parent type has been created.
86 //CppClassParent::CppObjectType::get_type();
87
88 // Create the wrapper type, with the same class/instance size as the base type.
89 register_derived_type(g_socket_connection_get_type());
90
91 // Add derived versions of interfaces, if the C type implements any interfaces:
92
93 }
94
95 return *this;
96 }
97
98
class_init_function(void * g_class,void * class_data)99 void SocketConnection_Class::class_init_function(void* g_class, void* class_data)
100 {
101 const auto klass = static_cast<BaseClassType*>(g_class);
102 CppClassParent::class_init_function(klass, class_data);
103
104
105 }
106
107
wrap_new(GObject * object)108 Glib::ObjectBase* SocketConnection_Class::wrap_new(GObject* object)
109 {
110 return new SocketConnection((GSocketConnection*)object);
111 }
112
113
114 /* The implementation: */
115
gobj_copy()116 GSocketConnection* SocketConnection::gobj_copy()
117 {
118 reference();
119 return gobj();
120 }
121
SocketConnection(const Glib::ConstructParams & construct_params)122 SocketConnection::SocketConnection(const Glib::ConstructParams& construct_params)
123 :
124 Gio::IOStream(construct_params)
125 {
126
127 }
128
SocketConnection(GSocketConnection * castitem)129 SocketConnection::SocketConnection(GSocketConnection* castitem)
130 :
131 Gio::IOStream((GIOStream*)(castitem))
132 {}
133
134
SocketConnection(SocketConnection && src)135 SocketConnection::SocketConnection(SocketConnection&& src) noexcept
136 : Gio::IOStream(std::move(src))
137 {}
138
operator =(SocketConnection && src)139 SocketConnection& SocketConnection::operator=(SocketConnection&& src) noexcept
140 {
141 Gio::IOStream::operator=(std::move(src));
142 return *this;
143 }
144
145
~SocketConnection()146 SocketConnection::~SocketConnection() noexcept
147 {}
148
149
150 SocketConnection::CppClassType SocketConnection::socketconnection_class_; // initialize static member
151
get_type()152 GType SocketConnection::get_type()
153 {
154 return socketconnection_class_.init().get_type();
155 }
156
157
get_base_type()158 GType SocketConnection::get_base_type()
159 {
160 return g_socket_connection_get_type();
161 }
162
163
connect(const Glib::RefPtr<SocketAddress> & address,const Glib::RefPtr<Cancellable> & cancellable)164 bool SocketConnection::connect(const Glib::RefPtr<SocketAddress>& address, const Glib::RefPtr<Cancellable>& cancellable)
165 {
166 GError* gerror = nullptr;
167 bool retvalue = g_socket_connection_connect(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
168 if(gerror)
169 ::Glib::Error::throw_exception(gerror);
170 return retvalue;
171 }
172
connect(const Glib::RefPtr<SocketAddress> & address)173 bool SocketConnection::connect(const Glib::RefPtr<SocketAddress>& address)
174 {
175 GError* gerror = nullptr;
176 bool retvalue = g_socket_connection_connect(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), nullptr, &(gerror));
177 if(gerror)
178 ::Glib::Error::throw_exception(gerror);
179 return retvalue;
180 }
181
connect_finish(const Glib::RefPtr<AsyncResult> & result)182 bool SocketConnection::connect_finish(const Glib::RefPtr<AsyncResult>& result)
183 {
184 GError* gerror = nullptr;
185 bool retvalue = g_socket_connection_connect_finish(gobj(), Glib::unwrap(result), &(gerror));
186 if(gerror)
187 ::Glib::Error::throw_exception(gerror);
188 return retvalue;
189 }
190
is_connected() const191 bool SocketConnection::is_connected() const
192 {
193 return g_socket_connection_is_connected(const_cast<GSocketConnection*>(gobj()));
194 }
195
get_socket()196 Glib::RefPtr<Socket> SocketConnection::get_socket()
197 {
198 Glib::RefPtr<Socket> retvalue = Glib::wrap(g_socket_connection_get_socket(gobj()));
199 if(retvalue)
200 retvalue->reference(); //The function does not do a ref for us.
201 return retvalue;
202 }
203
get_socket() const204 Glib::RefPtr<const Socket> SocketConnection::get_socket() const
205 {
206 return const_cast<SocketConnection*>(this)->get_socket();
207 }
208
get_local_address()209 Glib::RefPtr<SocketAddress> SocketConnection::get_local_address()
210 {
211 GError* gerror = nullptr;
212 Glib::RefPtr<SocketAddress> retvalue = Glib::wrap(g_socket_connection_get_local_address(gobj(), &(gerror)));
213 if(gerror)
214 ::Glib::Error::throw_exception(gerror);
215 return retvalue;
216 }
217
get_local_address() const218 Glib::RefPtr<const SocketAddress> SocketConnection::get_local_address() const
219 {
220 return const_cast<SocketConnection*>(this)->get_local_address();
221 }
222
get_remote_address()223 Glib::RefPtr<SocketAddress> SocketConnection::get_remote_address()
224 {
225 GError* gerror = nullptr;
226 Glib::RefPtr<SocketAddress> retvalue = Glib::wrap(g_socket_connection_get_remote_address(gobj(), &(gerror)));
227 if(gerror)
228 ::Glib::Error::throw_exception(gerror);
229 return retvalue;
230 }
231
get_remote_address() const232 Glib::RefPtr<const SocketAddress> SocketConnection::get_remote_address() const
233 {
234 return const_cast<SocketConnection*>(this)->get_remote_address();
235 }
236
create(const Glib::RefPtr<Socket> & socket)237 Glib::RefPtr<SocketConnection> SocketConnection::create(const Glib::RefPtr<Socket>& socket)
238 {
239 return Glib::wrap(g_socket_connection_factory_create_connection(const_cast<GSocket*>(Glib::unwrap(socket))));
240 }
241
242
property_socket() const243 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Socket> > SocketConnection::property_socket() const
244 {
245 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Socket> >(this, "socket");
246 }
247
248
249 } // namespace Gio
250
251
252