summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-11 21:45:41 +0000
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-10-12 19:20:58 -0300
commit3358d9d475c30bc858300367a270d7337e2179f7 (patch)
tree7bf8d03a9fe3a7ccf3ab1ee65cf3a7e2cbccecd1 /src/bin
parent5516b06af58c4a5210b35c8c9b8e011cf5320c55 (diff)
csharp: Add since info to members related to events.
Like OnFooEvent, FooEvents, etc. ref T8359 Differential Revision: https://phab.enlightenment.org/D10382
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/events.hh101
1 files changed, 90 insertions, 11 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh
index 2e4ca32..ea37c9c 100644
--- a/src/bin/eolian_mono/eolian/mono/events.hh
+++ b/src/bin/eolian_mono/eolian/mono/events.hh
@@ -247,16 +247,62 @@ struct event_argument_wrapper_generator
247 247
248 std::string evt_name = name_helpers::managed_event_name(evt.name); 248 std::string evt_name = name_helpers::managed_event_name(evt.name);
249 249
250 return as_generator("/// <summary>Event argument wrapper for event <see cref=\"" 250 if (!as_generator("/// <summary>Event argument wrapper for event <see cref=\""
251 << join_namespaces(evt.klass.namespaces, '.', managed_namespace) 251 << join_namespaces(evt.klass.namespaces, '.', managed_namespace)
252 << klass_interface_name(evt.klass) << "." << evt_name << "\"/>.</summary>\n" 252 << klass_interface_name(evt.klass) << "." << evt_name << "\"/>.\n"
253 << "[Efl.Eo.BindingEntity]\n" 253 ).generate(sink, nullptr, context))
254 << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n" 254 return false;
255 << scope_tab << "/// <summary>Actual event payload.</summary>\n" 255
256 << scope_tab << "/// <value>" << documentation_string << "</value>\n" 256 std::string since;
257 << scope_tab << "public " << type << " arg { get; set; }\n" 257
258 << "}\n\n" 258 if (!evt.is_beta)
259 ).generate(sink, std::make_tuple(evt.documentation.summary, *etype), context); 259 {
260 since = evt.documentation.since;
261
262 if (since.empty())
263 {
264 auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
265 attributes::klass_def klass(get_klass(evt.klass, unit), unit);
266 since = klass.documentation.since;
267 }
268
269 if (!since.empty())
270 {
271
272 if (!as_generator(
273 lit("/// <para>Since EFL ") << evt.documentation.since << ".</para>\n"
274 ).generate(sink, nullptr, context))
275 return false;
276 }
277 else
278 {
279 EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Event " << evt.name << " of class " << evt.klass.eolian_name
280 << " is stable but has no 'Since' information.";
281 // We do not bail out here because there are some cases of this happening upstream.
282 }
283 }
284
285 if (!as_generator(lit("/// </summary>\n")
286 << "[Efl.Eo.BindingEntity]\n"
287 << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n"
288 << scope_tab << "/// <summary>Actual event payload.\n"
289 ).generate(sink, nullptr, context))
290 return false;
291
292 if (since != "")
293 {
294 if (!as_generator(scope_tab << "/// <para>Since EFL " << since << ".</para>\n").generate(sink, nullptr, context))
295 return false;
296 }
297
298 if (!as_generator(scope_tab << "/// </summary>\n"
299 << scope_tab << "/// <value>" << documentation_string << "</value>\n"
300 << scope_tab << "public " << type << " arg { get; set; }\n"
301 << "}\n\n"
302 ).generate(sink, std::make_tuple(evt.documentation.summary, *etype), context))
303 return false;
304
305 return true;
260 } 306 }
261} const event_argument_wrapper {}; 307} const event_argument_wrapper {};
262 308
@@ -413,8 +459,41 @@ struct event_definition_generator
413 { 459 {
414 auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename); 460 auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename);
415 std::string upper_c_name = utils::to_uppercase(evt.c_name); 461 std::string upper_c_name = utils::to_uppercase(evt.c_name);
462
463 if (!as_generator(
464 scope_tab << "/// <summary>Method to raise event "<< event_name << ".\n"
465 ).generate(sink, nullptr, context))
466 return false;
467
468 if (!evt.is_beta)
469 {
470 std::string since = evt.documentation.since;
471
472 if (since.empty())
473 {
474 auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
475 attributes::klass_def klass(get_klass(evt.klass, unit), unit);
476 since = klass.documentation.since;
477 }
478
479 if (!since.empty())
480 {
481
482 if (!as_generator(
483 scope_tab << "/// <para>Since EFL " << evt.documentation.since << ".</para>\n"
484 ).generate(sink, nullptr, context))
485 return false;
486 }
487 else
488 {
489 EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Event " << evt.name << " of class " << evt.klass.eolian_name
490 << " is stable but has no 'Since' information.";
491 // We do not bail out here because there are some cases of this happening upstream.
492 }
493 }
494
416 if (!as_generator( 495 if (!as_generator(
417 scope_tab << "/// <summary>Method to raise event "<< event_name << ".</summary>\n" 496 scope_tab << "/// </summary>\n"
418 << scope_tab << "/// <param name=\"e\">Event to raise.</param>\n" 497 << scope_tab << "/// <param name=\"e\">Event to raise.</param>\n"
419 << scope_tab << "public void On" << event_name << "(" << event_args_type << " e)\n" 498 << scope_tab << "public void On" << event_name << "(" << event_args_type << " e)\n"
420 << scope_tab << "{\n" 499 << scope_tab << "{\n"