From cdcd5f70055dcbddb75e0388f975a42f39e962e2 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 7 Sep 2020 00:12:09 -0700 Subject: [PATCH] Imported Upstream version 2.49.2 --- MSVC_Net2013/giomm.vcxproj | 4 + MSVC_Net2013/giomm.vcxproj.filters | 4 + MSVC_Net2013/glibmm-install.props | 6 + MSVC_Net2013/glibmm.vcxproj | 2 + MSVC_Net2013/glibmm.vcxproj.filters | 2 + NEWS | 28 ++ configure.ac | 2 +- gio/src/bufferedinputstream.hg | 6 +- gio/src/filterinputstream.ccg | 11 +- gio/src/filterinputstream.hg | 7 +- gio/src/filteroutputstream.ccg | 11 +- gio/src/filteroutputstream.hg | 9 +- gio/src/gio_vfuncs.defs | 503 ++++++++++++++++++++++++++++++------ gio/src/inputstream.hg | 17 +- gio/src/memoryoutputstream.ccg | 14 +- gio/src/memoryoutputstream.hg | 7 + gio/src/outputstream.hg | 22 +- gio/src/pollableinputstream.hg | 4 +- gio/src/pollableoutputstream.hg | 4 +- tools/defs_gen/h2def.py | 11 +- tools/m4/vfunc.m4 | 16 +- tools/pm/Output.pm | 4 +- tools/pm/WrapParser.pm | 21 +- 23 files changed, 594 insertions(+), 121 deletions(-) diff --git a/MSVC_Net2013/giomm.vcxproj b/MSVC_Net2013/giomm.vcxproj index 3e86d74..bc4fc3d 100644 --- a/MSVC_Net2013/giomm.vcxproj +++ b/MSVC_Net2013/giomm.vcxproj @@ -249,6 +249,8 @@ + + @@ -377,6 +379,8 @@ + + diff --git a/MSVC_Net2013/giomm.vcxproj.filters b/MSVC_Net2013/giomm.vcxproj.filters index 6a82c03..4f01b13 100644 --- a/MSVC_Net2013/giomm.vcxproj.filters +++ b/MSVC_Net2013/giomm.vcxproj.filters @@ -80,6 +80,8 @@ Source Files Source Files Source Files + Source Files + Source Files Source Files Source Files Source Files @@ -207,6 +209,8 @@ Header Files Header Files Header Files + Header Files + Header Files Header Files Header Files Header Files diff --git a/MSVC_Net2013/glibmm-install.props b/MSVC_Net2013/glibmm-install.props index f039e6b..2848409 100644 --- a/MSVC_Net2013/glibmm-install.props +++ b/MSVC_Net2013/glibmm-install.props @@ -37,6 +37,7 @@ copy ..\glib\glibmm\convert.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(Api copy ..\glib\glibmm\date.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\datetime.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\debug.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm +copy ..\glib\glibmm\enums.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\dispatcher.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\error.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\exception.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -109,6 +110,7 @@ copy ..\glib\glibmm\private\checksum_p.h $(CopyDir)\include\glibmm-$(ApiMajorVer copy ..\glib\glibmm\private\convert_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\date_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\datetime_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private +copy ..\glib\glibmm\private\enums_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\fileutils_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\interface_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\iochannel_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private @@ -200,6 +202,8 @@ copy ..\gio\giomm\init.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorV copy ..\gio\giomm\initable.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\inputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\iostream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm +copy ..\gio\giomm\listmodel.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm +copy ..\gio\giomm\liststore.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\loadableicon.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\memoryinputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\memoryoutputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm @@ -324,6 +328,8 @@ copy ..\gio\giomm\private\inetsocketaddress_p.h $(CopyDir)\include\giomm-$(ApiMa copy ..\gio\giomm\private\initable_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\inputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\iostream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private +copy ..\gio\giomm\private\listmodel_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private +copy ..\gio\giomm\private\liststore_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\loadableicon_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\memoryinputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\memoryoutputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private diff --git a/MSVC_Net2013/glibmm.vcxproj b/MSVC_Net2013/glibmm.vcxproj index 8bfeb6e..6594edc 100644 --- a/MSVC_Net2013/glibmm.vcxproj +++ b/MSVC_Net2013/glibmm.vcxproj @@ -212,6 +212,7 @@ + @@ -283,6 +284,7 @@ + diff --git a/MSVC_Net2013/glibmm.vcxproj.filters b/MSVC_Net2013/glibmm.vcxproj.filters index 7887ad2..578c253 100644 --- a/MSVC_Net2013/glibmm.vcxproj.filters +++ b/MSVC_Net2013/glibmm.vcxproj.filters @@ -29,6 +29,7 @@ Source Files Source Files Source Files + Source Files Source Files Source Files Source Files @@ -100,6 +101,7 @@ Header Files Header Files Header Files + Header Files Header Files Header Files Header Files diff --git a/NEWS b/NEWS index 0ad1608..1c98989 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,31 @@ +2.49.2: + +Gio: +* FilterInputStream: Added a constructor. + (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471 +* FilterOutputStream: + - Correct the property_base_stream() return type. + (Krzysztof Kosiński) Bug #572471 + (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471 +* InputStream: Added a constructor, is_closed(), has_pending(), + set_pending(), clear_pending() + (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471 +* OutputStream: Added a constructor, is_closed(), is_closing(), + has_pending(), set_pending(), and clear_pending(). + (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471 +* Pollable, InputStream, OutputStream: Return -1 on error in vfuncs. + (Kjell Ahlstedt) + +gmmproc: +* Make h2def.py recognize some GDK_PIXBUF macros + (Kjell Ahlstedt) +* Add optional argument err_return_value in _WRAP_VFUNC + (Kjell Ahlstedt) + +Build: +* Visual Studio build files: Update projects + (Chun-wei Fan) + 2.49.1: gmmproc: diff --git a/configure.ac b/configure.ac index f0c19c4..76cad4b 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.49.1], +AC_INIT([glibmm], [2.49.2], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) diff --git a/gio/src/bufferedinputstream.hg b/gio/src/bufferedinputstream.hg index d940f43..9661d1e 100644 --- a/gio/src/bufferedinputstream.hg +++ b/gio/src/bufferedinputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -109,9 +107,9 @@ public: _WRAP_PROPERTY("buffer-size", guint) protected: + //TODO: When we can break ABI, add vfunc. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 #m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') - //_WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr& cancellable, GError** error), "fill") - + //_WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr& cancellable), fill, errthrow, err_return_value -1) }; } // namespace Gio diff --git a/gio/src/filterinputstream.ccg b/gio/src/filterinputstream.ccg index 40517b7..f69b83d 100644 --- a/gio/src/filterinputstream.ccg +++ b/gio/src/filterinputstream.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -18,3 +16,12 @@ */ #include + +namespace Gio { + +FilterInputStream::FilterInputStream(const Glib::RefPtr& base_stream) +: _CONSTRUCT("base_stream", const_cast(Glib::unwrap(base_stream))) +{ +} + +} // namespace Gio diff --git a/gio/src/filterinputstream.hg b/gio/src/filterinputstream.hg index 6d09e4d..bd35f73 100644 --- a/gio/src/filterinputstream.hg +++ b/gio/src/filterinputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -37,6 +35,11 @@ namespace Gio class FilterInputStream : public Gio::InputStream { _CLASS_GOBJECT(FilterInputStream, GFilterInputStream, G_FILTER_INPUT_STREAM, Gio::InputStream, GInputStream) + +protected: + // This needs to be hand-coded because there is no public GFilterInputStream constructor. + explicit FilterInputStream(const Glib::RefPtr& base_stream); + public: _WRAP_METHOD(Glib::RefPtr get_base_stream(), g_filter_input_stream_get_base_stream, diff --git a/gio/src/filteroutputstream.ccg b/gio/src/filteroutputstream.ccg index 40517b7..49d0402 100644 --- a/gio/src/filteroutputstream.ccg +++ b/gio/src/filteroutputstream.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -18,3 +16,12 @@ */ #include + +namespace Gio { + +FilterOutputStream::FilterOutputStream(const Glib::RefPtr& base_stream) +: _CONSTRUCT("base_stream", const_cast(Glib::unwrap(base_stream))) +{ +} + +} // namespace Gio diff --git a/gio/src/filteroutputstream.hg b/gio/src/filteroutputstream.hg index 47b5e01..6af0821 100644 --- a/gio/src/filteroutputstream.hg +++ b/gio/src/filteroutputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -38,6 +36,11 @@ namespace Gio class FilterOutputStream : public Gio::OutputStream { _CLASS_GOBJECT(FilterOutputStream, GFilterOutputStream, G_FILTER_OUTPUT_STREAM, Gio::OutputStream, GOutputStream) + +protected: + // This needs to be hand-coded because there is no public GFilterOutputStream constructor. + explicit FilterOutputStream(const Glib::RefPtr& base_stream); + public: _WRAP_METHOD(Glib::RefPtr get_base_stream(), g_filter_output_stream_get_base_stream, @@ -50,7 +53,7 @@ public: _WRAP_METHOD(bool get_close_base_stream() const, g_filter_output_stream_get_close_base_stream) _WRAP_METHOD(void set_close_base_stream(bool close_base = true), g_filter_output_stream_set_close_base_stream) - _WRAP_PROPERTY("base-stream", Glib::RefPtr) + _WRAP_PROPERTY("base-stream", Glib::RefPtr) _WRAP_PROPERTY("close-base-stream", bool) }; diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs index 8026173..4bcfa1e 100644 --- a/gio/src/gio_vfuncs.defs +++ b/gio/src/gio_vfuncs.defs @@ -555,6 +555,134 @@ ) ) +; GFileInputStream + +(define-vfunc tell + (of-object "GFileInputStream") + (return-type "goffset") +) + +(define-vfunc can_seek + (of-object "GFileInputStream") + (return-type "gboolean") +) + +(define-vfunc seek + (of-object "GFileInputStream") + (return-type "gboolean") + (parameters + '("goffset" "offset") + '("GSeekType" "type") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc query_info + (of-object "GFileInputStream") + (return-type "GFileInfo*") + (parameters + '("const-char*" "attributes") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc query_info_async + (of-object "GFileInputStream") + (return-type "void") + (parameters + '("const-char*" "attributes") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc query_info_finish + (of-object "GFileInputStream") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +; GFileOutputStream + +(define-vfunc tell + (of-object "GFileOutputStream") + (return-type "goffset") +) + +(define-vfunc can_seek + (of-object "GFileOutputStream") + (return-type "gboolean") +) + +(define-vfunc seek + (of-object "GFileOutputStream") + (return-type "gboolean") + (parameters + '("goffset" "offset") + '("GSeekType" "type") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc can_truncate + (of-object "GFileOutputStream") + (return-type "gboolean") +) + +(define-vfunc truncate_fn + (of-object "GFileOutputStream") + (return-type "gboolean") + (parameters + '("goffset" "offset") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc query_info + (of-object "GFileOutputStream") + (return-type "GFileInfo*") + (parameters + '("const-char*" "attributes") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc query_info_async + (of-object "GFileOutputStream") + (return-type "void") + (parameters + '("const-char*" "attributes") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc query_info_finish + (of-object "GFileOutputStream") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc get_etag + (of-object "GFileOutputStream") + (return-type "char*") +) + ; GIcon (define-vfunc hash @@ -573,6 +701,121 @@ ) ) +; GInputStream + +(define-vfunc read_fn + (of-object "GInputStream") + (return-type "gssize") + (parameters + '("void*" "buffer") + '("gsize" "count") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc skip + (of-object "GInputStream") + (return-type "gssize") + (parameters + '("gsize" "count") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc close_fn + (of-object "GInputStream") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc read_async + (of-object "GInputStream") + (return-type "void") + (parameters + '("void*" "buffer") + '("gsize" "count") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc read_finish + (of-object "GInputStream") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc skip_async + (of-object "GInputStream") + (return-type "void") + (parameters + '("gsize" "count") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc skip_finish + (of-object "GInputStream") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc close_async + (of-object "GInputStream") + (return-type "void") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc close_finish + (of-object "GInputStream") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +; GListModel + +(define-vfunc get_item_type + (of-object "GListModel") + (return-type "GType") +) + +(define-vfunc get_n_items + (of-object "GListModel") + (return-type "guint") +) + +(define-vfunc get_item + (of-object "GListModel") + (return-type "gpointer") + (parameters + '("guint" "position") + ) +) + ; GLoadableIcon (define-vfunc load @@ -607,6 +850,190 @@ ) ) +; GOutputStream + +(define-vfunc write_fn + (of-object "GOutputStream") + (return-type "gssize") + (parameters + '("const-void*" "buffer") + '("gsize" "count") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc splice + (of-object "GOutputStream") + (return-type "gssize") + (parameters + '("GInputStream*" "source") + '("GOutputStreamSpliceFlags" "flags") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc flush + (of-object "GOutputStream") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc close_fn + (of-object "GOutputStream") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc write_async + (of-object "GOutputStream") + (return-type "void") + (parameters + '("const-void*" "buffer") + '("gsize" "count") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc write_finish + (of-object "GOutputStream") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc splice_async + (of-object "GOutputStream") + (return-type "void") + (parameters + '("GInputStream*" "source") + '("GOutputStreamSpliceFlags" "flags") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc splice_finish + (of-object "GOutputStream") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc flush_async + (of-object "GOutputStream") + (return-type "void") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc flush_finish + (of-object "GOutputStream") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc close_async + (of-object "GOutputStream") + (return-type "void") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc close_finish + (of-object "GOutputStream") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +; GPermission + +(define-vfunc acquire + (of-object "GPermission") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc acquire_async + (of-object "GPermission") + (return-type "void") + (parameters + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc acquire_finish + (of-object "GPermission") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-vfunc release + (of-object "GPermission") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-vfunc release_async + (of-object "GPermission") + (return-type "void") + (parameters + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-vfunc release_finish + (of-object "GPermission") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + ; GPollableInputStream (define-vfunc can_poll @@ -1127,79 +1554,3 @@ ) ) -; GPermission - -(define-vfunc acquire - (of-object "GPermission") - (return-type "gboolean") - (parameters - '("GCancellable*" "cancellable") - '("GError**" "error") - ) -) - -(define-vfunc acquire_async - (of-object "GPermission") - (return-type "void") - (parameters - '("GCancellable*" "cancellable") - '("GAsyncReadyCallback" "callback") - '("gpointer" "user_data") - ) -) - -(define-vfunc acquire_finish - (of-object "GPermission") - (return-type "gboolean") - (parameters - '("GAsyncResult*" "result") - '("GError**" "error") - ) -) - -(define-vfunc release - (of-object "GPermission") - (return-type "gboolean") - (parameters - '("GCancellable*" "cancellable") - '("GError**" "error") - ) -) - -(define-vfunc release_async - (of-object "GPermission") - (return-type "void") - (parameters - '("GCancellable*" "cancellable") - '("GAsyncReadyCallback" "callback") - '("gpointer" "user_data") - ) -) - -(define-vfunc release_finish - (of-object "GPermission") - (return-type "gboolean") - (parameters - '("GAsyncResult*" "result") - '("GError**" "error") - ) -) - -; GListModel -(define-vfunc get_item_type - (of-object "GListModel") - (return-type "GType") -) - -(define-vfunc get_n_items - (of-object "GListModel") - (return-type "guint") -) - -(define-vfunc get_item - (of-object "GListModel") - (return-type "gpointer") - (parameters - '("guint" "position") - ) -) diff --git a/gio/src/inputstream.hg b/gio/src/inputstream.hg index 745c11d..b98da27 100644 --- a/gio/src/inputstream.hg +++ b/gio/src/inputstream.hg @@ -40,6 +40,9 @@ class InputStream : public Glib::Object { _CLASS_GOBJECT(InputStream, GInputStream, G_INPUT_STREAM, Glib::Object, GObject) +protected: + _CTOR_DEFAULT + public: _WRAP_METHOD(gssize read(void* buffer, gsize count, const Glib::RefPtr& cancellable{?}), g_input_stream_read, @@ -380,8 +383,18 @@ public: g_input_stream_close_finish, errthrow) - // These are private inside the module (for implementations) - _IGNORE(g_input_stream_has_pending, g_input_stream_is_closed, g_input_stream_set_pending, g_input_stream_clear_pending) + _WRAP_METHOD(bool is_closed() const, g_input_stream_is_closed, newin "2,50") + _WRAP_METHOD(bool has_pending() const, g_input_stream_has_pending, newin "2,50") + +protected: + _WRAP_METHOD(bool set_pending(), g_input_stream_set_pending, errthrow, newin "2,50") + _WRAP_METHOD(void clear_pending(), g_input_stream_clear_pending, newin "2,50") + + //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 +#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') + //_WRAP_VFUNC(gssize read(void* buffer, gsize count, const Glib::RefPtr& cancellable), read_fn, errthrow, err_return_value -1) + //_WRAP_VFUNC(gssize skip(gsize count, const Glib::RefPtr& cancellable), skip, errthrow, err_return_value -1) + //_WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) }; } // namespace Gio diff --git a/gio/src/memoryoutputstream.ccg b/gio/src/memoryoutputstream.ccg index 028f74e..45f52e0 100644 --- a/gio/src/memoryoutputstream.ccg +++ b/gio/src/memoryoutputstream.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -19,3 +17,15 @@ #include #include + +namespace Gio +{ + +// Equivalent to g_memory_output_stream_new_resizable(). +MemoryOutputStream::MemoryOutputStream() +: _CONSTRUCT("data", nullptr, "size", 0, "realloc-function", g_realloc, + "destroy-function", g_free) +{ +} + +} // namespace Gio diff --git a/gio/src/memoryoutputstream.hg b/gio/src/memoryoutputstream.hg index 8f08c03..4b1048b 100644 --- a/gio/src/memoryoutputstream.hg +++ b/gio/src/memoryoutputstream.hg @@ -49,11 +49,18 @@ class MemoryOutputStream : { _CLASS_GOBJECT(MemoryOutputStream, GMemoryOutputStream, G_MEMORY_OUTPUT_STREAM, Gio::OutputStream, GOutputStream) _IMPLEMENTS_INTERFACE(Seekable) + protected: + // Hand-coded because it's equivalent to g_memory_output_stream_new_resizable(), + // which sets some properties to non-default values. + /** Creates a resizable stream. + */ + MemoryOutputStream(); // TODO: more C++-like interface using sigc++ _WRAP_CTOR(MemoryOutputStream(void* data, gsize size, GReallocFunc realloc_function, GDestroyNotify destroy_function), g_memory_output_stream_new) public: + _WRAP_CREATE() // TODO: more C++-like interface using sigc++ _WRAP_CREATE(void* data, gsize size, GReallocFunc realloc_function, GDestroyNotify destroy_function) diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg index afbf1e8..d1e3f41 100644 --- a/gio/src/outputstream.hg +++ b/gio/src/outputstream.hg @@ -22,6 +22,7 @@ _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) +_PINCLUDE(gio/gio.h) // for GOutputStreamSpliceFlags namespace Gio { @@ -38,6 +39,9 @@ class OutputStream : public Glib::Object { _CLASS_GOBJECT(OutputStream, GOutputStream, G_OUTPUT_STREAM, Glib::Object, GObject) +protected: + _CTOR_DEFAULT + public: _WRAP_METHOD(gssize write(const void* buffer, gsize count, const Glib::RefPtr& cancellable{?}), @@ -491,9 +495,21 @@ public: g_output_stream_close_finish, errthrow) - // These are private inside the module (for implementations) - _IGNORE(g_output_stream_has_pending, g_output_stream_is_closed, g_output_stream_is_closing, g_output_stream_set_pending, g_output_stream_clear_pending) - + _WRAP_METHOD(bool is_closed() const, g_output_stream_is_closed, newin "2,50") + _WRAP_METHOD(bool is_closing() const, g_output_stream_is_closing, newin "2,50") + _WRAP_METHOD(bool has_pending() const, g_output_stream_has_pending, newin "2,50") + +protected: + _WRAP_METHOD(bool set_pending(), g_output_stream_set_pending, errthrow, newin "2,50") + _WRAP_METHOD(void clear_pending(), g_output_stream_clear_pending, newin "2,50") + + //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 +#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') +#m4 _CONVERSION(`GInputStream*', `const Glib::RefPtr&', `Glib::wrap($3, true)') + //_WRAP_VFUNC(gssize write(const void* buffer, gsize count, const Glib::RefPtr& cancellable), write_fn, errthrow, err_return_value -1) + //_WRAP_VFUNC(gssize splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable{.}, OutputStreamSpliceFlags flags{.}), splice, errthrow, err_return_value -1) + //_WRAP_VFUNC(bool flush(const Glib::RefPtr& cancellable), flush, errthrow) + //_WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) }; } // namespace Gio diff --git a/gio/src/pollableinputstream.hg b/gio/src/pollableinputstream.hg index ce4af17..b1c3178 100644 --- a/gio/src/pollableinputstream.hg +++ b/gio/src/pollableinputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -59,7 +57,7 @@ public: //TODO: _WRAP_VFUNC(Glib::RefPtr create_source(const Glib::RefPtr& cancellable), "create_source") - _WRAP_VFUNC(gssize read_nonblocking(void* buffer, gsize count), "read_nonblocking", errthrow) + _WRAP_VFUNC(gssize read_nonblocking(void* buffer, gsize count), "read_nonblocking", errthrow, err_return_value -1) }; } // namespace Gio diff --git a/gio/src/pollableoutputstream.hg b/gio/src/pollableoutputstream.hg index c6807c5..c735fc6 100644 --- a/gio/src/pollableoutputstream.hg +++ b/gio/src/pollableoutputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -60,7 +58,7 @@ public: //TODO:_WRAP_VFUNC(Glib::RefPtr create_source(const Glib::RefPtr& cancellable), "create_source") - _WRAP_VFUNC(gssize write_nonblocking(const void* buffer, gsize count), "write_nonblocking", errthrow) + _WRAP_VFUNC(gssize write_nonblocking(const void* buffer, gsize count), "write_nonblocking", errthrow, err_return_value -1) }; } // namespace Gio diff --git a/tools/defs_gen/h2def.py b/tools/defs_gen/h2def.py index 20b3185..1c0a79b 100755 --- a/tools/defs_gen/h2def.py +++ b/tools/defs_gen/h2def.py @@ -306,20 +306,21 @@ def clean_func(buf): pat = re.compile(r"""G_GNUC_WARN_UNUSED_RESULT|G_INLINE_FUNC""", re.MULTILINE) buf = pat.sub('', buf) - #strip *_DEPRECATED_IN_*_FOR (*): - pat = re.compile(r"""[A-Z]+_DEPRECATED_IN_[0-9]_([0-9]*)_FOR\s*\(.*\)\S*""", re.MULTILINE) + #strip *_DEPRECATED_IN_*_FOR (*) + #e.g. GDK_DEPRECATED_IN_*_FOR (*) and GDK_PIXBUF_DEPRECATED_IN_*_FOR (*) + pat = re.compile(r"""([A-Z]+_){1,2}?DEPRECATED_IN_[0-9]_([0-9]*)_FOR\s*\(.*\)\S*""", re.MULTILINE) buf = pat.sub('', buf) #strip *_DEPRECATED* - pat = re.compile(r"""[A-Z]+_DEPRECATED\S*""", re.MULTILINE) + pat = re.compile(r"""([A-Z]+_){1,2}?DEPRECATED\S*""", re.MULTILINE) buf = pat.sub('', buf) #strip *_AVAILABLE_IN_* - pat = re.compile(r"""[A-Z]+_AVAILABLE_IN_[0-9]_[0-9]\S*""", re.MULTILINE) + pat = re.compile(r"""([A-Z]+_){1,2}?AVAILABLE_IN_[0-9]_[0-9]\S*""", re.MULTILINE) buf = pat.sub('', buf) #strip *_AVAILABLE_IN_ALL - pat = re.compile(r"""[A-Z]+_AVAILABLE_IN_ALL\S*""", re.MULTILINE) + pat = re.compile(r"""([A-Z]+_){1,2}?AVAILABLE_IN_ALL\S*""", re.MULTILINE) buf = pat.sub('', buf) #strip G_DECLARE_FINAL_TYPE (*) diff --git a/tools/m4/vfunc.m4 b/tools/m4/vfunc.m4 index 5b6f114..e1609a9 100644 --- a/tools/m4/vfunc.m4 +++ b/tools/m4/vfunc.m4 @@ -24,8 +24,8 @@ dnl $5 $6 $7 $8 dnl `',`',`',firstarg, dnl $9 $10 $11 $12 dnl refreturn_ctype, keep_return, ifdef, errthrow, -dnl $13 $14 $15 $16 -dnl slot_type, c_data_param_name, return_value, exception_handler) +dnl $13 $14 $15 $16 $17 +dnl slot_type, c_data_param_name, return_value, err_return_value, exception_handler) dnl dnl Note: _get_current_wrapper_inline() could be used throughout for performance instead of _get_current_wrapper(), dnl and is_derived_() instead of is_derived_(), @@ -89,15 +89,15 @@ ifelse($10,keep_return,`dnl ')dnl end refreturn_ctype ')dnl end void } -ifelse($16,,,`dnl if (exception_handler) +ifelse($17,,,`dnl if (exception_handler) catch(...) { try { ifelse($9,refreturn_ctype,`dnl - return Glib::unwrap_copy`'(obj->$16`'()); + return Glib::unwrap_copy`'(obj->$17`'()); ', `dnl - return _CONVERT($3, $4, `obj->$16`'()'); + return _CONVERT($3, $4, `obj->$17`'()'); ')dnl } ')dnl end exception_handler @@ -108,11 +108,11 @@ ifelse($12,errthrow,`dnl ifelse($4,void,`dnl return; ',`dnl -ifelse(`$15', `',`dnl +ifelse(`$16', `',`dnl using RType = $4; return RType`'(); ',`dnl - return _CONVERT($3,$4,`$15'); + return _CONVERT($3,$4,`$16'); ')dnl ')dnl } @@ -121,7 +121,7 @@ ifelse(`$15', `',`dnl { Glib::exception_handlers_invoke`'(); } -ifelse($16,,,`dnl if (exception_handler) +ifelse($17,,,`dnl if (exception_handler) } ')dnl } diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm index 6af2775..b920791 100644 --- a/tools/pm/Output.pm +++ b/tools/pm/Output.pm @@ -240,9 +240,10 @@ sub output_wrap_vfunc_cc($$$$$$$$) convert_args_c_to_cpp($objCFunc, $objCppfunc, $line_num); my $returnValue = $$objCppfunc{return_value}; + my $errReturnValue = $$objCppfunc{err_return_value}; my $exceptionHandler = $$objCppfunc{exception_handler}; - my $str = sprintf("_VFUNC_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s,%s,%s)dnl\n", + my $str = sprintf("_VFUNC_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)dnl\n", $$objCppfunc{name}, $cname, $$objCppfunc{rettype}, @@ -258,6 +259,7 @@ sub output_wrap_vfunc_cc($$$$$$$$) $$objCppfunc{slot_type}, $$objCppfunc{c_data_param_name}, $returnValue, + $errReturnValue, $exceptionHandler); $self->append($str); diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm index 9a03e73..3f71ece 100644 --- a/tools/pm/WrapParser.pm +++ b/tools/pm/WrapParser.pm @@ -1325,6 +1325,7 @@ sub on_wrap_vfunc($) my $keep_return = 0; my $refreturn_ctype = 0; my $returnValue = ""; + my $errReturnValue = ""; my $exceptionHandler = ""; my $custom_vfunc = 0; my $custom_vfunc_callback = 0; @@ -1360,6 +1361,14 @@ sub on_wrap_vfunc($) { $returnValue = $1; } + # Return value, if the C++ vfunc throws an exception which is propagated + # to the C callback. + # (Default is the default value of the return type or, if return_value + # is specified, the return_value.) + elsif($argRef =~ /^err_return_value\s+(.*)/) + { + $errReturnValue = $1; + } # If exception handler is not defined, then Glib::exception_handlers_invoke # method will be used for exception handling. elsif($argRef =~ /^exception_handler\s+(.*)/) @@ -1402,11 +1411,13 @@ sub on_wrap_vfunc($) $no_slot_copy = 1; } } + $errReturnValue = $returnValue if ($returnValue ne "" and $errReturnValue eq ""); $self->output_wrap_vfunc($argCppDecl, $argCName, $$self{filename}, $$self{line_num}, $refreturn, $keep_return, $refreturn_ctype, $custom_vfunc, $custom_vfunc_callback, $ifdef, $errthrow, - $slot_name, $slot_callback, $no_slot_copy, $returnValue, $exceptionHandler); + $slot_name, $slot_callback, $no_slot_copy, + $returnValue, $errReturnValue, $exceptionHandler); } # Common part of _WRAP_ENUM(), _WRAP_ENUM_DOCS_ONLY() and _WRAP_GERROR(). @@ -1689,12 +1700,13 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$) # void output_wrap_vfunc($CppDecl, $vfunc_name, $filename, $line_num, # $refreturn, $keep_return, $refreturn_ctype, # $custom_vfunc, $custom_vfunc_callback, $ifdef, $errthrow, -# $slot_name, $slot_callback, $no_slot_copy, $returnValue, $exceptionHandler) -sub output_wrap_vfunc($$$$$$$$$$$$$$$$$) +# $slot_name, $slot_callback, $no_slot_copy, $returnValue, +# $errReturnValue, $exceptionHandler) +sub output_wrap_vfunc($$$$$$$$$$$$$$$$$$) { my ($self, $CppDecl, $vfunc_name, $filename, $line_num, $refreturn, $keep_return, $refreturn_ctype, $custom_vfunc, $custom_vfunc_callback, $ifdef, $errthrow, - $slot_name, $slot_callback, $no_slot_copy, $returnValue, $exceptionHandler) = @_; + $slot_name, $slot_callback, $no_slot_copy, $returnValue, $errReturnValue, $exceptionHandler) = @_; #Some checks: return if ($self->output_wrap_check($CppDecl, $vfunc_name, $filename, $line_num, '_WRAP_VFUNC')); @@ -1727,6 +1739,7 @@ sub output_wrap_vfunc($$$$$$$$$$$$$$$$$) $$objCppVfunc{rettype_needs_ref} = $refreturn; $$objCppVfunc{keep_return} = $keep_return; $$objCppVfunc{return_value} = $returnValue; + $$objCppVfunc{err_return_value} = $errReturnValue; $$objCppVfunc{exception_handler} = $exceptionHandler; $$objCppVfunc{name} .= "_vfunc"; #All vfuncs should have the "_vfunc" suffix, and a separate easily-named invoker method. -- 2.7.4