summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx/eolian_cxx.cc
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-05-22 17:24:50 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-05-26 13:56:06 +0300
commit62082548bc2210e8ebe1cf59127634e00b5ad30f (patch)
tree1698cf9a65395407987d62fbb6fce3c295c51f85 /src/bin/eolian_cxx/eolian_cxx.cc
parent1401ce36b6d8a40270641a5094dbf098ed6858c1 (diff)
Eolian: modify API to allow future scalability
Until now, the functions giving access to class information were taking the class name as parameter. Except the fact that we needed to search into a hash table for the internal class structure, no flexibility is possible. This change consists in modifying most of the APIs using the class name with a new Eolian_Class type and adapt the code of the C and C++ generators accordingly.
Diffstat (limited to 'src/bin/eolian_cxx/eolian_cxx.cc')
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index d3e194d15c..e58ea6399d 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -84,9 +84,9 @@ _guess_classname_from_sources(::options_type& opts)
84{ 84{
85 for (auto filename : opts.in_srcs) 85 for (auto filename : opts.in_srcs)
86 { 86 {
87 if (const char *cls = eolian_class_find_by_file(filename.c_str())) 87 if (Eolian_Class klass = eolian_class_find_by_file(filename.c_str()))
88 { 88 {
89 return cls; 89 return eolian_class_name_get(klass);
90 } 90 }
91 } 91 }
92 return ""; 92 return "";
@@ -119,16 +119,17 @@ _resolve_includes(std::string const& classname)
119 efl::eolian::eo_generator_options gen_opts; 119 efl::eolian::eo_generator_options gen_opts;
120 120
121 std::string cls_name = classname; 121 std::string cls_name = classname;
122 Eolian_Class klass = eolian_class_find_by_name(classname.c_str());
122 std::transform(cls_name.begin(), cls_name.end(), cls_name.begin(), ::tolower); 123 std::transform(cls_name.begin(), cls_name.end(), cls_name.begin(), ::tolower);
123 124
124 std::string eo_file = safe_str(eolian_class_file_get(classname.c_str())); 125 std::string eo_file = safe_str(eolian_class_file_get(klass));
125 gen_opts.c_headers.push_back(get_filename_info(eo_file).first + ".h"); 126 gen_opts.c_headers.push_back(get_filename_info(eo_file).first + ".h");
126 127
127 void *cur = NULL; 128 void *cur = NULL;
128 const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(classname.c_str()); 129 const Eina_List *itr, *inheritances = eolian_class_inherits_list_get(klass);
129 EINA_LIST_FOREACH(inheritances, itr, cur) 130 EINA_LIST_FOREACH(inheritances, itr, cur)
130 { 131 {
131 const char *ext = static_cast<const char*>(cur); 132 Eolian_Class ext = eolian_class_find_by_name(static_cast<const char*>(cur));
132 std::string eo_parent_file = safe_str(eolian_class_file_get(ext)); 133 std::string eo_parent_file = safe_str(eolian_class_file_get(ext));
133 if (!eo_parent_file.empty()) 134 if (!eo_parent_file.empty())
134 { 135 {