diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2018-04-16 12:36:51 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2018-04-26 10:55:18 -0300 |
commit | 628e5ab95029c222e5f2eca3fa9a3702015fb8c1 (patch) | |
tree | f819d6e41a6c0981751003a81058affbb4ad986e /src/bin/eolian_mono/eolian/mono/utils.hh | |
parent | e59e8f0a15a6e1a699c1395e12b9431ea430c2b8 (diff) |
efl_mono: Use PascalCase in events
Summary:
To deal with events with the same name as some methods (Del, Invalidate,
etc), the suffix Evt was added.
Thus, now we use
obj.ButtonClickedEvt += callback;
Instead of
obj.BUTTON_CLICKED += cal
The argument classes use the same scheme, being called <Evt name>_Args.
Depends on D5991
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D5992
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/utils.hh')
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/utils.hh | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/utils.hh b/src/bin/eolian_mono/eolian/mono/utils.hh index 6be2076caa..0e1c2efc29 100644 --- a/src/bin/eolian_mono/eolian/mono/utils.hh +++ b/src/bin/eolian_mono/eolian/mono/utils.hh | |||
@@ -2,10 +2,12 @@ | |||
2 | #define EOLIAN_MONO_UTILS_HPP | 2 | #define EOLIAN_MONO_UTILS_HPP |
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <sstream> | ||
6 | #include <iterator> | ||
5 | #include <algorithm> | 7 | #include <algorithm> |
6 | 8 | ||
7 | /* Compared to the helpers.hh header, these functions are lower level, not dealing with | 9 | /* Compared to the helpers.hh and name_helpers headers, these functions are |
8 | * binding-specific structures or knowledge */ | 10 | * lower level, not dealing with binding-specific structures or knowledge */ |
9 | 11 | ||
10 | namespace eolian_mono { namespace utils { | 12 | namespace eolian_mono { namespace utils { |
11 | 13 | ||
@@ -26,6 +28,41 @@ namespace eolian_mono { namespace utils { | |||
26 | ret[0] = std::toupper(ret[0]); | 28 | ret[0] = std::toupper(ret[0]); |
27 | return ret; | 29 | return ret; |
28 | } | 30 | } |
31 | |||
32 | std::vector<std::string> split(std::string const &input, char delim) | ||
33 | { | ||
34 | std::stringstream ss(input); | ||
35 | std::string name; | ||
36 | std::vector<std::string> names; | ||
37 | |||
38 | while (std::getline(ss, name, delim)) | ||
39 | { | ||
40 | if (!name.empty()) | ||
41 | names.push_back(name); | ||
42 | } | ||
43 | return names; | ||
44 | } | ||
45 | |||
46 | std::string to_pascal_case(const std::vector<std::string> &names, std::string const& delim="") | ||
47 | { | ||
48 | std::vector<std::string> outv(names.size()); | ||
49 | std::stringstream osstream; | ||
50 | |||
51 | std::transform(names.begin(), names.end(), outv.begin(), | ||
52 | [](std::string name) { | ||
53 | name[0] = std::toupper(name[0]); | ||
54 | return name; | ||
55 | }); | ||
56 | |||
57 | std::copy(outv.begin(), outv.end(), std::ostream_iterator<std::string>(osstream, delim.c_str())); | ||
58 | |||
59 | std::string ret = osstream.str(); | ||
60 | |||
61 | if (delim != "") | ||
62 | ret.pop_back(); // We could implement an infix_iterator but this pop is enough for now. | ||
63 | |||
64 | return ret; | ||
65 | } | ||
29 | } } | 66 | } } |
30 | 67 | ||
31 | #endif | 68 | #endif |