[glibmm] Gio::CharsetConverter: Implement the Gio::Initable interface



commit d185ed9fef75681aa9bbfc36a493f1e5f76468bb
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Jun 18 18:41:52 2017 +0200

    Gio::CharsetConverter: Implement the Gio::Initable interface
    
    and call Initable::init() from CharsetConverter's constructor.
    Bug 776537

 gio/src/charsetconverter.ccg |    1 +
 gio/src/charsetconverter.hg  |   12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gio/src/charsetconverter.ccg b/gio/src/charsetconverter.ccg
index e9d69db..2353843 100644
--- a/gio/src/charsetconverter.ccg
+++ b/gio/src/charsetconverter.ccg
@@ -24,6 +24,7 @@ CharsetConverter::CharsetConverter(
   const Glib::ustring& to_charset, const Glib::ustring& from_charset)
 : _CONSTRUCT("to-charset", to_charset.c_str(), "from-charset", from_charset.c_str())
 {
+  init();
 }
 
 } // namespace Gio
diff --git a/gio/src/charsetconverter.hg b/gio/src/charsetconverter.hg
index 0d79fbb..37a32e2 100644
--- a/gio/src/charsetconverter.hg
+++ b/gio/src/charsetconverter.hg
@@ -17,6 +17,7 @@
 
 #include <glibmm/object.h>
 #include <giomm/converter.h>
+#include <giomm/initable.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -28,14 +29,16 @@ namespace Gio
  * CharsetConverter is an implementation of Converter based on GIConv.
  * @newin{2,34}
  */
-class CharsetConverter : public Glib::Object, public Converter
+class CharsetConverter
+: public Glib::Object, public Converter, public Initable
 {
   _CLASS_GOBJECT(CharsetConverter, GCharsetConverter, G_CHARSET_CONVERTER, Glib::Object, GObject)
   _IMPLEMENTS_INTERFACE(Converter)
+  _IMPLEMENTS_INTERFACE(Initable)
 
 protected:
-  // Handwritten to ignore the final GError** parameter in the *_new()
-  // function.
+  // Handwritten to ignore the final GError** parameter in the *_new() function.
+  // But it can throw, due to its call to Initable::init().
   explicit CharsetConverter(const Glib::ustring& to_charset, const Glib::ustring& from_charset);
   _IGNORE(g_charset_converter_new)
 
@@ -46,7 +49,8 @@ public:
    *
    * @param to_charset Destination charset.
    * @param from_charset Source charset.
-   * @return A new CharsetConverter, or <tt>0</tt> on error.
+   * @return A new CharsetConverter, or <tt>nullptr</tt> on error.
+   * @throw Gio::Error
    */
   _WRAP_CREATE(const Glib::ustring& to_charset, const Glib::ustring& from_charset)
 


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