summaryrefslogtreecommitdiff
path: root/cli/inline.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-08 14:51:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-27 11:38:53 +0300
commit720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch)
tree9725f3d1f42ec90fde84520f49647edea013ce5e /cli/inline.cxx
parent3183f3bb927a90783ae0aeaf190a0919377aabe4 (diff)
Separate tests and examples into individual packages
Also make cli module to be explicitly enabled via the config.cli configuration variable.
Diffstat (limited to 'cli/inline.cxx')
-rw-r--r--cli/inline.cxx108
1 files changed, 0 insertions, 108 deletions
diff --git a/cli/inline.cxx b/cli/inline.cxx
deleted file mode 100644
index 05b83db..0000000
--- a/cli/inline.cxx
+++ /dev/null
@@ -1,108 +0,0 @@
-// file : cli/inline.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/inline.hxx>
-
-namespace
-{
- //
- //
- struct option: traversal::option, context
- {
- option (context& c) : context (c) {}
-
- virtual void
- traverse (type& o)
- {
- string name (ename (o));
- string type (o.type ().name ());
- string scope (escape (o.scope ().name ()));
-
- os << inl << "const " << type << "& " << scope << "::" << endl
- << name << " () const"
- << "{"
- << "return this->" << emember (o) << ";"
- << "}";
-
- if (gen_modifier)
- {
- os << inl << type << "& " << scope << "::" << endl
- << name << " ()"
- << "{"
- << "return this->" << emember (o) << ";"
- << "}";
-
- os << inl << "void " << scope << "::" << endl
- << name << "(const " << type << "& x)"
- << "{"
- << "this->" << emember (o) << " = x;"
- << "}";
- }
-
- if (gen_specifier && type != "bool")
- {
- string spec (especifier (o));
-
- os << inl << "bool " << scope << "::" << endl
- << spec << " () const"
- << "{"
- << "return this->" << especifier_member (o) << ";"
- << "}";
-
- if (gen_modifier)
- os << inl << "void " << scope << "::" << endl
- << spec << "(bool x)"
- << "{"
- << "this->" << especifier_member (o) << " = x;"
- << "}";
- }
- }
- };
-
- //
- //
- struct class_: traversal::class_, context
- {
- class_ (context& c)
- : context (c), option_ (c)
- {
- names_option_ >> option_;
- }
-
- virtual void
- traverse (type& c)
- {
- string name (escape (c.name ()));
-
- os << "// " << name << endl
- << "//" << endl
- << endl;
-
- names (c, names_option_);
- }
-
- private:
- option option_;
- traversal::names names_option_;
- };
-}
-
-void
-generate_inline (context& ctx)
-{
- traversal::cli_unit unit;
- traversal::names unit_names;
- namespace_ ns (ctx);
- class_ cl (ctx);
-
- unit >> unit_names >> ns;
- unit_names >> cl;
-
- traversal::names ns_names;
-
- ns >> ns_names >> ns;
- ns_names >> cl;
-
- unit.dispatch (ctx.unit);
-}