[glibmm: 1/8] wrap Gio::InetAddress



commit 7896cdddf7d987a9e06bc05e03864698b306cc43
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Mon May 18 23:10:01 2009 -0500

    wrap Gio::InetAddress

 .gitignore                              |    2 +
 ChangeLog                               |   11 +++++
 gio/src/Makefile_list_of_hg.am_fragment |    2 +-
 gio/src/gio_enums.defs                  |   45 ++++++++++++++++++-
 gio/src/inetaddress.ccg                 |   25 ++++++++++
 gio/src/inetaddress.hg                  |   76 +++++++++++++++++++++++++++++++
 tools/m4/convert_gio.m4                 |    1 +
 7 files changed, 160 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ac2a92e..f6ac1a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,6 +110,8 @@ gio/giomm/filteroutputstream.cc
 gio/giomm/filteroutputstream.h
 gio/giomm/icon.cc
 gio/giomm/icon.h
+gio/giomm/inetaddress.cc
+gio/giomm/inetaddress.h
 gio/giomm/inputstream.cc
 gio/giomm/inputstream.h
 gio/giomm/iostream.cc
diff --git a/ChangeLog b/ChangeLog
index 2fa2a59..abdf325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,17 @@
 
 2009-05-18  Jonathon Jongsma  <jonathon quotidian org>
 
+	wrap Gio::InetAddress
+
+	* .gitignore:
+	* gio/src/Makefile_list_of_hg.am_fragment:
+	* gio/src/gio_enums.defs: re-generate
+	* gio/src/inetaddress.ccg: Added
+	* gio/src/inetaddress.hg: Added.
+	* tools/m4/convert_gio.m4:
+
+2009-05-18  Jonathon Jongsma  <jonathon quotidian org>
+
 	Wrap new Gio::FileIOStream class
 
 	* gio/src/Makefile_list_of_hg.am_fragment:
diff --git a/gio/src/Makefile_list_of_hg.am_fragment b/gio/src/Makefile_list_of_hg.am_fragment
index 23a6f93..1c55d04 100644
--- a/gio/src/Makefile_list_of_hg.am_fragment
+++ b/gio/src/Makefile_list_of_hg.am_fragment
@@ -8,7 +8,7 @@ files_win32_hg =
 files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg emblem.hg emblemedicon.hg error.hg file.hg fileattributeinfo.hg \
 				   fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileiostream.hg fileoutputstream.hg \
 				   filemonitor.hg filterinputstream.hg filteroutputstream.hg filenamecompleter.hg \
-				   icon.hg inputstream.hg iostream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \
+				   icon.hg inetaddress.hg inputstream.hg iostream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \
 				   seekable.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
 				   bufferedoutputstream.hg datainputstream.hg dataoutputstream.hg enums.hg \
 				   memoryinputstream.hg themedicon.hg
diff --git a/gio/src/gio_enums.defs b/gio/src/gio_enums.defs
index 967a58b..530231d 100644
--- a/gio/src/gio_enums.defs
+++ b/gio/src/gio_enums.defs
@@ -1,4 +1,4 @@
-;; From /home/murrayc/checkouts/gnome224/glib/gio/gioenums.h
+;; From /home/jonathon/.jhbuild-prefix/include/glib-2.0/gio/gioenums.h
 
 (define-flags-extended AppInfoCreateFlags
   (in-module "G")
@@ -201,6 +201,8 @@
     '("would-merge" "G_IO_ERROR_WOULD_MERGE" "29")
     '("failed-handled" "G_IO_ERROR_FAILED_HANDLED" "30")
     '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES" "31")
+    '("not-initialized" "G_IO_ERROR_NOT_INITIALIZED" "32")
+    '("address-in-use" "G_IO_ERROR_ADDRESS_IN_USE" "33")
   )
 )
 
@@ -257,3 +259,44 @@
   )
 )
 
