function cpp_doc($indent = 0) { $indent += 1; // make room for * $ind = "\n" . str_repeat(' ', $indent); return "/*!{$ind}" . "* @class {$this->name}{$ind}" . "* @details " . CodeGen::indent_code($this->description, 80, $indent, 10) . $ind . (strlen(trim($this->usage)) == 0 ? '' : "* @par Usage {$ind}" . "* " . CodeGen::indent_code($this->usage, 80, $indent, 1) . $ind) . "*/"; }
function cpp_doc($indent = 8) { $indent += 1; // make room for * $ind = "\n" . str_repeat(' ', $indent); $longest_name = 0; foreach ($this->arguments as $arg) { if (strlen($arg->name) > $longest_name) { $longest_name = strlen($arg->name); } } $params = ""; $this->with('arguments'); foreach ($this->arguments as $arg) { $params .= "* @param[{$arg->direction}]" . ($arg->direction == 'in' ? ' ' : ' ') . "{$arg->name} " . str_repeat(' ', $longest_name - strlen($arg->name)) . CodeGen::indent_code($arg->description, 80, $indent, $longest_name + 15) . $ind; } return "/*!{$ind}" . "* @details " . CodeGen::indent_code($this->description, 80, $indent, 10) . $ind . (strlen($this->pre) > 0 ? "* @pre " . CodeGen::indent_code($this->pre, 80, $indent, 10) . $ind : '') . (strlen($this->post) > 0 ? "* @post " . CodeGen::indent_code($this->post, 80, $indent, 10) . $ind : '') . "{$params}*/"; }