summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/keyword.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2017-11-23 21:50:16 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2017-12-04 15:47:50 -0300
commitd93e9ff286ce1961f530d56b5536881f47104ebd (patch)
treed9fd8cd25a64b9ab6b23ae34b92c342dc8e6b543 /src/bin/eolian_mono/eolian/mono/keyword.hh
parent9391407319424c503a78479b407737ccead945b7 (diff)
eolian_mono: Added code for eolian_mono generator
Based on the eolian_cxx library generators. Buildsystem files will come in a future commmit.
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/keyword.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/keyword.hh52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/keyword.hh b/src/bin/eolian_mono/eolian/mono/keyword.hh
new file mode 100644
index 0000000000..fbe853af5b
--- /dev/null
+++ b/src/bin/eolian_mono/eolian/mono/keyword.hh
@@ -0,0 +1,52 @@
1#ifndef EOLIAN_CXX_KEYWORD_HH
2#define EOLIAN_CXX_KEYWORD_HH
3
4#include <string>
5#include <strings.h>
6#include <vector>
7
8#include "name_helpers.hh"
9
10namespace eolian_mono {
11namespace detail {
12inline bool is_iequal(std::string const& lhs, std::string const& rhs)
13{
14 return strcasecmp(lhs.c_str(), rhs.c_str()) == 0;
15}
16}
17
18inline std::string escape_keyword(std::string const& name)
19{
20 using detail::is_iequal;
21 if(is_iequal(name, "delete")
22 || is_iequal(name, "register")
23 || is_iequal(name, "do")
24 || is_iequal(name, "lock")
25 || is_iequal(name, "event")
26 || is_iequal(name, "in")
27 || is_iequal(name, "object")
28 || is_iequal(name, "interface")
29 || is_iequal(name, "string")
30 || is_iequal(name, "internal")
31 || is_iequal(name, "fixed")
32 || is_iequal(name, "base"))
33 return "kw_" + name;
34
35 if (is_iequal(name, "Finalize"))
36 return name + "Add"; // Eo's Finalize is actually the end of efl_add.
37 return name;
38}
39
40
41std::string managed_method_name(std::string const& underscore_name)
42{
43 std::vector<std::string> names = name_helpers::split(underscore_name, '_');
44
45 name_helpers::reorder_verb(names);
46
47 return escape_keyword(name_helpers::pascal_case(names));
48}
49
50}
51
52#endif