diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-06-18 23:33:23 -0500 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-06-18 23:33:23 -0500 |
commit | 16f8af82f30627ced4c528e2eaad4549f54d660c (patch) | |
tree | 77f66ee474f334354d3a4afa485dc899c39e8a44 | |
parent | 95f91e418920359af8eb1c5189d81eabc1bdae83 (diff) | |
download | glibmm-16f8af82f30627ced4c528e2eaad4549f54d660c.tar.gz |
add InetSocketAddress class
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | gio/src/Makefile_list_of_hg.am_fragment | 2 | ||||
-rw-r--r-- | gio/src/gio_signals.defs | 178 | ||||
-rw-r--r-- | gio/src/inetsocketaddress.ccg | 25 | ||||
-rw-r--r-- | gio/src/inetsocketaddress.hg | 60 | ||||
-rw-r--r-- | tools/extra_defs_gen/generate_defs_gio.cc | 8 | ||||
-rw-r--r-- | tools/m4/convert_gio.m4 | 1 |
8 files changed, 287 insertions, 1 deletions
@@ -112,6 +112,8 @@ gio/giomm/icon.cc gio/giomm/icon.h gio/giomm/inetaddress.cc gio/giomm/inetaddress.h +gio/giomm/inetsocketaddress.cc +gio/giomm/inetsocketaddress.h gio/giomm/inputstream.cc gio/giomm/inputstream.h gio/giomm/iostream.cc @@ -1,5 +1,17 @@ 2009-06-18 Jonathon Jongsma <jonathon@quotidian.org> + * .gitignore: + * gio/src/Makefile_list_of_hg.am_fragment: + * gio/src/gio_signals.defs: re-generate with signals and properties + for some of the new network IO classes + * gio/src/inetsocketaddress.ccg: + * gio/src/inetsocketaddress.hg: Added InetSocketAddress class + * tools/extra_defs_gen/generate_defs_gio.cc: added some new network + IO classes + * tools/m4/convert_gio.m4: + +2009-06-18 Jonathon Jongsma <jonathon@quotidian.org> + split SocketAddressEnumerator into its own file * .gitignore: diff --git a/gio/src/Makefile_list_of_hg.am_fragment b/gio/src/Makefile_list_of_hg.am_fragment index 5575d35e..12a315af 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 inetaddress.hg inputstream.hg iostream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \ + icon.hg inetaddress.hg inetsocketaddress.hg inputstream.hg iostream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \ resolver.hg seekable.hg socketaddress.hg socketaddressenumerator.hg socketconnectable.hg srvtarget.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_signals.defs b/gio/src/gio_signals.defs index 8bc4cfa5..2290bbd9 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -171,6 +171,12 @@ (when "last") ) +(define-signal stop-button + (of-object "GDrive") + (return-type "void") + (when "last") +) + ;; From GFile ;; From GFileEnumerator @@ -342,6 +348,12 @@ (when "last") ) +(define-signal pre-unmount + (of-object "GMount") + (return-type "void") + (when "last") +) + ;; From GMountOperation (define-signal ask-password @@ -587,4 +599,170 @@ ) ) +(define-signal drive-stop-button + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GDrive*" "p0") + ) +) + +;; From GInetAddress + +(define-property family + (of-object "GInetAddress") + (prop-type "GParamEnum") + (docs "The address family (IPv4 or IPv6)") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property bytes + (of-object "GInetAddress") + (prop-type "GParamPointer") + (docs "The raw address data") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property is-any + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is the 'any' address for its family") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-loopback + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is the loopback address for its family") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-link-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a link-local address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-site-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a site-local address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-multicast + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-mc-global + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a global multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-mc-link-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a link-local multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-mc-node-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a node-local multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-mc-org-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is an organization-local multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property is-mc-site-local + (of-object "GInetAddress") + (prop-type "GParamBoolean") + (docs "Whether this is a site-local multicast address") + (readable #t) + (writable #f) + (construct-only #f) +) + +;; From GInetSocketAddress + +(define-property family + (of-object "GInetSocketAddress") + (prop-type "GParamEnum") + (docs "The family of the socket address") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property address + (of-object "GInetSocketAddress") + (prop-type "GParamObject") + (docs "The address") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property port + (of-object "GInetSocketAddress") + (prop-type "GParamUInt") + (docs "The port") + (readable #t) + (writable #t) + (construct-only #t) +) + +;; From GSocketAddress + +(define-property family + (of-object "GSocketAddress") + (prop-type "GParamEnum") + (docs "The family of the socket address") + (readable #t) + (writable #f) + (construct-only #f) +) + +;; From GSocketAddressEnumerator + +;; From GSocketConnectable + +;; Warning: g_object_interface_list_properties() returned NULL for GSocketConnectable +;; From GSrvTarget + diff --git a/gio/src/inetsocketaddress.ccg b/gio/src/inetsocketaddress.ccg new file mode 100644 index 00000000..c146baae --- /dev/null +++ b/gio/src/inetsocketaddress.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/inetsocketaddress.hg b/gio/src/inetsocketaddress.hg new file mode 100644 index 00000000..a29299e4 --- /dev/null +++ b/gio/src/inetsocketaddress.hg @@ -0,0 +1,60 @@ +// -*- 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 <giomm/socketaddress.h> +#include <giomm/inetaddress.h> +#include <giomm/enums.h> + +_DEFS(giomm,gio) +_PINCLUDE(giomm/private/socketaddress_p.h) + +namespace Gio +{ + +/** Internet SocketAddress + * + * An IPv4 or IPv6 socket address; that is, the combination of a + * #GInetAddress and a port number. + * + * An IPv4 or IPv6 socket address, corresponding to a struct sockaddr_in or + * struct sockaddr_in6. + * + * @newin2p22 + */ +class InetSocketAddress +: public SocketAddress +{ + _CLASS_GOBJECT(InetSocketAddress, GInetSocketAddress, G_INET_SOCKET_ADDRESS, SocketAddress, GSocketAddress) + +protected: + _WRAP_CTOR(InetSocketAddress(const Glib::RefPtr<InetAddress>& address, guint16 port), g_inet_socket_address_new) + +public: + _WRAP_CREATE(const Glib::RefPtr<InetAddress>& address, guint16 port) + + _WRAP_METHOD(Glib::RefPtr<InetAddress> get_address(), g_inet_socket_address_get_address) + _WRAP_METHOD(Glib::RefPtr<const InetAddress> get_address() const, g_inet_socket_address_get_address, constversion) + + _WRAP_METHOD(guint16 get_port() const, g_inet_socket_address_get_port) + + _WRAP_PROPERTY("address", Glib::RefPtr<InetAddress>) + _WRAP_PROPERTY("port", guint16) +}; + +} // namespace Gio diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc index ea4e4bcb..4a8d9534 100644 --- a/tools/extra_defs_gen/generate_defs_gio.cc +++ b/tools/extra_defs_gen/generate_defs_gio.cc @@ -71,6 +71,14 @@ int main (int argc, char** argv) << get_defs(G_TYPE_VOLUME_MONITOR) + // network IO classes + << get_defs(G_TYPE_INET_ADDRESS) + << get_defs(G_TYPE_INET_SOCKET_ADDRESS) + << get_defs(G_TYPE_SOCKET_ADDRESS) + << get_defs(G_TYPE_SOCKET_ADDRESS_ENUMERATOR) + << get_defs(G_TYPE_SOCKET_CONNECTABLE) + << get_defs(G_TYPE_SRV_TARGET) + << std::endl; return 0; diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4 index 67387555..ab0bdc43 100644 --- a/tools/m4/convert_gio.m4 +++ b/tools/m4/convert_gio.m4 @@ -92,6 +92,7 @@ _CONVERSION(`const Glib::RefPtr<Emblem>&',`GEmblem*',__CONVERT_CONST_REFPTR_TO_P # InetAddress _CONVERSION(`const Glib::RefPtr<InetAddress>&',`GInetAddress*',__CONVERT_CONST_REFPTR_TO_P) +_CONVERSION(`GInetAddress*',`Glib::RefPtr<InetAddress>',`Glib::wrap($3)') # InputStream _CONVERSION(`const Glib::RefPtr<InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P) |