[glibmm/gmmproc-refactor] Fix GError and enum wrappers prefixes.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/gmmproc-refactor] Fix GError and enum wrappers prefixes.
- Date: Sun, 22 Jul 2012 18:16:31 +0000 (UTC)
commit de05950b3322ac510c6fc5cf5213a51e2dacf914
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sun Jul 22 17:09:13 2012 +0200
Fix GError and enum wrappers prefixes.
tools/pm/Common/Output/Enum.pm | 10 +++++-
tools/pm/Common/Output/GError.pm | 12 +++++--
tools/pm/Common/Output/Shared.pm | 64 +++++++++++++++++++++++++++++---------
tools/pm/Common/WrapParser.pm | 9 +++++
4 files changed, 75 insertions(+), 20 deletions(-)
---
diff --git a/tools/pm/Common/Output/Enum.pm b/tools/pm/Common/Output/Enum.pm
index 87d0ada..835833d 100644
--- a/tools/pm/Common/Output/Enum.pm
+++ b/tools/pm/Common/Output/Enum.pm
@@ -50,8 +50,14 @@ sub _output_flag_ops
if ($flags)
{
my $section_manager = $wrap_parser->get_section_manager;
- my $container_cxx_type = Common::Output::Shared::get_full_cxx_type $wrap_parser;
- my $full_cxx_type = join '::', $container_cxx_type, $cxx_type;
+ my $container_cxx_type = Common::Output::Shared::get_full_cxx_type ($wrap_parser);
+ my $full_cxx_type = $cxx_type;
+
+ if ($container_cxx_type)
+ {
+ $full_cxx_type = $container_cxx_type . '::' . $full_cxx_type;
+ }
+
my $code_string .= nl ('inline ' . $full_cxx_type . ' operator|(' . $full_cxx_type . ' lhs, ' . $full_cxx_type . ' rhs)') .
nl (' { return static_cast<' . $full_cxx_type . '>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }') .
nl () .
diff --git a/tools/pm/Common/Output/GError.pm b/tools/pm/Common/Output/GError.pm
index d8c9499..190fc55 100644
--- a/tools/pm/Common/Output/GError.pm
+++ b/tools/pm/Common/Output/GError.pm
@@ -86,9 +86,15 @@ sub _output_gerror_impl
{
my ($wrap_parser, $cxx_type, $domain) = @_;
my $container_cxx_type = Common::Output::Shared::get_full_cxx_type $wrap_parser;
- my $full_cxx_type = join '::', $container_cxx_type, $cxx_type;
- my $section_manager = $wrap_parser->get_section_manager;
- my $code_string = nl (Common::Output::Shared::open_namespaces $wrap_parser) .
+ my $full_cxx_type = $cxx_type;
+
+ if ($container_cxx_type)
+ {
+ $full_cxx_type = $container_cxx_type . '::' . $full_cxx_type;
+ }
+
+ my $section_manager = $wrap_parser->get_section_manager ();
+ my $code_string = nl (Common::Output::Shared::open_namespaces ($wrap_parser)) .
nl ($full_cxx_type . '::' . $cxx_type . '(' . $full_cxx_type . '::Code error_code, const Glib::ustring& error_message)') .
nl (':') .
nl (' Glib::Error(g_quark_from_static_string ("' . $domain . '"), error_code, error_message)') .
diff --git a/tools/pm/Common/Output/Shared.pm b/tools/pm/Common/Output/Shared.pm
index e4ae92b..30aeb2d 100644
--- a/tools/pm/Common/Output/Shared.pm
+++ b/tools/pm/Common/Output/Shared.pm
@@ -149,8 +149,17 @@ sub get_complete_cxx_type ($)
my ($wrap_parser) = @_;
my $namespaces = get_full_namespace $wrap_parser;
my $classes = get_full_cxx_type $wrap_parser;
+ my @type = ();
- return join '::', $namespaces, $classes;
+ if ($namespaces)
+ {
+ push (@type, $namespaces);
+ }
+ if ($classes)
+ {
+ push (@type, $classes);
+ }
+ return join ('::', @type);
}
# returns Terminal_Class for Gnome::Vte::Terminal.
@@ -169,10 +178,20 @@ sub get_cxx_class_type ($)
sub get_complete_cxx_class_type ($)
{
my ($wrap_parser) = @_;
- my $full_namespace = get_full_namespace $wrap_parser;
- my $cxx_class_type = get_cxx_class_type $wrap_parser;
+ my $full_namespace = get_full_namespace ($wrap_parser);
+ my $cxx_class_type = get_cxx_class_type ($wrap_parser);
+ my @type = ();
+
+ if ($full_namespace)
+ {
+ push (@type, $full_namespace);
+ }
+ if ($cxx_class_type)
+ {
+ push (@type, $cxx_class_type);
+ }
- return join '::', $full_namespace, $cxx_class_type;
+ return join ('::', @type);
}
# TODO: implement beautifying if I am really bored.
@@ -200,21 +219,30 @@ sub output_enum_gtype_func_h ($$$$)
if (defined $get_type_func)
{
- my $namespaces = $wrap_parser->get_namespaces;
- my $main_section = $wrap_parser->get_main_section;
- my $classes = $wrap_parser->get_classes;
- my $full_cxx_type = join '::', (get_full_cxx_type $wrap_parser), $cxx_type;
- my $close = 1;
+ my $namespaces = $wrap_parser->get_namespaces ();
+ my $main_section = $wrap_parser->get_main_section ();
+ my $container_type = get_full_cxx_type ($wrap_parser);
+ my $full_cxx_type = $cxx_type;
+ my $h_includes_section = Common::Output::Shared::get_section ($wrap_parser, Common::Sections::H_INCLUDES);
+ my $section_manager = $wrap_parser->get_section_manager ();
+
+ $section_manager->append_string_to_section (nl ('#include <glibmm/value.h>'),
+ $h_includes_section);
+ if ($container_type)
+ {
+ $full_cxx_type = $container_type . '::' . $full_cxx_type;
+ }
+
+ my $glib_namespace = 0;
my $value_base = 'Glib::Value_' . $type;
my $code_string = '';
- my $section_manager = $wrap_parser->get_section_manager;
if (@{$namespaces} == 1 and $namespaces->[0] eq 'Glib')
{
- $close = 0;
+ $glib_namespace = 1;
}
- if ($close)
+ unless ($glib_namespace)
{
$code_string .= close_namespaces ($wrap_parser) .
nl (doxy_skip_begin) .
@@ -235,7 +263,7 @@ sub output_enum_gtype_func_h ($$$$)
nl ('};') .
nl ();
- if ($close)
+ unless ($glib_namespace)
{
$code_string .= nl ('} // namespace Glib') .
nl (doxy_skip_end) .
@@ -248,7 +276,7 @@ sub output_enum_gtype_func_h ($$$$)
nl ();
}
- if (@{$classes} > 0)
+ if ($container_type)
{
my $section = get_section $wrap_parser, Common::Sections::H_AFTER_FIRST_CLASS;
@@ -268,7 +296,13 @@ sub output_enum_gtype_func_cc ($$$)
if (defined $get_type_func)
{
my $container_cxx_type = get_full_cxx_type $wrap_parser;
- my $full_cxx_type = join '::', $container_cxx_type, $cxx_type;
+ my $full_cxx_type = $cxx_type;
+
+ if ($container_cxx_type)
+ {
+ $full_cxx_type = $container_cxx_type . '::' . $full_cxx_type;
+ }
+
my $section_manager = $wrap_parser->get_section_manager;
my $code_string = nl ('namespace Glib') .
nl ('{') .
diff --git a/tools/pm/Common/WrapParser.pm b/tools/pm/Common/WrapParser.pm
index 4d07572..c7b34e5 100644
--- a/tools/pm/Common/WrapParser.pm
+++ b/tools/pm/Common/WrapParser.pm
@@ -1475,6 +1475,15 @@ sub _on_wrap_gerror ($)
# TODO: Add "Extra include" option to _WRAP_GERROR
my $extra_includes = [];
my $complete_cxx_type = Common::Output::Shared::get_complete_cxx_type ($self);
+
+ if ($complete_cxx_type)
+ {
+ $complete_cxx_type .= '::' . $cxx_type;
+ }
+ else
+ {
+ $complete_cxx_type = $cxx_type;
+ }
my $wrap_init_entry = Common::WrapInit::GError->new ($extra_includes,
$c_includes,
$cxx_includes,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]