[glibmm] add NetworkService class



commit 4862ae78626af13e44d9c6332908c1be0d7fd60a
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Fri Jun 19 22:39:18 2009 -0500

    add NetworkService class

 .gitignore                                |    4 ++
 ChangeLog                                 |   11 +++++
 gio/src/Makefile_list_of_hg.am_fragment   |    1 +
 gio/src/gio_signals.defs                  |   29 ++++++++++++++
 gio/src/networkservice.ccg                |   26 ++++++++++++
 gio/src/networkservice.hg                 |   61 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gio.cc |    1 +
 7 files changed, 133 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 977625a..1c052cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,6 +128,10 @@ gio/giomm/mount.cc
 gio/giomm/mount.h
 gio/giomm/mountoperation.cc
 gio/giomm/mountoperation.h
+gio/giomm/networkaddress.cc
+gio/giomm/networkaddress.h
+gio/giomm/networkservice.cc
+gio/giomm/networkservice.h
 gio/giomm/outputstream.cc
 gio/giomm/outputstream.h
 gio/giomm/resolver.cc
diff --git a/ChangeLog b/ChangeLog
index 7b7d8ea..76adb18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-06-19  Jonathon Jongsma  <jonathon quotidian org>
+
+	Add NetworkService class
+
+	* .gitignore:
+	* gio/src/Makefile_list_of_hg.am_fragment:
+	* gio/src/gio_signals.defs:
+	* gio/src/networkservice.ccg: Copied from gio/src/socketaddress.ccg.
+	* gio/src/networkservice.hg: Added.
+	* tools/extra_defs_gen/generate_defs_gio.cc:
+
 2009-06-18  Jonathon Jongsma  <jonathon quotidian org>
 
 	* gio/giomm.h: update the main include header to include all of the
diff --git a/gio/src/Makefile_list_of_hg.am_fragment b/gio/src/Makefile_list_of_hg.am_fragment
index f6dd5f6..9077783 100644
--- a/gio/src/Makefile_list_of_hg.am_fragment
+++ b/gio/src/Makefile_list_of_hg.am_fragment
@@ -42,6 +42,7 @@ files_general_hg = \
                    mount.hg \
                    mountoperation.hg \
                    networkaddress.hg \
+                   networkservice.hg \
                    outputstream.hg \
                    resolver.hg \
                    seekable.hg \
diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs
index 2265f8f..549e5e0 100644
--- a/gio/src/gio_signals.defs
+++ b/gio/src/gio_signals.defs
@@ -786,4 +786,33 @@
   (construct-only #t)
 )
 
+;; From GNetworkService
+
+(define-property service
+  (of-object "GNetworkService")
+  (prop-type "GParamString")
+  (docs "Service name, eg 'ldap'")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property protocol
+  (of-object "GNetworkService")
+  (prop-type "GParamString")
+  (docs "Network protocol, eg 'tcp'")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property domain
+  (of-object "GNetworkService")
+  (prop-type "GParamString")
+  (docs "Network domain, eg, 'example.com'")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 
diff --git a/gio/src/networkservice.ccg b/gio/src/networkservice.ccg
new file mode 100644
index 0000000..251999b
--- /dev/null
+++ b/gio/src/networkservice.ccg
@@ -0,0 +1,26 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/asyncresult.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+} // namespace Gio
diff --git a/gio/src/networkservice.hg b/gio/src/networkservice.hg
new file mode 100644
index 0000000..2647c6b
--- /dev/null
+++ b/gio/src/networkservice.hg
@@ -0,0 +1,61 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/socketconnectable.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+/** A GSocketConnectable for resolving SRV records
+ *
+ * Like NetworkAddress does with hostnames, NetworkService provides an easy
+ * way to resolve a SRV record, and then attempt to connect to one of the hosts
+ * that implements that service, handling service priority/weighting, multiple
+ * IP addresses, and multiple address families.
+ *
+ * See SrvTarget for more information about SRV records, and see
+ * SocketConnectable for and example of using the connectable interface.
+ *
+ * @newin2p22
+ */
+class NetworkService : public Glib::Object,
+    public SocketConnectable
+{
+  _CLASS_GOBJECT(NetworkService, GNetworkService, G_NETWORK_SERVICE, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(SocketConnectable)
+
+  _WRAP_CTOR(NetworkService(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain), g_network_service_new)
+
+public:
+  _WRAP_CREATE(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain)
+
+  _WRAP_METHOD(Glib::ustring get_service() const, g_network_service_get_service)
+  _WRAP_METHOD(Glib::ustring get_protocol() const, g_network_service_get_protocol)
+  _WRAP_METHOD(Glib::ustring get_domain() const, g_network_service_get_domain)
+
+  _WRAP_PROPERTY("hostname", Glib::ustring)
+  _WRAP_PROPERTY("protocol", Glib::ustring)
+  _WRAP_PROPERTY("service", Glib::ustring)
+};
+
+} // namespace Gio
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index 7db0f42..5b9481e 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -80,6 +80,7 @@ int main (int argc, char** argv)
             << get_defs(G_TYPE_SRV_TARGET)
             << get_defs(G_TYPE_RESOLVER)
             << get_defs(G_TYPE_NETWORK_ADDRESS)
+            << get_defs(G_TYPE_NETWORK_SERVICE)
 
             << std::endl;
   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]