[glibmm] gmmproc: Add 'deprecated' option in _WRAP_ENUM and _WRAP_GERROR



commit c6f84f00990e9f0234fe216dd384e2fd41da16fd
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Sun Apr 3 19:15:07 2016 +0200

    gmmproc: Add 'deprecated' option in _WRAP_ENUM and _WRAP_GERROR
    
    * tools/m4/enum.m4:
    * tools/m4/gerror.m4: Surround code and documentation by #ifndef
    xxx_DISABLE_DEPRECATED, if it's deprecated.
    * tools/pm/DocsParser.pm: lookup_enum_documentation(): Move the parsing of
    options to WrapParser. Add deprecation docs, if any.
    * tools/pm/Enum.pm: build_element_list(): Move the parsing of options to
    WrapParser.
    * tools/pm/Output.pm: output_wrap_enum(), output_wrap_enum_docs_only(),
    output_wrap_gerror(): Handle deprecation docs.
    * tools/pm/WrapParser.pm: Parse options in the new on_wrap_any_enum() function.

 tools/m4/enum.m4       |   10 +++-
 tools/m4/gerror.m4     |   20 ++++++---
 tools/pm/DocsParser.pm |   36 ++++++----------
 tools/pm/Enum.pm       |   35 ++--------------
 tools/pm/Output.pm     |   86 +++++++++++++++++++++++++++------------
 tools/pm/WrapParser.pm |  105 +++++++++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 116 deletions(-)
---
diff --git a/tools/m4/enum.m4 b/tools/m4/enum.m4
index dc98892..9064e35 100644
--- a/tools/m4/enum.m4
+++ b/tools/m4/enum.m4
@@ -1,5 +1,5 @@
 dnl
-dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `flags', `optional_refdoc_comment', 
'get_type_function_name')
+dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `no_gtype', `optional_refdoc_comment', 
'deprecated')
 dnl          $1       $2         $3             $4           $5              $6                        $7
 dnl
 m4_define(`_ENUM',`dnl
@@ -20,6 +20,7 @@ m4_define(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__')dnl
 ')dnl endif
 dnl
 dnl
+ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
 /** $6
  *
  * @ingroup __MODULE_CANONICAL__`'Enums
@@ -68,33 +69,36 @@ inline __ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
 inline __ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
   { return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
 ')dnl endif Flags
+ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
 
 m4_ifelse($5,`NO_GTYPE',,`dnl else
 __NAMESPACE_END__
 
-
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 namespace Glib
 {
 
+ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl
 template <>
 class Value<__NAMESPACE__::__ENUM_CPPNAME__> : public __ENUM_VALUE_BASE__
 {
 public:
   static GType value_type() G_GNUC_CONST;
 };
+ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl
 
 } // namespace Glib
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
-
 __NAMESPACE_BEGIN__
 _PUSH(SECTION_SRC_GENERATED)
+ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl
 // static
 GType Glib::Value<__NAMESPACE__::__ENUM_CPPNAME__>::value_type()
 {
   return _GET_TYPE_FUNC(__ENUM_CNAME__);
 }
+ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl
 
 _POP()
 ')dnl endif !NO_GTYPE
diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4
index e48aef6..f7515bb 100644
--- a/tools/m4/gerror.m4
+++ b/tools/m4/gerror.m4
@@ -1,6 +1,6 @@
 dnl
-dnl  _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE], `<enum_docs>')
-dnl             $1             $2             $3                $4               $5           $6
+dnl _GERROR(cpp_type, c_type, domain, `element_list', `no_gtype', `class_docs', `enum_docs', 'deprecated')
+dnl            $1       $2      $3         $4             $5           $6           $7            $8
 dnl
 
 m4_define(`_GERROR',`dnl
@@ -12,10 +12,15 @@ m4_define(`__CNAME__',`$2')
 m4_define(`__CQUARK__',`$3')
 m4_define(`__VALUE_BASE__',`Glib::Value_Enum<__NAMESPACE__::__CPPNAME__::Code>')
 _POP()
+ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
+ifelse(`$6',,,`dnl
+/** $6
+ */
+')dnl
 class __CPPNAME__ : public Glib::Error
 {
 public:
-  /** $6
+  /** $7
    */
   enum Code
   {
@@ -36,6 +41,7 @@ private:
   _IMPORT(SECTION_H_GERROR_PRIVATE)
 #endif //DOXYGEN_SHOULD_SKIP_THIS
 };
+ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
 
 m4_ifelse($5,`NO_GTYPE',,`dnl else
 __NAMESPACE_END__
@@ -44,21 +50,23 @@ __NAMESPACE_END__
 namespace Glib
 {
 
+ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl
 template <>
 class Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__
 {
 public:
   static GType value_type() G_GNUC_CONST;
 };
+ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl
 
 } // namespace Glib
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
-
 __NAMESPACE_BEGIN__
 ')dnl endif !NO_GTYPE
 _PUSH(SECTION_SRC_GENERATED)
 
+ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl
 __NAMESPACE__::__CPPNAME__::__CPPNAME__`'(__NAMESPACE__::__CPPNAME__::Code error_code, const Glib::ustring& 
error_message)
 :
   Glib::Error (__CQUARK__, error_code, error_message)
@@ -87,6 +95,6 @@ GType Glib::Value<__NAMESPACE__::__CPPNAME__::Code>::value_type()
 }
 
 ')dnl endif !NO_GTYPE
+ifelse(`$8',,,`_DEPRECATE_IFDEF_END')`'dnl
 _POP()
-') dnl enddef _GERROR
-
+')dnl enddef _GERROR
diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm
index 04fe6c9..33d4a75 100644
--- a/tools/pm/DocsParser.pm
+++ b/tools/pm/DocsParser.pm
@@ -234,28 +234,11 @@ sub parse_on_cdata($$)
   }
 }
 
-sub lookup_enum_documentation($$$$)
+sub lookup_enum_documentation($$$$$$$)
 {
-  my ($c_enum_name, $cpp_enum_name, $indent, $ref_flags) = @_;
+  my ($c_enum_name, $cpp_enum_name, $indent, $ref_subst_in, $ref_subst_out,
+    $deprecation_docs, $newin) = @_;
   
-  my @subst_in  = [];
-  my @subst_out = [];
-  my $newin = "";
- 
- # Get the substitutions, and recognize some flags too.
-  foreach(@$ref_flags)
-  {
-    if(/^\s*s#([^#]+)#([^#]*)#\s*$/)
-    {
-      push(@subst_in,  $1);
-      push(@subst_out, $2);
-    }
-    elsif(/^\s*newin(.*)/) #If newin is at the start.
-    {
-      $newin = string_unquote(string_trim($1));
-    }
-  }
-
   my $objFunction = $DocsParser::hasharrayFunctions{$c_enum_name};
   if(!$objFunction)
   {
@@ -279,10 +262,10 @@ sub lookup_enum_documentation($$$$)
     $param =~ s/\b[A-Z]+_//;
 
     # Now apply custom substitutions.
-    for(my $i = 0; $i < scalar(@subst_in); ++$i)
+    for(my $i = 0; $i < scalar(@$ref_subst_in); ++$i)
     {
-      $param =~ s/${subst_in[$i]}/${subst_out[$i]}/;
-      $desc  =~ s/${subst_in[$i]}/${subst_out[$i]}/;
+      $param =~ s/$$ref_subst_in[$i]/$$ref_subst_out[$i]/;
+      $desc  =~ s/$$ref_subst_in[$i]/$$ref_subst_out[$i]/;
     }
 
     # Skip this element, if its name has been deleted.
@@ -305,6 +288,13 @@ sub lookup_enum_documentation($$$$)
   DocsParser::convert_docs_to_cpp($objFunction, \$description);
   DocsParser::replace_or_add_newin(\$description, $newin);
 
+  # Add note about deprecation if we have specified that in our _WRAP_ENUM(),
+  # _WRAP_ENUM_DOCS_ONLY() or _WRAP_GERROR() call:
+  if($deprecation_docs ne "")
+  {
+    $description .= "\n\ deprecated $deprecation_docs\n";
+  }
+
   # Append the enum description docs.
   DocsParser::convert_docs_to_cpp($objFunction, \$docs);
   $docs .= "\n\n$description";
diff --git a/tools/pm/Enum.pm b/tools/pm/Enum.pm
index 6184077..ceb705c 100644
--- a/tools/pm/Enum.pm
+++ b/tools/pm/Enum.pm
@@ -277,34 +277,7 @@ sub beautify_values($)
 
 sub build_element_list($$$$)
 {
-  my ($self, $ref_flags, $ref_no_gtype, $indent) = @_;
-
-  my @subst_in  = [];
-  my @subst_out = [];
-
-  # Build a list of custom substitutions, and recognize some flags too.
-
-  foreach(@$ref_flags)
-  {
-    if(/^\s*(NO_GTYPE)\s*$/)
-    {
-      $$ref_no_gtype = $1;
-    }
-    elsif(/^\s*(get_type_func=)(\s*)\s*$/)
-    {
-      my $part1 = $1;
-      my $part2 = $2;
-    }
-    elsif(/^\s*s#([^#]+)#([^#]*)#\s*$/)
-    {
-      push(@subst_in,  $1);
-      push(@subst_out, $2);
-    }
-    elsif($_ !~ /^\s*(?:newin.*)?$/) # newin or only white space
-    {
-      return undef;
-    }
-  }
+  my ($self, $ref_subst_in, $ref_subst_out, $indent) = @_;
 
   my $elem_names  = $$self{elem_names};
   my $elem_values = $$self{elem_values};
@@ -317,10 +290,10 @@ sub build_element_list($$$$)
     my $name  = $$elem_names[$i];
     my $value = $$elem_values[$i];
 
-    for(my $ii = 0; $ii < scalar(@subst_in); ++$ii)
+    for(my $ii = 0; $ii < scalar(@$ref_subst_in); ++$ii)
     {
-      $name  =~ s/${subst_in[$ii]}/${subst_out[$ii]}/;
-      $value =~ s/${subst_in[$ii]}/${subst_out[$ii]}/;
+      $name  =~ s/$$ref_subst_in[$ii]/$$ref_subst_out[$ii]/;
+      $value =~ s/$$ref_subst_in[$ii]/$$ref_subst_out[$ii]/;
     }
 
     # Skip this element, if its name has been deleted.
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index df0c9a0..1485d00 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -687,10 +687,14 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$)
   $self->append($str);
 }
 
-# void output_wrap_enum($filename, $line_num, $cpp_type, $c_type, $comment, @flags)
-sub output_wrap_enum($$$$$$$)
+# void output_wrap_enum($filename, $line_num, $cpp_type, $c_type,
+#   $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+#   $deprecated, $deprecation_docs, $newin)
+sub output_wrap_enum($$$$$$$$$$$$)
 {
-  my ($self, $filename, $line_num, $cpp_type, $c_type, $comment, @flags) = @_;
+  my ($self, $filename, $line_num, $cpp_type, $c_type,
+    $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $deprecated, $deprecation_docs, $newin) = @_;
 
   my $objEnum = GtkDefs::lookup_enum($c_type);
   if(!$objEnum)
@@ -701,8 +705,7 @@ sub output_wrap_enum($$$$$$$)
 
   $objEnum->beautify_values();
 
-  my $no_gtype = "";
-  my $elements = $objEnum->build_element_list(\ flags, \$no_gtype, "  ");
+  my $elements = $objEnum->build_element_list($ref_subst_in, $ref_subst_out, "  ");
 
   if(!$elements)
   {
@@ -714,32 +717,33 @@ sub output_wrap_enum($$$$$$$)
   $value_suffix = "Flags" if($$objEnum{flags});
 
   # Get the enum documentation from the parsed docs.
-  my $enum_docs =
-    DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", " ", \ flags);
+  my $enum_docs = DocsParser::lookup_enum_documentation("$c_type", "$cpp_type",
+    " ", $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin);
 
   # Merge the passed in comment to the existing enum documentation.
   $comment .= "\n * " . $enum_docs if $enum_docs ne "";
 
-  my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\')dnl\n",
+  my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',\`%s\')dnl\n",
     $cpp_type,
     $c_type,
     $value_suffix,
     $elements,
     $no_gtype,
-    $comment
+    $comment,
+    $deprecated
   );
 
   $self->append($str);
 }
 
-sub output_wrap_enum_docs_only($$$$$$$)
+sub output_wrap_enum_docs_only($$$$$$$$$$$)
 {
   my ($self, $filename, $line_num, $module_canonical, $cpp_type, $c_type,
-      $comment, @flags) = @_;
+    $comment, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin) = @_;
  
   # Get the existing enum description from the parsed docs.
-  my $enum_docs =
-    DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", " ", \ flags);
+  my $enum_docs = DocsParser::lookup_enum_documentation("$c_type", "$cpp_type",
+    " ", $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin);
 
   if($enum_docs eq "")
   {
@@ -756,17 +760,21 @@ sub output_wrap_enum_docs_only($$$$$$$)
   $self->append($comment);
 }
 
-# void output_wrap_gerror($filename, $line_num, $cpp_type, $c_enum, $domain, @flags)
-sub output_wrap_gerror($$$$$$$)
+# void output_wrap_gerror($filename, $line_num, $cpp_type, $c_type, $domain,
+#  $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+#  $deprecated, $deprecation_docs, $newin)
+sub output_wrap_gerror($$$$$$$$$$$$$)
 {
-  my ($self, $filename, $line_num, $cpp_type, $c_enum, $domain, @flags) = @_;
+  my ($self, $filename, $line_num, $cpp_type, $c_type, $domain,
+    $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $deprecated, $deprecation_docs, $newin) = @_;
 
   my $objDefsParser = $$self{objDefsParser};
 
-  my $objEnum = GtkDefs::lookup_enum($c_enum);
+  my $objEnum = GtkDefs::lookup_enum($c_type);
   if(!$objEnum)
   {
-    $self->output_wrap_failed($c_enum, "enum defs lookup failed.");
+    $self->output_wrap_failed($c_type, "enum defs lookup failed.");
     return;
   }
 
@@ -780,25 +788,51 @@ sub output_wrap_gerror($$$$$$$)
   $prefix =~ s/^[^_]+_//;
 
   # Chop off the domain prefix, because we put the enum into the class.
-  unshift(@flags, "s#^${prefix}_##");
+  unshift(@$ref_subst_in, "^${prefix}_");
+  unshift(@$ref_subst_out, "");
 
-  my $no_gtype = "";
-  my $elements = $objEnum->build_element_list(\ flags, \$no_gtype, "    ");
+  my $elements = $objEnum->build_element_list($ref_subst_in, $ref_subst_out, "    ");
 
   # Get the enum documentation from the parsed docs.
-  my $enum_docs =
-    DocsParser::lookup_enum_documentation("$c_enum", "Code", "   ", \ flags);
+  my $enum_docs = DocsParser::lookup_enum_documentation("$c_type", "Code",
+    "   ", $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin);
 
   # 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",
+  # Add @newin and @deprecated to the class documentation, if appropriate.
+  my $extra_class_docs = "";
+  if ($newin ne "" and !($class_docs =~ /\ newin/))
+  {
+    $extra_class_docs .= "\n *\n *" if $class_docs;
+    $extra_class_docs .= " \ newin{$newin}";
+  }
+  if ($deprecation_docs ne "" and !($class_docs =~ /\ deprecated/))
+  {
+    $extra_class_docs .= "\n *\n *" if $class_docs or $extra_class_docs;
+    $extra_class_docs .= " \ deprecated $deprecation_docs";
+  }
+  if ($extra_class_docs ne "")
+  {
+    # $class_docs has got ` and ' replaced and m4 quotes added in WrapParser::
+    # on_comment_doxygen() and extract_preceding_documentation().
+    # Fix $extra_class_docs here. $deprecation_docs can contain any characters.
+    DocsParser::add_m4_quotes(\$extra_class_docs);
+    $class_docs .= $extra_class_docs;
+  }
+
+  # Prevent Doxygen from auto-linking to a class called Exception.
+  $class_docs =~ s/([^%])(Exception class)/$1%$2/g;
+
+  my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s,\`%s\',\`%s\',\`%s\')dnl\n",
     $cpp_type,
-    $c_enum,
+    $c_type,
     $domain,
     $elements,
     $no_gtype,
-    $enum_docs
+    $class_docs,
+    $enum_docs,
+    $deprecated
   );
 
   $self->append($str);
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index 65fb936..8b05695 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1409,25 +1409,79 @@ sub on_wrap_vfunc($)
                            $slot_name, $slot_callback, $no_slot_copy, $returnValue, $exceptionHandler);
 }
 
+# Common part of _WRAP_ENUM(), _WRAP_ENUM_DOCS_ONLY() and _WRAP_GERROR().
+sub on_wrap_any_enum($$)
+{
+  my ($self, $is_gerror) = @_;
+
+  my $str = $self->extract_bracketed_text();
+  my @args = string_split_commas($str);
+
+  #Get the arguments:
+  my $cpp_type = string_trim(shift(@args));
+  my $c_type   = string_trim(shift(@args));
+  my $domain   = $is_gerror ? string_trim(shift(@args)) : "";
+
+  my @subst_in  = [];
+  my @subst_out = [];
+  my $no_gtype = "";
+  my $argDeprecated = "";
+  my $deprecation_docs = "";
+  my $newin = "";
+
+  # Build a list of custom substitutions, and recognize some flags too.
+  foreach (@args)
+  {
+    my $arg = string_trim($_);
+
+    if ($arg eq "NO_GTYPE")
+    {
+      $no_gtype = "NO_GTYPE";
+    }
+    elsif ($arg =~ /^(get_type_func=)(\s*)$/)
+    {
+      my $part1 = $1;
+      my $part2 = $2;
+    }
+    elsif ($arg =~ /^s#([^#]+)#([^#]*)#$/)
+    {
+      push(@subst_in,  $1);
+      push(@subst_out, $2);
+    }
+    elsif ($arg =~ /^deprecated(.*)/) #If deprecated is at the start.
+    {
+      $argDeprecated = "deprecated";
+
+      if ($1 ne "")
+      {
+        $deprecation_docs = string_unquote(string_trim($1));
+      }
+    }
+    elsif ($arg =~ /^newin(.*)/) #If newin is at the start.
+    {
+      $newin = string_unquote(string_trim($1));
+    }
+  }
+  return ($cpp_type, $c_type, $domain, \ subst_in, \ subst_out, $no_gtype,
+    $argDeprecated, $deprecation_docs, $newin);
+}
+
 sub on_wrap_enum($)
 {
   my ($self) = @_;
 
   return unless ($self->check_for_eof());
 
-  my $outputter = $$self{objOutputter};
   my $comment = $self->extract_preceding_documentation();
 
   # get the arguments
-  my @args = string_split_commas($self->extract_bracketed_text());
-
-  my $cpp_type = string_trim(shift(@args));
-  my $c_type   = string_trim(shift(@args));
-
-  # The remaining elements in @args could be flags or s#^FOO_## substitutions.
+  my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0);
 
-  $outputter->output_wrap_enum(
-      $$self{filename}, $$self{line_num}, $cpp_type, $c_type, $comment, @args);
+  $$self{objOutputter}->output_wrap_enum(
+    $$self{filename}, $$self{line_num}, $cpp_type, $c_type,
+    $comment, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $argDeprecated, $deprecation_docs, $newin);
 }
 
 sub on_wrap_enum_docs_only($)
@@ -1436,24 +1490,19 @@ sub on_wrap_enum_docs_only($)
 
   return unless ($self->check_for_eof());
 
-  my $outputter = $$self{objOutputter};
   my $comment = $self->extract_preceding_documentation();
 
   # get the arguments
-  my @args = string_split_commas($self->extract_bracketed_text());
-
-  my $cpp_type = string_trim(shift(@args));
-  my $c_type   = string_trim(shift(@args));
+  my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, undef,
+    $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0);
 
   # Get the module name so the enum docs can be included in the module's
   # Doxygen enum group.
   my $module_canonical = Util::string_canonical($$self{module});
 
-  # The remaining elements in @args could be flags or s#^FOO_## substitutions.
-
-  $outputter->output_wrap_enum_docs_only(
-      $$self{filename}, $$self{line_num}, $module_canonical, $cpp_type, $c_type,
-      $comment, @args);
+  $$self{objOutputter}->output_wrap_enum_docs_only(
+    $$self{filename}, $$self{line_num}, $module_canonical, $cpp_type, $c_type,
+    $comment, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin);
 }
 
 sub on_wrap_gerror($)
@@ -1462,17 +1511,19 @@ sub on_wrap_gerror($)
 
   return unless ($self->check_for_eof());
 
-  # get the arguments
-  my @args = string_split_commas($self->extract_bracketed_text());
-
-  my $cpp_type = string_trim(shift(@args));
-  my $c_enum   = string_trim(shift(@args));
-  my $domain   = string_trim(shift(@args));
+  # If _WRAP_GERROR is preceded by a doxygen comment, it will be applied
+  # to the generated exception class as a whole, and not to the enum Code
+  # inside the class.
+  my $class_docs = $self->extract_preceding_documentation();
 
-  # The remaining elements in @args could be flags or s#^FOO_## substitutions.
+  # get the arguments
+  my ($cpp_type, $c_type, $domain, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(1);
 
   $$self{objOutputter}->output_wrap_gerror(
-      $$self{filename}, $$self{line_num}, $cpp_type, $c_enum, $domain, @args);
+    $$self{filename}, $$self{line_num}, $cpp_type, $c_type, $domain,
+    $class_docs, $ref_subst_in, $ref_subst_out, $no_gtype,
+    $argDeprecated, $deprecation_docs, $newin);
 }
 
 sub on_wrap_any_property($)


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