//
// generate_refers_to_method
//
void Reference_Class_Definition::
generate_refers_to_method (const Generation_Context & ctx, Object_Class_Definition * item)
{
  const std::string type_name = item->name ();
  const std::string test_method_name = type_name + "_is_nil";
  const std::string method = "refers_to_" + type_name;

  ctx.hfile_
    << std::endl
    << "/**" << std::endl
    << " * @name Refers To Methods" << std::endl
    << " */" << std::endl
    << "///@{" << std::endl
    << "bool " << test_method_name << " (void) const;"
    << type_name << " " << method << " (void) const;"
    << "void " << method << " (" << type_name << "_in item);"
    << "///@}" << std::endl;

  ctx.sfile_
    << function_header_t (test_method_name)
    << "bool " << this->classname_ << "::" << test_method_name << " (void) const"
    << "{"
    << "return this->refers_to ().is_nil ();"
    << "}"
    << function_header_t (method)
    << "void " << this->classname_ << "::" << method << " (" << type_name << "_in item)"
    << "{"
    << "this->refers_to (item);"
    << "}"
    << function_header_t (method)
    << type_name << " " << this->classname_ << "::" << method << " (void) const"
    << "{"
    << "return " << type_name << "::_narrow (this->refers_to ());"
    << "}";
}
Beispiel #2
0
//
// function_header
//
function_header_t function_header (const std::string & str)
{
    return function_header_t (str);
}