[glibmm/glibmm-gir-gmmproc] gmmproc: _WRAP_GERROR: Add documentation to the generated enum Code



commit b6c3acdf47844c254209e3d09b681bf4c85a8aaa
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Fri Nov 21 14:09:44 2014 +0100

    gmmproc: _WRAP_GERROR: Add documentation to the generated enum Code
    
    * tools/pm/Output.pm: output_wrap_gerror(): Get the enum documentation from
    the docs.xml file.
    * tools/m4/gerror.m4: Include the documentation before 'enum Code' in
    the generated code.
    
    _WRAP_GERROR was overlooked when José Alburquerque implemented the
    documentation of other enums (bug 544694).

 tools/m4/gerror.m4 |    7 ++++---
 tools/pm/Output.pm |   15 +++++++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4
index f18109f..a8b8437 100644
--- a/tools/m4/gerror.m4
+++ b/tools/m4/gerror.m4
@@ -1,7 +1,6 @@
-dnl $Id$
-
 dnl
-dnl  _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE])
+dnl  _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE], `<enum_docs>')
+dnl             $1             $2             $3                $4               $5           $6
 dnl
 
 m4_define(`_GERROR',`dnl
@@ -16,6 +15,8 @@ _POP()
 class __CPPNAME__ : public Glib::Error
 {
 public:
+  $6
+   */
   enum Code
   {
 $4
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 22af9ef..05e0fa1 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -759,12 +759,23 @@ sub output_wrap_gerror($$$$$$$)
   my $no_gtype = "";
   my $elements = $objEnum->build_element_list(\ flags, \$no_gtype, "    ");
 
-  my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s)dnl\n",
+  # Get the enum documentation from the parsed docs.
+  my $enum_docs =
+    DocsParser::lookup_enum_documentation("$c_enum", "Code", \ flags);
+
+  # Make sure indentation of enum documentation is correct.
+  $enum_docs =~ s/\n\s*\*/\n   \*/g;
+
+  # Prevent Doxygen from auto-linking to a class called Error.
+  $enum_docs =~ s/([^%])(Error code)/$1%$2/g;
+
+  my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s,\`%s\')dnl\n",
     $cpp_type,
     $c_enum,
     $domain,
     $elements,
-    $no_gtype
+    $no_gtype,
+    $enum_docs
   );
 
   $self->append($str);


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