summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/header_include_directive.hpp
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-06 02:54:36 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-06 02:54:36 -0300
commit2a3d7860dbc11458425e162cd69ee399e9025251 (patch)
tree84c5b21b644c4cf8806a8eee07b4ed81922c92b4 /src/lib/eolian_cxx/grammar/header_include_directive.hpp
parent4d1b3191d94fcc70472552b1bb554984a9cb0288 (diff)
eolian-cxx: Rewrite to accomodate new features of the C++ binding
Diffstat (limited to 'src/lib/eolian_cxx/grammar/header_include_directive.hpp')
-rw-r--r--src/lib/eolian_cxx/grammar/header_include_directive.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/eolian_cxx/grammar/header_include_directive.hpp b/src/lib/eolian_cxx/grammar/header_include_directive.hpp
new file mode 100644
index 0000000000..6049491397
--- /dev/null
+++ b/src/lib/eolian_cxx/grammar/header_include_directive.hpp
@@ -0,0 +1,34 @@
1#ifndef EOLIAN_CXX_HEADER_INCLUDE_DIRECTIVE_HH
2#define EOLIAN_CXX_HEADER_INCLUDE_DIRECTIVE_HH
3
4#include "generator.hpp"
5
6namespace efl { namespace eolian { namespace grammar {
7
8struct header_include_directive_generator
9{
10 template <typename OutputIterator, typename Attribute, typename Context>
11 bool generate(OutputIterator sink, Attribute const& attribute, Context const&) const
12 {
13 const char include_directive[] = "#include \"";
14 std::copy(include_directive, include_directive + sizeof(include_directive)-1, sink);
15 std::copy(std::begin(attribute), std::end(attribute), sink);
16 *sink++ = '\"';
17 *sink++ = '\n';
18 return true;
19 }
20};
21
22template <>
23struct is_eager_generator<header_include_directive_generator> : std::true_type {};
24
25namespace type_traits {
26template <>
27struct attributes_needed<header_include_directive_generator> : std::integral_constant<int, 1> {};
28}
29
30header_include_directive_generator const header_include_directive;
31
32} } }
33
34#endif