[glibmm] giomm: Add UnixSocketAddress.



commit ac35dceacb2e73282ae6e28e1367e9ef6498a3a7
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Sun Nov 7 19:30:05 2010 -0500

    	giomm: Add UnixSocketAddress.
    
    	* tools/extra_defs_gen/generate_defs_gio.cc:
    	* gio/src/gio_signals.defs: Add the GUnixSockeAddress GType to the
    	list of types for which signals and properties should be generated and
    	regenerate the signals and properties defs file.
    
    	* gio/src/filelist.am:
    	* gio/src/unixsocketaddress.{ccg,hg}: Add the UnixSocketAddress
    	sources and mention them so they are built.
    	* tools/m4/convert_gio.m4: Add a necessary enum conversion.
    
    	* gio/src/enums.hg: Wrap the Gio::ErrorEnum enum.

 ChangeLog                                 |   16 ++++++
 gio/src/enums.hg                          |    1 +
 gio/src/filelist.am                       |    5 +-
 gio/src/gio_signals.defs                  |   47 ++++++++++++++++++
 gio/src/unixsocketaddress.ccg             |   25 ++++++++++
 gio/src/unixsocketaddress.hg              |   73 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gio.cc |    4 +-
 tools/m4/convert_gio.m4                   |    1 +
 8 files changed, 169 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7ae670a..88b24de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-07  José Alburquerque  <jaalburqu svn gnome org>
+
+	giomm: Add UnixSocketAddress.
+
+	* tools/extra_defs_gen/generate_defs_gio.cc:
+	* gio/src/gio_signals.defs: Add the GUnixSockeAddress GType to the
+	list of types for which signals and properties should be generated and
+	regenerate the signals and properties defs file.
+
+	* gio/src/filelist.am:
+	* gio/src/unixsocketaddress.{ccg,hg}: Add the UnixSocketAddress
+	sources and mention them so they are built.
+	* tools/m4/convert_gio.m4: Add a necessary enum conversion.
+
+	* gio/src/enums.hg: Wrap the Gio::ErrorEnum enum.
+
 2010-11-04  José Alburquerque  <jaalburqu svn gnome org>
 
 	UnixCredentialMessage, UnixFDMessage: Wrap properties correctly.
diff --git a/gio/src/enums.hg b/gio/src/enums.hg
index 27f6039..bca0414 100644
--- a/gio/src/enums.hg
+++ b/gio/src/enums.hg
@@ -26,6 +26,7 @@ namespace Gio
 
 _WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE)
 _WRAP_ENUM(DataStreamNewlineType, GDataStreamNewlineType, NO_GTYPE)
+_WRAP_ENUM(ErrorEnum, GIOErrorEnum, NO_GTYPE)
 _WRAP_ENUM(SocketFamily, GSocketFamily)
 
 } // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 1126aac..b85a219 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -94,10 +94,11 @@ giomm_files_posix_hg =			\
 	desktopappinfo.hg		\
 	unixconnection.hg		\
 	unixcredentialsmessage.hg \
-	unixfdlist.hg \
+	unixfdlist.hg\
 	unixfdmessage.hg \
 	unixinputstream.hg		\
-	unixoutputstream.hg
+	unixoutputstream.hg \
+	unixsocketaddress.hg
 
 if HOST_WINDOWS_NATIVE
 giomm_files_arch_hg =
diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs
index 8d1ae87..60de98f 100644
--- a/gio/src/gio_signals.defs
+++ b/gio/src/gio_signals.defs
@@ -476,6 +476,53 @@
   (construct-only #f)
 )
 
