// Events
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)
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;
+ size_t pos = 0;
- while (std::getline(ss, name, delim))
+ while(pos != std::string::npos)
{
- if (!name.empty())
- names.push_back(name);
+ size_t newpos = input.find_first_of(delims, pos);
+ names.push_back(input.substr(pos, newpos-pos));
+ pos = newpos;
+
+ if (pos != std::string::npos)
+ pos++;
}
+
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::vector<std::string> outv(names.size());
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);
+
+ }
+}
}
}
}
+ emit_event_with_under {
+ }
+
append_to_strbuf {
params {
@in buf: strbuf;
evt,with,struct @hot: Dummy.StructSimple;
evt,with,struct,complex @hot: Dummy.StructComplex;
evt,with,list @hot: list<string>;
+ evt_with,under @hot: void;
}
}
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)
{
eina_strbuf_append(buf, str);