Esempio n. 1
0
void cpp_gen::generate(mfast::dynamic_templates_description& desc)
{
  out_<< "#include \"" << filebase_ << ".h\"\n"
      << "\n"
      << "using namespace mfast;\n\n"
      << "namespace " << filebase_ << "\n{\n";

  this->traverse(desc);

  std::string instructions = template_instructions_.str();
  if (instructions.size())
    instructions.resize(instructions.size() - 2);

  out_ << "const template_instruction* "<< filebase_ << "_templates_instructions[] ={\n"
       << instructions
       << "};\n\n"
       << "mfast::templates_description* description()\n"
       << "{\n"
       << "  static mfast::templates_description desc(\n"
       << "    \"" << desc.ns()  << "\", // ns\n"
       << "    \"" << desc.template_ns()<< "\", // templateNs\n"
       << "    \"" << desc.dictionary() << "\", // dictionary\n"
       << "    " << filebase_ << "_templates_instructions);\n"
       << "  return &desc;\n"
       << "}\n\n"
       << "\n}\n";
}
Esempio n. 2
0
void codegen_base::traverse(mfast::dynamic_templates_description &desc) {
  for (auto inst : desc.defined_type_instructions()) {
    // we use the second parameter to identify whether the instruction is nested.
    // If the
    // second parameter is not 0, it is nested inside another composite types.
    if (!dont_generate(inst))
      inst->accept(*this, nullptr);
  }

  for (size_t i = 0; i < desc.size(); ++i) {
    desc[i]->accept(*this, nullptr);
  }
}
Esempio n. 3
0
void inl_gen::generate(mfast::dynamic_templates_description& desc)
{
  codegen_base::traverse(desc);
  BOOST_FOREACH(const mfast::aggregate_view_info& info, desc.view_infos())
  {
    this->generate(info);
  }
}
Esempio n. 4
0
void inl_gen::generate(mfast::dynamic_templates_description &desc) {
  codegen_base::traverse(desc);
  for (auto &&info : desc.view_infos()) {
    this->generate(info);
  }
}