[glibmm] gmmproc: _WRAP_PROPERTY(): Allow properties to be deprecated.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] gmmproc: _WRAP_PROPERTY(): Allow properties to be deprecated.
- Date: Fri, 24 Feb 2012 12:32:02 +0000 (UTC)
commit 9b9e3192d60e28b39f90c59b1c8ca5c98262e6ac
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Feb 24 13:31:43 2012 +0100
gmmproc: _WRAP_PROPERTY(): Allow properties to be deprecated.
* tools/m4/property.m4: get_docs(): Take optional documentation_docs
too, like DocsParser::lookup_documentation().
* tools/pm/Output.pm: output_wrap_property(): Take a deprecated bool
and deprecated_docs, adding the ifdef if necessary and passing
it to the _PROPERTY_PROXY() m4 macro, with the amended documentation.
* tools/pm/Property.pm: _PROPERTY_PROXY(): Take a deprecated bool
parameter and add the ifndef if necessary.
* tools/pm/WrapParser.pm: on_wrap_property(): Parse an optional
deprecated "the explanation" parameter.
ChangeLog | 14 ++++++++++++++
tools/m4/property.m4 | 8 ++++++--
tools/pm/Output.pm | 22 +++++++++++++++++-----
tools/pm/Property.pm | 14 +++++++++++---
tools/pm/WrapParser.pm | 21 ++++++++++++++++++++-
5 files changed, 68 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f3c64c..86b3535 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-02-24 Murray Cumming <murrayc murrayc com>
+
+ gmmproc: _WRAP_PROPERTY(): Allow properties to be deprecated.
+
+ * tools/m4/property.m4: get_docs(): Take optional documentation_docs
+ too, like DocsParser::lookup_documentation().
+ * tools/pm/Output.pm: output_wrap_property(): Take a deprecated bool
+ and deprecated_docs, adding the ifdef if necessary and passing
+ it to the _PROPERTY_PROXY() m4 macro, with the amended documentation.
+ * tools/pm/Property.pm: _PROPERTY_PROXY(): Take a deprecated bool
+ parameter and add the ifndef if necessary.
+ * tools/pm/WrapParser.pm: on_wrap_property(): Parse an optional
+ deprecated "the explanation" parameter.
+
2012-02-24 Josà Alburquerque <jaalburquerque gmail com>
Gio::Application, Gio::DBus::AuthObserver: Typos.
diff --git a/tools/m4/property.m4 b/tools/m4/property.m4
index aae8f70..8b0fde7 100644
--- a/tools/m4/property.m4
+++ b/tools/m4/property.m4
@@ -7,7 +7,7 @@ dnl
dnl
dnl
-dnl _PROPERTY_PROXY(name, name_underscored, cpp_type, proxy_suffix, docs)
+dnl _PROPERTY_PROXY(name, name_underscored, cpp_type, proxy_suffix, deprecated, docs)
dnl proxy_suffix could be "_WriteOnly" or "_ReadOnly"
dnl The method will be const if the propertyproxy is _ReadOnly.
dnl
@@ -18,7 +18,7 @@ pushdef(`__PROXY_TYPE__',`dnl
Glib::PropertyProxy$4< _QUOTE($3) >'dnl
)dnl
#ifdef GLIBMM_PROPERTIES_ENABLED
-/** $5
+/** $6
*
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
@@ -27,11 +27,15 @@ Glib::PropertyProxy$4< _QUOTE($3) >'dnl
__PROXY_TYPE__ property_$2`'() ifelse($4,_ReadOnly, const,);
#endif //#GLIBMM_PROPERTIES_ENABLED
_PUSH(SECTION_CC_PROPERTYPROXIES)
+ifelse(`$5',,,`_DEPRECATE_IFDEF_START
+')dnl
#ifdef GLIBMM_PROPERTIES_ENABLED
__PROXY_TYPE__ __CPPNAME__::property_$2`'() ifelse($4,_ReadOnly, const,)
{
return __PROXY_TYPE__`'(this, "$1");
}
+ifelse(`$5',,,`_DEPRECATE_IFDEF_END
+')dnl
#endif //GLIBMM_PROPERTIES_ENABLED
_POP()
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 79a5e40..2c1de2c 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -615,10 +615,10 @@ sub output_wrap_gerror($$$$$$$)
}
# _PROPERTY_PROXY(name, cpp_type)
-# void output_wrap_property($filename, $line_num, $name, $cpp_type)
-sub output_wrap_property($$$$$$)
+# void output_wrap_property($filename, $line_num, $name, $cpp_type, $deprecated, $deprecation_docs)
+sub output_wrap_property($$$$$$$$)
{
- my ($self, $filename, $line_num, $name, $cpp_type, $c_class) = @_;
+ my ($self, $filename, $line_num, $name, $cpp_type, $c_class, $deprecated, $deprecation_docs) = @_;
my $objDefsParser = $$self{objDefsParser};
@@ -658,9 +658,15 @@ sub output_wrap_property($$$$$$)
$name_underscored =~ tr/-/_/;
# Get the property documentation, if any, and add m4 quotes.
- my $documentation = $objProperty->get_docs();
+ my $documentation = $objProperty->get_docs($deprecation_docs);
add_m4_quotes(\$documentation) if ($documentation ne "");
+ #Declaration:
+ if($deprecated ne "")
+ {
+ $self->append("\n_DEPRECATE_IFDEF_START\n");
+ }
+
my $str = sprintf("_PROPERTY_PROXY(%s,%s,%s,%s,`%s')dnl\n",
$name,
$name_underscored,
@@ -675,15 +681,21 @@ sub output_wrap_property($$$$$$)
# then add a second const accessor for a read-only propertyproxy:
if( ($proxy_suffix ne "_ReadOnly") && ($objProperty->get_readable()) )
{
- my $str = sprintf("_PROPERTY_PROXY(%s,%s,%s,%s,`%s')dnl\n",
+ my $str = sprintf("_PROPERTY_PROXY(%s,%s,%s,%s,%s,`%s')dnl\n",
$name,
$name_underscored,
$cpp_type,
"_ReadOnly",
+ $deprecated,
$documentation
);
$self->append($str);
}
+
+ if($deprecated ne "")
+ {
+ $self->append("\n_DEPRECATE_IFDEF_END");
+ }
}
}
diff --git a/tools/pm/Property.pm b/tools/pm/Property.pm
index a0e9759..03d67b4 100644
--- a/tools/pm/Property.pm
+++ b/tools/pm/Property.pm
@@ -110,10 +110,18 @@ sub get_writable($)
return $$self{writable};
}
-sub get_docs($)
+sub get_docs($$)
{
- my ($self) = @_;
- return $$self{docs};
+ my ($self, $deprecation_docs) = @_;
+ my $text = $$self{docs};
+
+ #Add note about deprecation if we have specified that in our _WRAP_METHOD() call:
+ if($deprecation_docs ne "")
+ {
+ $text .= "\n * \ deprecated $deprecation_docs";
+ }
+
+ return $text;
}
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index d271622..aafaf95 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1288,8 +1288,27 @@ sub on_wrap_property($)
my $filename = $$self{filename};
my $line_num = $$self{line_num};
+
+ #TODO: Reduce duplication with on_wrap_method():
+ my $argDeprecated = "";
+ my $deprecation_docs = "";
+ while($#args >= 2) # If the optional arguments are there.
+ {
+ my $argRef = string_trim(pop @args);
+
+ if($argRef =~ /^deprecated(.*)/) #If deprecated is at the start.
+ {
+ $argDeprecated = "deprecated";
+
+ if($1 ne "")
+ {
+ $deprecation_docs = string_unquote(string_trim($1));
+ }
+ }
+ }
+
- $objOutputter->output_wrap_property($filename, $line_num, $argPropertyName, $argCppType, $$self{c_class});
+ $objOutputter->output_wrap_property($filename, $line_num, $argPropertyName, $argCppType, $$self{c_class}, $argDeprecated, $deprecation_docs);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]