+(define-enum-extended ResolverError
+  (in-module "G")
+  (c-name "GResolverError")
+  (values
+    '("not-found" "G_RESOLVER_ERROR_NOT_FOUND" "0")
+    '("temporary-failure" "G_RESOLVER_ERROR_TEMPORARY_FAILURE" "1")
+    '("internal" "G_RESOLVER_ERROR_INTERNAL" "2")
+  )
+)
+
+(define-enum-extended SocketFamily
+  (in-module "G")
+  (c-name "GSocketFamily")
+  (values
+    '("invalid" "G_SOCKET_FAMILY_INVALID" "0")
+    '("ipv6" "G_SOCKET_FAMILY_IPV6" "3")
+  )
+)
+
+(define-enum-extended SocketType
+  (in-module "G")
+  (c-name "GSocketType")
+  (values
+    '("invalid" "G_SOCKET_TYPE_INVALID" "0")
+    '("stream" "G_SOCKET_TYPE_STREAM" "1")
+    '("datagram" "G_SOCKET_TYPE_DATAGRAM" "2")
+    '("seqpacket" "G_SOCKET_TYPE_SEQPACKET" "3")
+  )
+)
+
+(define-enum-extended SocketMsgFlags
+  (in-module "G")
+  (c-name "GSocketMsgFlags")
+  (values
+    '("none" "G_SOCKET_MSG_NONE" "0")
+    '("oob" "G_SOCKET_MSG_OOB" "#error")
+    '("peek" "G_SOCKET_MSG_PEEK" "#error")
+    '("dontroute" "G_SOCKET_MSG_DONTROUTE" "#error")
+  )
+)
+
diff --git a/gio/src/inetaddress.ccg b/gio/src/inetaddress.ccg
new file mode 100644
index 0000000..c146baa
--- /dev/null
+++ b/gio/src/inetaddress.ccg
@@ -0,0 +1,25 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 Jonathon Jongsma
+ *
+ * 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>
+
+namespace Gio
+{
+
+} //namespace Gio
diff --git a/gio/src/inetaddress.hg b/gio/src/inetaddress.hg
new file mode 100644
index 0000000..6ccef07
--- /dev/null
+++ b/gio/src/inetaddress.hg
@@ -0,0 +1,76 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2009 jonathon jongsma
+ *
+ * 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>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(SocketFamily, GSocketFamily)
+
+/** An IPv4/IPv6 address
+ *
+ * InetAddress represents an IPv4 or IPv6 internet address. Use
+ * Resolver::lookup_by_name() or Resolver::lookup_by_name_async() to look up
+ * the InetAddress for a hostname. Use Resolver::lookup_by_address() or
+ * Resolver::lookup_by_address_async() to look up the hostname for a
+ * InetAddress.
+ *
+ * To actually connect to a remote host, you will need a InetSocketAddress
+ * (which includes a InetAddress as well as a port number).
+ *
+ * @newin2p22
+ */
+class InetAddress
+: public Glib::Object
+{
+  _CLASS_GOBJECT(InetAddress, GInetAddress, G_INET_ADDRESS, Glib::Object, GObject)
+
+protected:
+ _WRAP_CTOR(InetAddress(const Glib::ustring& string), g_inet_address_new_from_string)
+ _WRAP_CTOR(InetAddress(const guint8 *bytes, SocketFamily family), g_inet_address_new_from_bytes)
+ _WRAP_CTOR(InetAddress(SocketFamily family), g_inet_address_new_any)
+ // TODO: new_loopback has the same signature as new_any
+
+public:
+  _WRAP_CREATE(const Glib::ustring& string)
+  _WRAP_CREATE(const guint8 *bytes, SocketFamily family)
+  _WRAP_CREATE(SocketFamily family)
+  // TODO: create for new_loopback
+
+  _WRAP_METHOD(const guint8* to_bytes() const, g_inet_address_to_bytes)
+  _WRAP_METHOD(Glib::ustring to_string() const, g_inet_address_to_string)
+  _WRAP_METHOD(SocketFamily get_family() const, g_inet_address_get_family)
+  _WRAP_METHOD(bool get_is_any() const, g_inet_address_get_is_any)
+  _WRAP_METHOD(bool get_is_link_local() const, g_inet_address_get_is_link_local)
+  _WRAP_METHOD(bool get_is_loopback() const, g_inet_address_get_is_loopback)
+  _WRAP_METHOD(bool get_is_mc_global() const, g_inet_address_get_is_mc_global)
+  _WRAP_METHOD(bool get_is_mc_link_local() const, g_inet_address_get_is_mc_link_local)
+  _WRAP_METHOD(bool get_is_mc_node_local() const, g_inet_address_get_is_mc_node_local)
+  _WRAP_METHOD(bool get_is_mc_org_local() const, g_inet_address_get_is_mc_org_local)
+  _WRAP_METHOD(bool get_is_mc_site_local() const, g_inet_address_get_is_mc_site_local)
+  _WRAP_METHOD(bool get_is_multicast() const, g_inet_address_get_is_multicast)
+  _WRAP_METHOD(bool get_is_site_local() const, g_inet_address_get_is_site_local)
+
+};
+
+} // namespace Gio
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index c886213..b7da980 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -16,6 +16,7 @@ _CONV_ENUM(G,AppInfoCreateFlags)
 _CONV_ENUM(G,DataStreamByteOrder)
 _CONV_ENUM(G,DataStreamNewlineType)
 _CONV_ENUM(G,EmblemOrigin)
+_CONV_ENUM(G,SocketFamily)
 
 
 # AppInfo



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