+;; From GUnixSocketAddress
+
+(define-property family
+  (of-object "GUnixSocketAddress")
+  (prop-type "GParamEnum")
+  (docs "The family of the socket address")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property path
+  (of-object "GUnixSocketAddress")
+  (prop-type "GParamString")
+  (docs "UNIX socket path")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property path-as-array
+  (of-object "GUnixSocketAddress")
+  (prop-type "GParamBoxed")
+  (docs "UNIX socket path, as byte array")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property abstract
+  (of-object "GUnixSocketAddress")
+  (prop-type "GParamBoolean")
+  (docs "Whether or not this is an abstract address")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property address-type
+  (of-object "GUnixSocketAddress")
+  (prop-type "GParamEnum")
+  (docs "The type of UNIX socket address")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From GInputStream
 
 ;; From GLoadableIcon
diff --git a/gio/src/unixsocketaddress.ccg b/gio/src/unixsocketaddress.ccg
new file mode 100644
index 0000000..07d2dd8
--- /dev/null
+++ b/gio/src/unixsocketaddress.ccg
@@ -0,0 +1,25 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2010 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/gunixsocketaddress.h>
+
+namespace Gio
+{
+
+} //namespace Gio
diff --git a/gio/src/unixsocketaddress.hg b/gio/src/unixsocketaddress.hg
new file mode 100644
index 0000000..8527885
--- /dev/null
+++ b/gio/src/unixsocketaddress.hg
@@ -0,0 +1,73 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2010 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 <giomm/socketaddress.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/socketaddress_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(UnixSocketAddressType, GUnixSocketAddressType)
+
+/** UnixSocketAddress - UNIX SocketAddress.
+ * Support for UNIX-domain (also known as local) sockets.
+ *
+ * UNIX domain sockets are generally visible in the filesystem. However, some
+ * systems support abstract socket names which are not visible in the
+ * filesystem and not affected by the filesystem permissions, visibility, etc.
+ * Currently this is only supported under Linux. If you attempt to use
+ * abstract sockets on other systems, function calls may return
+ * Gio::IO_ERROR_NOT_SUPPORTED errors. You can use
+ * Gio::UnixSocketAddress::abstract_names_supported() to see if abstract names
+ * are supported.
+ *
+ * Note that @c <giomm/unixsocketaddress.h> belongs to the UNIX-specific GIO
+ * interfaces.
+ * @newin{2,28}
+ */
+class UnixSocketAddress
+: public SocketAddress
+{
+  _CLASS_GOBJECT(UnixSocketAddress, GUnixSocketAddress, G_UNIX_SOCKET_ADDRESS, SocketAddress, GSocketAddress)
+
+protected:
+ _WRAP_CTOR(UnixSocketAddress(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH), g_unix_socket_address_new_with_type)
+
+public:
+ _WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type)
+ _WRAP_CREATE(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH)
+
+ // Deprecated.
+ _IGNORE(g_unix_socket_address_get_is_abstract)
+
+ _WRAP_METHOD(UnixSocketAddressType get_address_type() const, g_unix_socket_address_get_address_type)
+ _WRAP_METHOD(std::string get_path() const, g_unix_socket_address_get_path)
+
+ //TODO?: _WRAP_METHOD(gszie get_path_len() const, g_unix_socket_address_get_path_len)
+
+ _WRAP_METHOD(static bool abstract_names_supported(), g_unix_socket_address_abstract_names_supported)
+
+ _WRAP_PROPERTY("abstract", bool)
+ _WRAP_PROPERTY("address-type", UnixSocketAddressType)
+ _WRAP_PROPERTY("path", std::string)
+};
+
+} // namespace Gio
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index 1d498ec..d9e070d 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -25,11 +25,12 @@
 #include <gio/gsettingsbackend.h>
 
 #ifndef G_OS_WIN32
+# include <gio/gunixconnection.h>
 #include <gio/gunixcredentialsmessage.h>
 # include <gio/gunixfdmessage.h>
 # include <gio/gunixinputstream.h>
 # include <gio/gunixoutputstream.h>
-# include <gio/gunixconnection.h>
+# include <gio/gunixsocketaddress.h>
 #endif
 
 int main(int, char**)
@@ -63,6 +64,7 @@ int main(int, char**)
             << get_defs(G_TYPE_UNIX_FD_MESSAGE)
             << get_defs(G_TYPE_UNIX_INPUT_STREAM)
             << get_defs(G_TYPE_UNIX_OUTPUT_STREAM)
+            << get_defs(G_TYPE_UNIX_SOCKET_ADDRESS)
 #endif
 
             << get_defs(G_TYPE_INPUT_STREAM)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index e7cff5f..8c4cb38 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -33,6 +33,7 @@ _CONV_ENUM(G,SocketFamily)
 _CONV_ENUM(G,SocketMsgFlags)
 _CONV_ENUM(G,SocketProtocol)
 _CONV_ENUM(G,SocketType)
+_CONV_ENUM(G,UnixSocketAddressType)
 
 # ActionGroup
 _CONVERSION(`const Glib::RefPtr<ActionGroup>&',`GActionGroup*',__CONVERT_REFPTR_TO_P)



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