forked from enlightenment/efl
csharp: Fix event names with underscore.
Summary: names like `focus_geometry,changed` shoud be converted to FocusGeometryChanged instead of Focus_geometryChanged. Fixes T7735 Test Plan: run tests Reviewers: vitor.sousa, felipealmeida, segfaultxavi Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7735 Differential Revision: https://phab.enlightenment.org/D8301
This commit is contained in:
parent
d96c71c37c
commit
305749f049
|
@ -402,7 +402,7 @@ inline std::string klass_get_full_name(T const& clsname)
|
||||||
// Events
|
// Events
|
||||||
inline std::string managed_event_name(std::string const& name)
|
inline std::string managed_event_name(std::string const& name)
|
||||||
{
|
{
|
||||||
return utils::to_pascal_case(utils::split(name, ','), "") + "Evt";
|
return utils::to_pascal_case(utils::split(name, "_,"), "") + "Evt";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string managed_event_args_short_name(attributes::event_def const& evt)
|
inline std::string managed_event_args_short_name(attributes::event_def const& evt)
|
||||||
|
|
|
@ -30,20 +30,30 @@ namespace eolian_mono { namespace utils {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> split(std::string const &input, char delim)
|
std::vector<std::string> split(std::string const &input, std::string delims)
|
||||||
{
|
{
|
||||||
std::stringstream ss(input);
|
|
||||||
std::string name;
|
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
|
size_t pos = 0;
|
||||||
|
|
||||||
while (std::getline(ss, name, delim))
|
while(pos != std::string::npos)
|
||||||
{
|
{
|
||||||
if (!name.empty())
|
size_t newpos = input.find_first_of(delims, pos);
|
||||||
names.push_back(name);
|
names.push_back(input.substr(pos, newpos-pos));
|
||||||
|
pos = newpos;
|
||||||
|
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> split(std::string const &input, char delim)
|
||||||
|
{
|
||||||
|
return split(input, {1, delim});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string to_pascal_case(const std::vector<std::string> &names, std::string const& delim="")
|
std::string to_pascal_case(const std::vector<std::string> &names, std::string const& delim="")
|
||||||
{
|
{
|
||||||
std::vector<std::string> outv(names.size());
|
std::vector<std::string> outv(names.size());
|
||||||
|
|
|
@ -253,4 +253,25 @@ class TestInterfaceEvents
|
||||||
Test.Assert(another_called);
|
Test.Assert(another_called);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TestEventNaming
|
||||||
|
{
|
||||||
|
// For events named line focus_geometry,changed
|
||||||
|
public static void test_event_naming()
|
||||||
|
{
|
||||||
|
var obj = new Dummy.TestObject();
|
||||||
|
var test_called = false;
|
||||||
|
|
||||||
|
EventHandler cb = (object sender, EventArgs e) => {
|
||||||
|
test_called = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.EvtWithUnderEvt += cb;
|
||||||
|
|
||||||
|
obj.EmitEventWithUnder();
|
||||||
|
|
||||||
|
Test.Assert(test_called);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1310,6 +1310,9 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface, Dummy.An
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit_event_with_under {
|
||||||
|
}
|
||||||
|
|
||||||
append_to_strbuf {
|
append_to_strbuf {
|
||||||
params {
|
params {
|
||||||
@in buf: strbuf;
|
@in buf: strbuf;
|
||||||
|
@ -1406,5 +1409,6 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface, Dummy.An
|
||||||
evt,with,struct @hot: Dummy.StructSimple;
|
evt,with,struct @hot: Dummy.StructSimple;
|
||||||
evt,with,struct,complex @hot: Dummy.StructComplex;
|
evt,with,struct,complex @hot: Dummy.StructComplex;
|
||||||
evt,with,list @hot: list<string>;
|
evt,with,list @hot: list<string>;
|
||||||
|
evt_with,under @hot: void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3789,6 +3789,11 @@ void _dummy_test_object_emit_event_with_list(Eo *obj, EINA_UNUSED Dummy_Test_Obj
|
||||||
efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_LIST, data);
|
efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_LIST, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _dummy_test_object_emit_event_with_under(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
|
||||||
|
{
|
||||||
|
efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_UNDER, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void _dummy_test_object_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Strbuf *buf, const char *str)
|
void _dummy_test_object_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Strbuf *buf, const char *str)
|
||||||
{
|
{
|
||||||
eina_strbuf_append(buf, str);
|
eina_strbuf_append(buf, str);
|
||||||
|
|
Loading…
Reference in New Issue