diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-03-30 21:54:28 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-04-04 12:26:57 +0800 |
commit | b7d3de1a7964c5d4cc8386bf5583c72da5d07af9 (patch) | |
tree | d0aada42a9f50673d7c2e49e0dc1838d0758a58c /tools | |
parent | 9e56330c13b6f04215d63b4bf83c11547766826b (diff) | |
download | glibmm-b7d3de1a7964c5d4cc8386bf5583c72da5d07af9.tar.gz |
tools/[gerror|enum].m4: Make template<> classes exportable
Allow to apply the decl_prefix argument onto the template<> classes that
we generate for the _WRAP_GERROR and _WRAP_ENUM directives in the
various *.hg files, if specified.
Please note that this is done in GNU m4 style for enum.m4 since we are
using the 10th argument.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/m4/enum.m4 | 7 | ||||
-rw-r--r-- | tools/m4/gerror.m4 | 2 | ||||
-rw-r--r-- | tools/pm/Output.pm | 15 | ||||
-rw-r--r-- | tools/pm/WrapParser.pm | 4 |
4 files changed, 15 insertions, 13 deletions
diff --git a/tools/m4/enum.m4 b/tools/m4/enum.m4 index 09f3111b..a6a27e1e 100644 --- a/tools/m4/enum.m4 +++ b/tools/m4/enum.m4 @@ -1,8 +1,8 @@ dnl dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `gtype_func', `conv_to_int', dnl $1 $2 $3 $4 $5 $6 -dnl in_class, `optional_refdoc_comment', 'deprecated') -dnl $7 $8 $9 +dnl in_class, `optional_refdoc_comment', 'deprecated', 'decl_prefix') +dnl $7 $8 $9 $10 dnl m4_define(`_ENUM',`dnl _PUSH() @@ -13,6 +13,7 @@ m4_define(`__ENUM_CLASS_CPPNAME__',m4_ifelse($7,0,,`__CPPNAME__::')`__ENUM_CPPNA m4_define(`__ENUM_INDENT1__',m4_ifelse($7,0,,` ')) m4_define(`__ENUM_INDENT2__',__ENUM_INDENT1__`'m4_ifelse($6,,,` ')) m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CLASS_CPPNAME__>') +m4_define(`__ENUM_DECL_PREFIX__', $10) _POP() dnl @@ -121,7 +122,7 @@ namespace Glib ifelse(`$9',,,`_DEPRECATE_IFDEF_START')`'dnl template <> -class Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__> : public __ENUM_VALUE_BASE__ +class __ENUM_DECL_PREFIX__ Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__> : public __ENUM_VALUE_BASE__ { public: static GType value_type() G_GNUC_CONST; diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4 index 4de1d0ab..4dabb037 100644 --- a/tools/m4/gerror.m4 +++ b/tools/m4/gerror.m4 @@ -52,7 +52,7 @@ namespace Glib ifelse(`$8',,,`_DEPRECATE_IFDEF_START')`'dnl template <> -class Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__ +class $9 Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__ { public: static GType value_type() G_GNUC_CONST; diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm index 7757d4e7..83da2326 100644 --- a/tools/pm/Output.pm +++ b/tools/pm/Output.pm @@ -685,12 +685,12 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$) # void output_wrap_enum($filename, $line_num, $cpp_type, $c_type, # $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int, -# $in_class, $deprecated, $deprecation_docs, $newin) -sub output_wrap_enum($$$$$$$$$$$$$$) +# $in_class, $deprecated, $deprecation_docs, $newin, $decl_prefix) +sub output_wrap_enum($$$$$$$$$$$$$$$) { my ($self, $filename, $line_num, $cpp_type, $c_type, $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int, - $in_class, $deprecated, $deprecation_docs, $newin) = @_; + $in_class, $deprecated, $deprecation_docs, $newin, $decl_prefix) = @_; my $objEnum = GtkDefs::lookup_enum($c_type); if(!$objEnum) @@ -729,7 +729,7 @@ sub output_wrap_enum($$$$$$$$$$$$$$) my $value_suffix = "Enum"; $value_suffix = "Flags" if ($$objEnum{flags}); - my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',%d,\`%s\',\`%s\')dnl\n", + my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',%d,\`%s\',\`%s\',\`%s\')dnl\n", $cpp_type, $c_type, $value_suffix, @@ -738,15 +738,16 @@ sub output_wrap_enum($$$$$$$$$$$$$$) $conv_to_int, $in_class, $comment, - $deprecated + $deprecated, + $decl_prefix ); $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, $ref_subst_in, $ref_subst_out, $in_class, $deprecation_docs, $newin) = @_; + $comment, $ref_subst_in, $ref_subst_out, $in_class, $deprecation_docs, $newin, $decl_prefix) = @_; my $objEnum = GtkDefs::lookup_enum($c_type); if(!$objEnum) diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm index e6adaabe..9063bce6 100644 --- a/tools/pm/WrapParser.pm +++ b/tools/pm/WrapParser.pm @@ -1527,12 +1527,12 @@ sub on_wrap_enum($) # get the arguments my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int, - $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0); + $argDeprecated, $deprecation_docs, $newin, $decl_prefix) = $self->on_wrap_any_enum(0); $$self{objOutputter}->output_wrap_enum( $$self{filename}, $$self{line_num}, $cpp_type, $c_type, $comment, $ref_subst_in, $ref_subst_out, $gtype_func, $conv_to_int, - $$self{in_class}, $argDeprecated, $deprecation_docs, $newin); + $$self{in_class}, $argDeprecated, $deprecation_docs, $newin, $decl_prefix); } sub on_wrap_enum_docs_only($) |