summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-12-12 16:02:14 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-12-12 16:02:14 +0100
commit8378b854a1582ccfdcc5ef5c23d7bc7c4a63bc40 (patch)
tree20e3d0a8f912d2c595fc40fe9635110a3c47aa42
parent2d7622491884843ce15e2717675b128af1bdbefc (diff)
downloadefl-8378b854a1582ccfdcc5ef5c23d7bc7c4a63bc40.tar.gz
mono-docs: Allow property refs with keys
When an EO property had multiple values or keys the C# generator didn't generate a wrapping C# property. Therefore property references in the documentation were changed to references to the getter. Now multiple values are handled through tuples so the wrapping properties ARE generated. This patch removes the restriction for multiple values to doc refs can more naturally reference the property instead of the getter method. Properties with keys still reference the getter, since these are not wrapped.
-rw-r--r--src/bin/eolian_mono/eolian/mono/documentation.hh16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh
index 0a2179b167..7d90e78801 100644
--- a/src/bin/eolian_mono/eolian/mono/documentation.hh
+++ b/src/bin/eolian_mono/eolian/mono/documentation.hh
@@ -42,18 +42,15 @@ struct documentation_generator
: scope_size(scope_size) {}
- // Returns the number of parameters (values + keys) that a property method requires
+ // Returns the number of keys that a property method requires
// Specify if you want the Setter or the Getter method.
- static int property_num_parameters(const ::Eolian_Function *function, ::Eolian_Function_Type ftype)
+ static int property_num_keys(const ::Eolian_Function *function, ::Eolian_Function_Type ftype)
{
Eina_Iterator *itr = ::eolian_property_keys_get(function, ftype);
Eolian_Function_Parameter *pr;
int n = 0;
EINA_ITERATOR_FOREACH(itr, pr) { n++; }
eina_iterator_free(itr);
- itr = ::eolian_property_values_get(function, ftype);
- EINA_ITERATOR_FOREACH(itr, pr) { n++; }
- eina_iterator_free(itr);
return n;
}
@@ -125,14 +122,13 @@ struct documentation_generator
break;
case ::EOLIAN_PROPERTY:
{
- int getter_params = property_num_parameters(function, ::EOLIAN_PROP_GET);
- int setter_params = property_num_parameters(function, ::EOLIAN_PROP_SET);
+ int getter_nkeys = property_num_keys(function, ::EOLIAN_PROP_GET);
+ int setter_nkeys = property_num_keys(function, ::EOLIAN_PROP_SET);
std::string short_name = name_helpers::property_managed_name(klass_d, eo_name);
bool blacklisted = blacklist::is_property_blacklisted(name + "." + short_name);
- // EO properties with keys, with more than one value, or blacklisted, are not
- // converted into C# properties.
+ // EO properties with keys or blacklisted are not converted into C# properties.
// In these cases we refer to the getter method instead of the property.
- if ((getter_params > 1) || (setter_params > 1) || (blacklisted)) name += ".Get" + short_name;
+ if ((getter_nkeys > 0) || (setter_nkeys > 0) || (blacklisted)) name += ".Get" + short_name;
else if (name_tail == ".get") name += ".Get" + short_name;
else if (name_tail == ".set") name += ".Set" + short_name;
else name += "." + short_name;