diff options
Diffstat (limited to 'tools/pm/Output.pm')
-rw-r--r-- | tools/pm/Output.pm | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm index f7db4695..b3ffe714 100644 --- a/tools/pm/Output.pm +++ b/tools/pm/Output.pm @@ -86,7 +86,7 @@ sub output_wrap_vfunc_h($$$$$) { my ($self, $filename, $line_num, $objCppfunc, $objCDefsFunc) = @_; -#TODO: We can probably remove _VFUNC_H from the .m4 file +#Old code. We removed _VFUNC_H from the .m4 file # my $str = sprintf("_VFUNC_H(%s,%s,\`%s\',%s)dnl\n", # $$objCppfunc{name}, # $$objCppfunc{rettype}, @@ -101,7 +101,9 @@ sub output_wrap_vfunc_h($$$$$) $cppVfuncDecl .= " const"; } - $self->append(" $cppVfuncDecl;"); + $self->append("#ifdef GLIBMM_VFUNCS_ENABLED\n"); + $self->append(" $cppVfuncDecl;\n"); + $self->append("#endif //GLIBMM_VFUNCS_ENABLED\n"); #The default callback, which will call *_vfunc, which will then call the base default callback. #Declares the callback in the private *Class class and sets it in the class_init function. @@ -262,9 +264,45 @@ sub output_wrap_meth($$$$$$) # Doxygen documentation before the method declaration: $self->output_wrap_meth_docs_only($filename, $line_num, $documentation); + if($$objCDefsFunc{throw_any_errors}) + { + $self->append("#ifdef GLIBMM_EXCEPTIONS_ENABLED\n"); + } $self->append(" ${cppMethodDecl};"); + if($$objCDefsFunc{throw_any_errors}) + { + $self->append("\n#else\n"); + + # #Add an error argument, by searching for ) at the end and replacing it: + # my $declWithErrorArg = ${cppMethodDecl}; + # $declWithErrorArg =~ s/\)$/, std::auto_ptr<Glib::Error>& error\)/g; + + #Recreate the declaration, to remove the default values, which we can't have as well as an error parameter at the end: + my $declWithErrorArg = $$objCppfunc{rettype} . " " . $$objCppfunc{name} . "(" . $objCppfunc->args_types_and_names() . ", std::auto_ptr<Glib::Error>& error)"; + + if($$objCppfunc{static}) + { + $declWithErrorArg = "static " . $declWithErrorArg; + } + + if($objCppfunc->get_is_const() eq 1) + { + if($$objCppfunc{static} ne 1) #It can't be const and static at the same time. + { + $declWithErrorArg = $declWithErrorArg . " const"; + } + } + + #remove any superfluous ,: + $declWithErrorArg =~ s/\(, /\(/g; + + $self->append(" ${declWithErrorArg};"); + + $self->append("\n#endif //GLIBMM_EXCEPTIONS_ENABLED\n"); + } + if($deprecated ne "") { $self->append("\n_DEPRECATE_IFDEF_END\n"); @@ -652,7 +690,7 @@ sub convert_args_cpp_to_c($$$$;$) ${$c_param_types}[-1] eq "GError**" ) { $num_cpp_args++; - $cpp_param_names = [@{$cpp_param_names},"error"]; + $cpp_param_names = [@{$cpp_param_names},"gerror"]; $cpp_param_types = [@{$cpp_param_types},"GError*&"]; } |