summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/utils.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-11 19:22:28 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-03-11 19:28:02 -0300
commit305749f049ceb73071febe2ac723dadff7b69dbc (patch)
tree8b00566c34032b6ccf0ccbe452c1ca07dcade2c8 /src/bin/eolian_mono/eolian/mono/utils.hh
parentd96c71c37ced7c9b630a25a9dc650a880903889a (diff)
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
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/utils.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/utils.hh22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/utils.hh b/src/bin/eolian_mono/eolian/mono/utils.hh
index cbea48afa3..392cb00f11 100644
--- a/src/bin/eolian_mono/eolian/mono/utils.hh
+++ b/src/bin/eolian_mono/eolian/mono/utils.hh
@@ -30,20 +30,30 @@ namespace eolian_mono { namespace utils {
30 return ret; 30 return ret;
31 } 31 }
32 32
33 std::vector<std::string> split(std::string const &input, char delim) 33 std::vector<std::string> split(std::string const &input, std::string delims)
34 { 34 {
35 std::stringstream ss(input);
36 std::string name;
37 std::vector<std::string> names; 35 std::vector<std::string> names;
36 size_t pos = 0;
38 37
39 while (std::getline(ss, name, delim)) 38 while(pos != std::string::npos)
40 { 39 {
41 if (!name.empty()) 40 size_t newpos = input.find_first_of(delims, pos);
42 names.push_back(name); 41 names.push_back(input.substr(pos, newpos-pos));
42 pos = newpos;
43
44 if (pos != std::string::npos)
45 pos++;
43 } 46 }
47
44 return names; 48 return names;
45 } 49 }
46 50
51 std::vector<std::string> split(std::string const &input, char delim)
52 {
53 return split(input, {1, delim});
54 }
55
56
47 std::string to_pascal_case(const std::vector<std::string> &names, std::string const& delim="") 57 std::string to_pascal_case(const std::vector<std::string> &names, std::string const& delim="")
48 { 58 {
49 std::vector<std::string> outv(names.size()); 59 std::vector<std::string> outv(names.size());