From: DongHun Kwak Date: Mon, 7 Sep 2020 06:38:14 +0000 (-0700) Subject: Imported Upstream version 2.33.3 X-Git-Tag: upstream/2.33.3^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b07f1ce6c20af73b5ac685ef45ab576220f232b;p=platform%2Fupstream%2Fglibmm.git Imported Upstream version 2.33.3 --- diff --git a/.gitignore b/.gitignore index ef2bba1..28f463e 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,9 @@ giommconfig.h # examples/ /examples/child_watch/child_watch /examples/compose/example -/examples/dbus/busserver -/examples/dbus/peer -/examples/dbus/userbus +/examples/dbus/client_bus_listnames +/examples/dbus/server_without_bus +/examples/dbus/session_bus_service /examples/iochannel_stream/example /examples/keyfile/example /examples/markup/parser @@ -128,6 +128,8 @@ giommconfig.h /glib/glibmm/spawn.h /glib/glibmm/thread.cc /glib/glibmm/thread.h +/glib/glibmm/threads.cc +/glib/glibmm/threads.h /glib/glibmm/timezone.cc /glib/glibmm/timezone.h /glib/glibmm/unicode.cc diff --git a/ChangeLog b/ChangeLog index dd77723..6e05a96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +2.33.3: + +2012-07-10 Murray Cumming + + Gio::InetSocketAddress: Added get_flowinfo() and get_scope_id() + + * gio/src/inetsocketaddress.hg: And add the properties. + +2012-07-10 Murray Cumming + + Gio::OutputStream: Add write_bytes(). + + * tools/m4/convert_glib.m4: + * gio/src/outputstream.[hg|ccg]: Add write_bytes(), write_bytes_async(), + and write_bytes_finish(). + +2012-07-10 Murray Cumming + + Added Glib::Bytes and Gio::InputStream::read_bytes(). + + * glib/src/bytes.[hg|ccg]: + * glib/src/filelist.am: + * tools/m4/convert_glib.m4: Added a simple GBytes wrapper. + * gio/src/inputstream.[hg|ccg]: Added read_bytes(), read_bytes_async() + and read_bytes_finish() using the new Glib::Bytes type. + +2012-07-10 Murray Cumming + + Gio::DBus::Connection: Add get_last_serial(). + + * gio/src/dbusconnection.hg: Wrap g_dbus_connection_get_last_serial(). + +2012-07-02 Kjell Ahlstedt + + generate_wrap_init.pl: Add _INCLUDE_IN_WRAP_INIT, _GMMPROC_WRAP_CONDITIONALLY. + + * tools/generate_wrap_init.pl.in: Handle _INCLUDE_IN_WRAP_INIT and + _GMMPROC_WRAP_CONDITIONALLY. + * tools/m4/class_shared.m4: Add _INCLUDE_IN_WRAP_INIT and + _GMMPROC_WRAP_CONDITIONALLY. Bug #678883. + +2012-07-01 Kjell Ahlstedt + + Update .gitignore. + + * .gitignore: Add /glib/glibmm/threads.[h|cc]. Update /examples/dbus/*. + 2.33.2: 2012-06-19 Murray Cumming diff --git a/NEWS b/NEWS index 9db40eb..114e93f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +2.33.3 (unstable): + +Glib: +* Added the Bytes class, wrapping GBytes. + (Murray Cumming) + +Gio: +* InetSocketAddress: Added get_flowinfo() and get_scope_id() +* OutputStream: Added write_bytes(), write_bytes_async() and write_bytes_finish(). +* InputStream: Added read_bytes(), read_bytes_async() and read_bytes_finish(). + (Murray Cumming) + +Gio::DBus: +* Connection: Added get_last_serial(). + (Murray Cumming) + +gmmproc: +* Add _INCLUDE_IN_WRAP_INIT, _GMMPROC_WRAP_CONDITIONALLY. + (Kjell Ahlstedt) Bug #678883. + 2.33.2 (unstable): * Added some enum values and documentation. diff --git a/configure.ac b/configure.ac index e488e39..8db4415 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([glibmm], [2.33.2], +AC_INIT([glibmm], [2.33.3], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -60,7 +60,7 @@ AS_IF([test "x$enable_static" = xyes], AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library]) ]) -glibreq='2.0 >= 2.33.2' +glibreq='2.0 >= 2.33.3' GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq" GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq" diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg index 0789e75..8aa17c1 100644 --- a/gio/src/dbusconnection.hg +++ b/gio/src/dbusconnection.hg @@ -622,6 +622,8 @@ public: _WRAP_METHOD(Glib::RefPtr get_peer_credentials(), g_dbus_connection_get_peer_credentials, refreturn) _WRAP_METHOD(Glib::RefPtr get_peer_credentials() const, g_dbus_connection_get_peer_credentials, refreturn, constversion) + _WRAP_METHOD(guint32 get_last_serial() const, g_dbus_connection_get_last_serial) + /** Asynchronously invokes the @a method_name method on the @a * interface_name D-Bus interface on the remote object at @a object_path * owned by @a bus_name. diff --git a/gio/src/inetsocketaddress.hg b/gio/src/inetsocketaddress.hg index b357010..8b20c16 100644 --- a/gio/src/inetsocketaddress.hg +++ b/gio/src/inetsocketaddress.hg @@ -54,8 +54,13 @@ public: _WRAP_METHOD(guint16 get_port() const, g_inet_socket_address_get_port) + _WRAP_METHOD(guint32 get_flowinfo() const, g_inet_socket_address_get_flowinfo) + _WRAP_METHOD(guint32 get_scope_id() const, g_inet_socket_address_get_scope_id) + _WRAP_PROPERTY("address", Glib::RefPtr) _WRAP_PROPERTY("port", guint16) + _WRAP_PROPERTY("flowinfo", guint32) + _WRAP_PROPERTY("scope-id", guint32) }; } // namespace Gio diff --git a/gio/src/inputstream.ccg b/gio/src/inputstream.ccg index 8cdd3ff..b2eb22d 100644 --- a/gio/src/inputstream.ccg +++ b/gio/src/inputstream.ccg @@ -100,6 +100,38 @@ InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, i slot_copy); } +void +InputStream::read_bytes_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, int io_priority) +{ + // 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_input_stream_read_bytes_async(gobj(), + count, + io_priority, + Glib::unwrap(cancellable), + &SignalProxy_async_callback, + slot_copy); +} + +void +InputStream::read_bytes_async(gsize count, const SlotAsyncReady& slot, int io_priority) +{ + // 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_input_stream_read_bytes_async(gobj(), + count, + io_priority, + 0, + &SignalProxy_async_callback, + slot_copy); +} + void InputStream::skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, int io_priority) diff --git a/gio/src/inputstream.hg b/gio/src/inputstream.hg index c370fdd..89fefd4 100644 --- a/gio/src/inputstream.hg +++ b/gio/src/inputstream.hg @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -98,6 +99,25 @@ public: //TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read, const Glib::RefPtr& cancellable); //TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read) + + _WRAP_METHOD(Glib::RefPtr read_bytes(gsize count, const Glib::RefPtr& cancellable), g_input_stream_read_bytes, errthrow) + + //TODO: Documentation. + /** + * @newin{2,34} + */ + void read_bytes_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, int io_priority = Glib::PRIORITY_DEFAULT); + + /** + * @newin{2,34} + */ + void read_bytes_async(gsize count, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT); + _IGNORE(g_input_stream_read_bytes_async) + + _WRAP_METHOD(Glib::RefPtr read_bytes_finish(const Glib::RefPtr& result), g_input_stream_read_bytes_finish, errthrow) + + + _WRAP_METHOD(gssize skip(gsize count, const Glib::RefPtr& cancellable), g_input_stream_skip, errthrow) diff --git a/gio/src/outputstream.ccg b/gio/src/outputstream.ccg index 25e545c..e0c9e38 100644 --- a/gio/src/outputstream.ccg +++ b/gio/src/outputstream.ccg @@ -213,6 +213,39 @@ bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written) return retvalue; } + +void +OutputStream::write_bytes_async(const Glib::RefPtr& bytes, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, int io_priority) +{ + // 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_output_stream_write_bytes_async(gobj(), + const_cast(Glib::unwrap(bytes)), + io_priority, + Glib::unwrap(cancellable), + &SignalProxy_async_callback, + slot_copy); +} + +void +OutputStream::write_bytes_async(const Glib::RefPtr& bytes, const SlotAsyncReady& slot, int io_priority) +{ + // 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_output_stream_write_bytes_async(gobj(), + const_cast(Glib::unwrap(bytes)), + io_priority, + 0, + &SignalProxy_async_callback, + slot_copy); +} + gssize OutputStream::splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable, OutputStreamSpliceFlags flags) { GError* gerror = 0; diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg index 13cffbf..ec3c940 100644 --- a/gio/src/outputstream.hg +++ b/gio/src/outputstream.hg @@ -165,6 +165,22 @@ public: */ bool write_all(const std::string& buffer, gsize& bytes_written); + _WRAP_METHOD(gssize write_bytes(const Glib::RefPtr& bytes, const Glib::RefPtr& cancellable), g_output_stream_write_bytes, errthrow) + + //TODO: Documentation. + /** + * @newin{2,34} + */ + void write_bytes_async(const Glib::RefPtr& bytes, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, int io_priority = Glib::PRIORITY_DEFAULT); + + /** + * @newin{2,34} + */ + void write_bytes_async(const Glib::RefPtr& bytes, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT); + _IGNORE(g_output_stream_write_bytes_async) + + _WRAP_METHOD(gssize write_bytes_finish(const Glib::RefPtr& result), g_output_stream_write_bytes_finish, errthrow) + /** Splices an input stream into an output stream. * * @param source An InputStream. diff --git a/glib/src/bytes.ccg b/glib/src/bytes.ccg new file mode 100644 index 0000000..ae7270a --- /dev/null +++ b/glib/src/bytes.ccg @@ -0,0 +1,27 @@ +/* Copyright (C) 2012 The glibmm 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. + */ + +namespace Glib +{ + +Glib::RefPtr Bytes::create(gconstpointer data, gsize size) +{ + GBytes* bytes= g_bytes_new(data, size); + return Glib::wrap(bytes); +} + +} // namespace Glib diff --git a/glib/src/bytes.hg b/glib/src/bytes.hg new file mode 100644 index 0000000..424347a --- /dev/null +++ b/glib/src/bytes.hg @@ -0,0 +1,72 @@ +/* Copyright (C) 2012 The glibmm 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. + */ + +_DEFS(glibmm,glib) + +#include +#include +#include +#include +#include +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GBytes GBytes; +#endif + +namespace Glib +{ + + +//Note: The documentation is a reduced version of the C documentation, +//because this class is only really useful with other C types that we don't bother to wrap. +//We only wrap it because it is used in the InputStream API. + +/** A simple refcounted data type representing an immutable byte sequence + * from an unspecified origin. + * + * The purpose of a the Bytes class is to keep the memory region that it holds + * alive for as long as anyone holds a reference to the bytes. When + * the last reference count is dropped, the memory is released. Multiple + * unrelated callers can use byte data in the Bytes object without coordinating + * their activities, resting assured that the byte data will not change or + * move while they hold a reference. + * + * A Bytes object can come from many different origins that may have + * different procedures for freeing the memory region. Examples are + * memory from g_malloc(), from memory slices, from a GMappedFile or + * memory from other allocators. + * + * @newin{2,34} + */ +class Bytes +{ + _CLASS_OPAQUE_REFCOUNTED(Bytes, GBytes, NONE, g_bytes_ref, g_bytes_unref) + _IGNORE(g_bytes_ref, g_bytes_unref) +public: + + static Glib::RefPtr create(gconstpointer data, gsize size); + + _WRAP_METHOD(gconstpointer get_data(gsize& size) const, g_bytes_get_data) + _WRAP_METHOD(gsize get_size() const, g_bytes_get_size) + + _WRAP_METHOD(static guint hash(gconstpointer bytes), g_bytes_hash) + _WRAP_METHOD(static bool equal(gconstpointer bytes1, gconstpointer bytes2), g_bytes_equal) + _WRAP_METHOD(static gint compare(gconstpointer bytes1, gconstpointer bytes2), g_bytes_compare) +}; + +} // namespace Glib diff --git a/glib/src/filelist.am b/glib/src/filelist.am index 06c6baf..64b8b60 100644 --- a/glib/src/filelist.am +++ b/glib/src/filelist.am @@ -17,6 +17,7 @@ glibmm_files_defs = \ # Note that all of thread.hg is deprecated glibmm_files_hg = \ balancedtree.hg \ + bytes.hg \ checksum.hg \ convert.hg \ date.hg \ diff --git a/tools/generate_wrap_init.pl.in b/tools/generate_wrap_init.pl.in index fa2eea7..ccaf77d 100644 --- a/tools/generate_wrap_init.pl.in +++ b/tools/generate_wrap_init.pl.in @@ -11,8 +11,16 @@ my $parent_dir = ""; # e.g. gtkmm my $debug = 0; my %objects = (); # Hashmap of arrays of objects (classes) in each file my %exceptions = (); # Hashmap of arrays of exception classes in each file -my %win32_nowrap = (); +my %conditional_compilation = (); my %deprecated = (); +my %extra_includes = (); + +# The keys in all hashes except %extra_includes are names of header files (xyz.h), +# corresponding to the read .hg files. +# +# The keys in %extra_includes are names of header files to include without reading. +# %extra_includes is a hash rather than a list because we don't want duplicates. +# Its values are not used. In C++ it would have been a std::set. # $objects{$filename_header} is a reference to an array. That array contains # references to arrays with two or more elements, ($cppname, $basename, @extra_namespace), @@ -29,17 +37,16 @@ sub print_with_guards print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n" } - #On Win32, these files are not compiled: - if ($win32_nowrap{$file}) + if ($conditional_compilation{$file}) { - print "#ifndef G_OS_WIN32\n" + print "#$conditional_compilation{$file}\n" } print "$message"; - if ($win32_nowrap{$file}) + if ($conditional_compilation{$file}) { - print "#endif //G_OS_WIN32\n" + print "#endif // $conditional_compilation{$file}\n" } if ($deprecated{$file}) @@ -94,7 +101,7 @@ while ($ARGV[0]) # Store header filename, so we can #include it later: my $filename_header = $filename; $filename_header =~ s#.*/([^/]+)\.hg#$1.h#; - $win32_nowrap{$filename_header} = 0; + $conditional_compilation{$filename_header} = ""; $deprecated{$filename_header} = 0; # Keep track of sub-namespaces, if any. @@ -150,9 +157,27 @@ while ($ARGV[0]) push(@{$exceptions{$filename_header}}, \@names); } } + elsif (/\b_INCLUDE_IN_WRAP_INIT\((.+)\)/) + { + $extra_includes{$1} = 1; + } elsif (/\b_GTKMMPROC_WIN32_NO_WRAP\b/) { - $win32_nowrap{$filename_header} = 1; # This file will not be compiled on Win32 + # This file will not be compiled on Win32. + # No extra include is required. If G_OS_WIN32 is defined, it's defined in + # a file included indirectly by glibmm.h. + $conditional_compilation{$filename_header} = "ifndef G_OS_WIN32"; + } + elsif (/\b_GMMPROC_WRAP_CONDITIONALLY\((.+)\)/) + { + # The compilation of this file will be controlled by a preprocessor directive. + + # Allow m4 quotes in the parameter. There may be cases where the m4 processor + # would misunderstand a parameter without quotes. + my $par = $1; + $par =~ s/^\s*`*\s*//; # Remove m4 quotes and leading and trailing white space. + $par =~ s/\s*'*\s*$//; + $conditional_compilation{$filename_header} = $par; } elsif (/\b_IS_DEPRECATED\b/) { @@ -180,10 +205,15 @@ print << "EOF"; #include <${parent_dir}/wrap_init.h> #include #include - -// #include the widget headers so that we can call the get_type() static methods: EOF +foreach my $filename_header (sort keys %extra_includes) +{ + print "#include <$filename_header>\n"; +} + +print "\n// #include the widget headers so that we can call the get_type() static methods:\n"; + # keys %deprecated contains all filenames, not just the names of deprecated files. foreach my $filename_header (sort keys %deprecated) { diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4 index f91c343..c3c1f57 100644 --- a/tools/m4/class_shared.m4 +++ b/tools/m4/class_shared.m4 @@ -282,11 +282,33 @@ dnl Just process it to remove it from the generated file. dnl generate_wrap_init.pl will look for this in the original .hg file. dnl define(`_GTKMMPROC_WIN32_NO_WRAP', dnl -`//This is not available in on Win32. -//This source file will not be compiled, -//and the class will not be registered in wrap_init.h or wrap_init.cc +`//This is not available on Win32. +//This source file will not be compiled on Win32, +//and no class defined in it will be registered by wrap_init`'(). ')dnl +dnl _GMMPROC_WRAP_CONDITIONALLY(preprocessor_if/ifdef/ifndef_directive_without_#) +dnl Just process it to remove it from the generated file. +dnl generate_wrap_init.pl will look for this in the original .hg file. +dnl +dnl Example calls: +dnl _GMMPROC_WRAP_CONDITIONALLY(ifndef G_OS_WIN32) # Same as _GTKMMPROC_WIN32_NO_WRAP +dnl _GMMPROC_WRAP_CONDITIONALLY(ifdef GDK_WINDOWING_X11) +dnl _GMMPROC_WRAP_CONDITIONALLY(`if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_QUARTZ)') +dnl +define(`_GMMPROC_WRAP_CONDITIONALLY', dnl +`//This is available only #$1. +//Otherwise this source file will not be compiled, +//and no class defined in it will be registered by wrap_init`'(). +')dnl + +dnl _INCLUDE_IN_WRAP_INIT(file) +dnl Usually used in combination with _GMMPROC_WRAP_CONDITIONALLY. +dnl It does not generate any code in the .h and .cc files. +dnl generate_wrap_init.pl will look for this in the original .hg file. +dnl +define(`_INCLUDE_IN_WRAP_INIT',`')dnl + dnl _IS_DEPRECATED dnl ifdef-out the whole .h and .cc files. dnl generate_wrap_init.pl will look for this in the original .hg file. diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4 index 55de647..580ba6b 100644 --- a/tools/m4/convert_glib.m4 +++ b/tools/m4/convert_glib.m4 @@ -122,6 +122,11 @@ dnl OptionGroup _CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()') #_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)') +dnl Bytes +_CONVERSION(`GBytes*',`Glib::RefPtr',`Glib::wrap($3)') +_CONVERSION(`GBytes*',`Glib::RefPtr',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr&',`GBytes*',__CONVERT_CONST_REFPTR_TO_P_SUN(Glib::Bytes))) + dnl Regex _CONVERSION(`GRegex*',`Glib::RefPtr',`Glib::wrap($3)') _CONVERSION(`GRegex*',`Glib::RefPtr',`Glib::wrap($3)') @@ -147,5 +152,5 @@ _CONVERSION(`const Glib::VariantType&',`const GVariantType*',`($3).gobj()') _CONVERSION(`const GVariantType*',`VariantType',`Glib::wrap(const_cast($3), true)') _CONVERSION(`GVariantType*',`VariantType',`Glib::wrap(($3), true)') -dnl Misillaneous +dnl Miscellaneous _CONVERSION(`gint64&',`gint64*',`&($3)')