<commit_before>/**
 * @file
 */
#include "bi/io/cpp/CppClassGenerator.hpp"

#include "bi/io/cpp/CppMemberFiberGenerator.hpp"
#include "bi/primitive/encode.hpp"

bi::CppClassGenerator::CppClassGenerator(std::ostream& base, const int level,
    const bool header) :
    CppBaseGenerator(base, level, header),
    type(nullptr) {
  //
}

void bi::CppClassGenerator::visit(const Class* o) {
  if (!o->isAlias() && o->isBound() && !o->braces->isEmpty()) {
    type = o;
    auto super = dynamic_cast<const ClassType*>(o->base->canonical());
    assert(o->base->isEmpty() || super);

    Gatherer<MemberFunction> memberFunctions;
    Gatherer<MemberFiber> memberFibers;
    Gatherer<MemberVariable> memberVariables;
    o->accept(&memberFunctions);
    o->accept(&memberFibers);
    o->accept(&memberVariables);

    /* start boilerplate */
    if (header) {
      genTemplateParams(o);
      start("class " << o->name);
      if (o->isGeneric() && o->isBound()) {
       genTemplateArgs(o);
      }
      if (o->has(FINAL)) {
        middle(" final");
      }
      if (!o->base->isEmpty()) {
        middle(" : public " << super->name);
        if (!super->typeArgs->isEmpty()) {
          middle('<' << super->typeArgs << '>');
        }
      } else {
        middle(" : public libbirch::Any");
      }
      finish(" {");
      line("public:");
      in();
      if (o->isBound()) {
        start("using class_type_ = " << o->name);
        genTemplateArgs(o);
        finish(';');
        line("using this_type_ = class_type_;");
        if (o->base->isEmpty()) {
          line("using super_type_ = libbirch::Any;");
        } else {

          line("using super_type_ = " << super->name);
          if (!super->typeArgs->isEmpty()) {
            middle('<' << super->typeArgs << '>');
          }
          middle(';');
        }
        line("");
        line("using super_type_::operator=;");
        line("");

        /* using declarations for member functions and fibers in base classes
         * that are overridden */
        std::set<std::string> names;<commit_msg>Minor code generation formatting fix.<commit_after>/**
 * @file
 */
#include "bi/io/cpp/CppClassGenerator.hpp"

#include "bi/io/cpp/CppMemberFiberGenerator.hpp"
#include "bi/primitive/encode.hpp"

bi::CppClassGenerator::CppClassGenerator(std::ostream& base, const int level,
    const bool header) :
    CppBaseGenerator(base, level, header),
    type(nullptr) {
  //
}

void bi::CppClassGenerator::visit(const Class* o) {
  if (!o->isAlias() && o->isBound() && !o->braces->isEmpty()) {
    type = o;
    auto super = dynamic_cast<const ClassType*>(o->base->canonical());
    assert(o->base->isEmpty() || super);

    Gatherer<MemberFunction> memberFunctions;
    Gatherer<MemberFiber> memberFibers;
    Gatherer<MemberVariable> memberVariables;
    o->accept(&memberFunctions);
    o->accept(&memberFibers);
    o->accept(&memberVariables);

    /* start boilerplate */
    if (header) {
      genTemplateParams(o);
      start("class " << o->name);
      if (o->isGeneric() && o->isBound()) {
       genTemplateArgs(o);
      }
      if (o->has(FINAL)) {
        middle(" final");
      }
      if (!o->base->isEmpty()) {
        middle(" : public " << super->name);
        if (!super->typeArgs->isEmpty()) {
          middle('<' << super->typeArgs << '>');
        }
      } else {
        middle(" : public libbirch::Any");
      }
      finish(" {");
      line("public:");
      in();
      if (o->isBound()) {
        start("using class_type_ = " << o->name);
        genTemplateArgs(o);
        finish(';');
        line("using this_type_ = class_type_;");
        if (o->base->isEmpty()) {
          line("using super_type_ = libbirch::Any;");
        } else {
          start("using super_type_ = " << super->name);
          if (!super->typeArgs->isEmpty()) {
            middle('<' << super->typeArgs << '>');
          }
          middle(';');
        }
        line("");
        line("using super_type_::operator=;");
        line("");

        /* using declarations for member functions and fibers in base classes
         * that are overridden */
        std::set<std::string> names;
{'fraction_non_alphanumeric': 0.1846264367816092, 'fraction_numerical': 0.0, 'mean_word_length': 2.495397489539749, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3843823', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1294, 'n_words': 241}