[glibmm/gmmproc-refactor] Add support for default parameters for _WRAP_CTOR and _WRAP_CREATE.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] Add support for default parameters for _WRAP_CTOR and _WRAP_CREATE.
- Date: Sun, 24 Jun 2012 19:51:37 +0000 (UTC)
commit f036d420d8bbfece5d854975a19b2215f56336fa
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Jun 14 00:54:24 2012 +0200
Add support for default parameters for _WRAP_CTOR and _WRAP_CREATE.
tools/pm/Common/Output/Ctor.pm | 22 ++++++++++++----------
tools/pm/Common/WrapParser.pm | 20 +++++++++++++-------
2 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/tools/pm/Common/Output/Ctor.pm b/tools/pm/Common/Output/Ctor.pm
index 3090542..26a57c5 100644
--- a/tools/pm/Common/Output/Ctor.pm
+++ b/tools/pm/Common/Output/Ctor.pm
@@ -82,14 +82,15 @@ sub ctor_default ($)
$section_manager->pop_entry;
}
-sub wrap_ctor ($$$$$$)
+sub wrap_ctor ($$$$$$$)
{
- my ($wrap_parser, $c_param_types, $c_param_transfers, $c_prop_names, $cpp_param_types, $cpp_param_names) = @_;
+ my ($wrap_parser, $c_param_types, $c_param_transfers, $c_prop_names, $cpp_param_types, $cpp_param_names, $cxx_param_values) = @_;
my $section_manager = $wrap_parser->get_section_manager;
my $main_section = $wrap_parser->get_main_section;
my $cpp_type = Common::Output::Shared::get_cpp_type $wrap_parser;
- my $cpp_params_str = Common::Output::Shared::paramzipstr $cpp_param_types, $cpp_param_names;
- my $code_string = (nl 'explicit ', $cpp_type, '(', $cpp_params_str, ');') .
+ my $cpp_params_str_h = Common::Output::Shared::paramzipstr ($cpp_param_types, $cpp_param_names, $cxx_param_values);
+ my $cxx_params_str_cc = Common::Output::Shared::paramzipstr ($cpp_param_types, $cpp_param_names);
+ my $code_string = (nl 'explicit ', $cpp_type, '(', $cpp_params_str_h, ');') .
(nl);
my $section = Common::Output::Shared::get_section $wrap_parser, Common::Sections::CC_NAMESPACE;
my $full_cpp_type = Common::Output::Shared::get_full_cpp_type $wrap_parser;
@@ -100,7 +101,7 @@ sub wrap_ctor ($$$$$$)
my $ctor_params_str = join ', ', '', (map { join '', '"', $c_prop_names->[$_], '", ', ($type_info_local->get_conversion ($cpp_param_types->[$_], $c_param_types->[$_], $c_param_transfers->[$_], $cpp_param_names->[$_])) } 0 .. (@{$cpp_param_types} - 1)), 'static_cast<char*>(0)';
$section_manager->append_string_to_section ($code_string, $main_section);
- $code_string = (nl $full_cpp_type, '::', $cpp_type, '(', $cpp_params_str, ')') .
+ $code_string = (nl $full_cpp_type, '::', $cpp_type, '(', $cxx_params_str_cc, ')') .
(nl ':') .
(nl ' // Mark this class as non-derived to allow C++ vfuncs to be skipped.') .
(nl ' Glib::ObjectBase(0),') .
@@ -116,20 +117,21 @@ sub wrap_ctor ($$$$$$)
$section_manager->pop_entry;
}
-sub wrap_create ($$$)
+sub wrap_create ($$$$)
{
- my ($wrap_parser, $cpp_param_types, $cpp_param_names) = @_;
+ my ($wrap_parser, $cpp_param_types, $cpp_param_names, $cxx_param_values) = @_;
my $section_manager = $wrap_parser->get_section_manager;
my $main_section = $wrap_parser->get_main_section;
my $section = Common::Output::Shared::get_section $wrap_parser, Common::Sections::CC_NAMESPACE;
my $cpp_type = Common::Output::Shared::get_cpp_type $wrap_parser;
my $full_cpp_type = Common::Output::Shared::get_full_cpp_type $wrap_parser;
- my $cpp_params_str = Common::Output::Shared::paramzipstr $cpp_param_types, $cpp_param_names;
+ my $cpp_params_str_h = Common::Output::Shared::paramzipstr ($cpp_param_types, $cpp_param_names, $cxx_param_values);
+ my $cxx_params_str_cc = Common::Output::Shared::paramzipstr ($cpp_param_types, $cpp_param_names);
my $cpp_names_str = join ', ', @{$cpp_param_names};
- my $code_string = (nl 'static Glib::RefPtr< ', $cpp_type, ' > create(', $cpp_params_str, ');');
+ my $code_string = (nl 'static Glib::RefPtr< ', $cpp_type, ' > create(', $cpp_params_str_h, ');');
$section_manager->append_string_to_section ($code_string, $main_section);
- $code_string = (nl 'Glib::RefPtr< ', $full_cpp_type, ' > ', $full_cpp_type, '::create(', $cpp_params_str, ')') .
+ $code_string = (nl 'Glib::RefPtr< ', $full_cpp_type, ' > ', $full_cpp_type, '::create(', $cxx_params_str_cc, ')') .
(nl '{') .
(nl ' return Glib::RefPtr< ', $cpp_type, ' >(new ', $cpp_type, '(', $cpp_names_str, '));') .
(nl '}') .
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 250cfc3..7c98931 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -1156,12 +1156,13 @@ sub _on_wrap_ctor ($)
my @c_prop_names = map { $self->_get_prop_name ($gir_class, $c_param_names->[$_], $cxx_param_names->[$_]) } 0 .. ($c_params_count - 1);
- Common::Output::Ctor::wrap_ctor $self,
- $c_constructor->get_param_types,
- $c_constructor->get_param_transfers,
- \ c_prop_names,
- $cxx_function->get_param_types,
- $cxx_function->get_param_names;
+ Common::Output::Ctor::wrap_ctor ($self,
+ $c_constructor->get_param_types,
+ $c_constructor->get_param_transfers,
+ \ c_prop_names,
+ $cxx_function->get_param_types,
+ $cxx_function->get_param_names,
+ $cxx_function->get_param_values);
}
sub _on_wrap_create ($)
@@ -1170,14 +1171,19 @@ sub _on_wrap_create ($)
my $params = Common::Shared::parse_params $self->_extract_bracketed_text;
my $types = [];
my $names = [];
+ my $values = [];
foreach my $param (@{$params})
{
push @{$types}, $param->{'type'};
push @{$names}, $param->{'name'};
+ push (@{$values}, $param->{'value'});
}
- Common::Output::Ctor::wrap_create $self, $types, $names;
+ Common::Output::Ctor::wrap_create ($self,
+ $types,
+ $names,
+ $values);
}
sub _on_wrap_enum ($)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]