summaryrefslogtreecommitdiff
path: root/gio/src/socketclient.ccg
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon@quotidian.org>2010-01-03 21:56:52 -0600
committerJonathon Jongsma <jonathon@quotidian.org>2010-01-03 22:06:34 -0600
commit9bce2a080c911b5ea3782b96c0b27236a858c3db (patch)
tree06c8c4f00b8b85eec4e7a5758e7d68569c6bcdea /gio/src/socketclient.ccg
parent3bc53ee2a1566f6db327aed269b9e8b1f1f211c6 (diff)
downloadglibmm-9bce2a080c911b5ea3782b96c0b27236a858c3db.tar.gz
Add non-cancellable versions of a bunch of SocketClient functions
Diffstat (limited to 'gio/src/socketclient.ccg')
-rw-r--r--gio/src/socketclient.ccg111
1 files changed, 111 insertions, 0 deletions
diff --git a/gio/src/socketclient.ccg b/gio/src/socketclient.ccg
index b947e769..6d6687b8 100644
--- a/gio/src/socketclient.ccg
+++ b/gio/src/socketclient.ccg
@@ -42,6 +42,22 @@ SocketClient::connect_async(const Glib::RefPtr<SocketConnectable>& connectable,
}
void
+SocketClient::connect_async(const Glib::RefPtr<SocketConnectable>& connectable,
+ const SlotAsyncReady& slot)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_socket_client_connect_async (gobj(),
+ connectable->gobj (),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void
SocketClient::connect_to_host_async(const Glib::ustring& host_and_port,
guint16 default_port,
const Glib::RefPtr<Cancellable>& cancellable,
@@ -61,6 +77,24 @@ SocketClient::connect_to_host_async(const Glib::ustring& host_and_port,
}
void
+SocketClient::connect_to_host_async(const Glib::ustring& host_and_port,
+ guint16 default_port,
+ const SlotAsyncReady& slot)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_socket_client_connect_to_host_async (gobj(),
+ host_and_port.c_str (),
+ default_port,
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void
SocketClient::connect_to_service_async(const Glib::ustring& domain,
const Glib::ustring& service,
const Glib::RefPtr<Cancellable>& cancellable,
@@ -79,5 +113,82 @@ SocketClient::connect_to_service_async(const Glib::ustring& domain,
slot_copy);
}
+void
+SocketClient::connect_to_service_async(const Glib::ustring& domain,
+ const Glib::ustring& service,
+ const SlotAsyncReady& slot)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_socket_client_connect_to_service_async (gobj(),
+ domain.c_str (),
+ service.c_str (),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> SocketClient::connect(const Glib::RefPtr<SocketConnectable>& connectable)
+#else
+Glib::RefPtr<SocketConnection> SocketClient::connect(const Glib::RefPtr<SocketConnectable>& connectable, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect(gobj(), const_cast<GSocketConnectable*>(Glib::unwrap(connectable)), 0, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> SocketClient::connect_to_host(const Glib::ustring& host_and_port, guint16 default_port)
+#else
+Glib::RefPtr<SocketConnection> SocketClient::connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_host(gobj(), host_and_port.c_str(), default_port, 0, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> SocketClient::connect_to_service(const Glib::ustring& domain, const Glib::ustring& service)
+#else
+Glib::RefPtr<SocketConnection> SocketClient::connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_service(gobj(), domain.c_str(), service.c_str(), 0, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+
+}
} // namespace Gio