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)
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 0a2179b..7d90e78 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
42 : scope_size(scope_size) {} 42 : scope_size(scope_size) {}
43 43
44 44
45 // Returns the number of parameters (values + keys) that a property method requires 45 // Returns the number of keys that a property method requires
46 // Specify if you want the Setter or the Getter method. 46 // Specify if you want the Setter or the Getter method.
47 static int property_num_parameters(const ::Eolian_Function *function, ::Eolian_Function_Type ftype) 47 static int property_num_keys(const ::Eolian_Function *function, ::Eolian_Function_Type ftype)
48 { 48 {
49 Eina_Iterator *itr = ::eolian_property_keys_get(function, ftype); 49 Eina_Iterator *itr = ::eolian_property_keys_get(function, ftype);
50 Eolian_Function_Parameter *pr; 50 Eolian_Function_Parameter *pr;
51 int n = 0; 51 int n = 0;
52 EINA_ITERATOR_FOREACH(itr, pr) { n++; } 52 EINA_ITERATOR_FOREACH(itr, pr) { n++; }
53 eina_iterator_free(itr); 53 eina_iterator_free(itr);
54 itr = ::eolian_property_values_get(function, ftype);
55 EINA_ITERATOR_FOREACH(itr, pr) { n++; }
56 eina_iterator_free(itr);
57 return n; 54 return n;
58 } 55 }
59 56
@@ -125,14 +122,13 @@ struct documentation_generator
125 break; 122 break;
126 case ::EOLIAN_PROPERTY: 123 case ::EOLIAN_PROPERTY:
127 { 124 {
128 int getter_params = property_num_parameters(function, ::EOLIAN_PROP_GET); 125 int getter_nkeys = property_num_keys(function, ::EOLIAN_PROP_GET);
129 int setter_params = property_num_parameters(function, ::EOLIAN_PROP_SET); 126 int setter_nkeys = property_num_keys(function, ::EOLIAN_PROP_SET);
130 std::string short_name = name_helpers::property_managed_name(klass_d, eo_name); 127 std::string short_name = name_helpers::property_managed_name(klass_d, eo_name);
131 bool blacklisted = blacklist::is_property_blacklisted(name + "." + short_name); 128 bool blacklisted = blacklist::is_property_blacklisted(name + "." + short_name);
132 // EO properties with keys, with more than one value, or blacklisted, are not 129 // EO properties with keys or blacklisted are not converted into C# properties.
133 // converted into C# properties.
134 // In these cases we refer to the getter method instead of the property. 130 // In these cases we refer to the getter method instead of the property.
135 if ((getter_params > 1) || (setter_params > 1) || (blacklisted)) name += ".Get" + short_name; 131 if ((getter_nkeys > 0) || (setter_nkeys > 0) || (blacklisted)) name += ".Get" + short_name;
136 else if (name_tail == ".get") name += ".Get" + short_name; 132 else if (name_tail == ".get") name += ".Get" + short_name;
137 else if (name_tail == ".set") name += ".Set" + short_name; 133 else if (name_tail == ".set") name += ".Set" + short_name;
138 else name += "." + short_name; 134 else name += "." + short_name;