[glibmm] Add non-cancellable versions of a bunch of SocketClient functions
- From: Jonathon Jongsma <jjongsma src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glibmm] Add non-cancellable versions of a bunch of SocketClient functions
- Date: Mon, 4 Jan 2010 04:35:07 +0000 (UTC)
commit 9bce2a080c911b5ea3782b96c0b27236a858c3db
Author: Jonathon Jongsma <jonathon quotidian org>
Date: Sun Jan 3 21:56:52 2010 -0600
Add non-cancellable versions of a bunch of SocketClient functions
gio/src/socketclient.ccg | 111 ++++++++++++++++++++++++++++++++++++++++++++++
gio/src/socketclient.hg | 28 +++++++++---
2 files changed, 133 insertions(+), 6 deletions(-)
---
diff --git a/gio/src/socketclient.ccg b/gio/src/socketclient.ccg
index b947e76..6d6687b 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
diff --git a/gio/src/socketclient.hg b/gio/src/socketclient.hg
index c983e29..d6b7056 100644
--- a/gio/src/socketclient.hg
+++ b/gio/src/socketclient.hg
@@ -71,21 +71,37 @@ _WRAP_METHOD(Glib::RefPtr<SocketAddress> get_local_address(), g_socket_client_ge
_WRAP_METHOD(Glib::RefPtr<const SocketAddress> get_local_address() const, g_socket_client_get_local_address, constversion)
_WRAP_METHOD(void set_local_address(const Glib::RefPtr<SocketAddress>& address), g_socket_client_set_local_address)
-// TODO: non-cancellable version
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect, errthrow)
-// TODO: non-cancellable version
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable);
+#else
+Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_host, errthrow)
-// TODO: non-cancellable version
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port);
+#else
+Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_service, errthrow)
-// TODO: non-cancellable version
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service);
+#else
+Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
void connect_async(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+void connect_async(const Glib::RefPtr<SocketConnectable>& connectable, const SlotAsyncReady& slot);
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_finish(const Glib::RefPtr<AsyncResult>& result), g_socket_client_connect_finish, errthrow)
-// TODO: non-cancellable version
+
void connect_to_host_async(const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+void connect_to_host_async(const Glib::ustring& host_and_port, guint16 default_port, const SlotAsyncReady& slot);
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_host_finish(const Glib::RefPtr<AsyncResult>& result), g_socket_client_connect_to_host_finish, errthrow)
-// TODO: non-cancellable version
void connect_to_service_async(const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+void connect_to_service_async(const Glib::ustring& domain, const Glib::ustring& service, const SlotAsyncReady& slot);
_WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_service_finish(const Glib::RefPtr<AsyncResult>& result), g_socket_client_connect_to_service_finish, errthrow)
_WRAP_PROPERTY("family", SocketFamily)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]