summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/function_declaration.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/function_declaration.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/function_declaration.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_declaration.hh49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_declaration.hh b/src/bin/eolian_mono/eolian/mono/function_declaration.hh
new file mode 100644
index 0000000000..561c975118
--- /dev/null
+++ b/src/bin/eolian_mono/eolian/mono/function_declaration.hh
@@ -0,0 +1,49 @@
1#ifndef EOLIAN_MONO_FUNCTION_DECLARATION_HH
2#define EOLIAN_MONO_FUNCTION_DECLARATION_HH
3
4#include "grammar/generator.hpp"
5#include "grammar/klass_def.hpp"
6
7#include "grammar/indentation.hpp"
8#include "grammar/list.hpp"
9#include "grammar/alternative.hpp"
10#include "type.hh"
11#include "parameter.hh"
12#include "keyword.hh"
13#include "using_decl.hh"
14
15namespace eolian_mono {
16
17struct function_declaration_generator
18{
19 template <typename OutputIterator, typename Context>
20 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
21 {
22 if(is_function_blacklisted(f.c_name))
23 return true;
24 else
25 return as_generator
26 (eolian_mono::type(true) << " " << string << "(" << (parameter % ", ") << ");\n")
27 .generate(sink, std::make_tuple(f.return_type, managed_method_name(f.name), f.parameters), context);
28 }
29};
30
31function_declaration_generator const function_declaration = {};
32
33}
34
35namespace efl { namespace eolian { namespace grammar {
36
37template <>
38struct is_eager_generator< ::eolian_mono::function_declaration_generator> : std::true_type {};
39template <>
40struct is_generator< ::eolian_mono::function_declaration_generator> : std::true_type {};
41
42namespace type_traits {
43template <>
44struct attributes_needed< ::eolian_mono::function_declaration_generator> : std::integral_constant<int, 1> {};
45}
46
47} } }
48
49#endif