compiler/cpp/src/generate/t_html_generator.cc
/**
 * Prints out documentation for arguments/exceptions of a function, if any documentation has been supplied.
 */
Prints out documentation for arguments/exceptions of a function, if any documentation has been supplied.
Prints out documentation for arguments / exceptions of a function if any documentation has been supplied .
void t_html_generator::print_fn_args_doc(t_function* tfunction) {
  bool has_docs = false;
  vector<t_field*> args = tfunction->get_arglist()->get_members();
  vector<t_field*>::iterator arg_iter = args.begin();
  if (arg_iter != args.end()) {
    for ( ; arg_iter != args.end(); arg_iter++) {
      if ((*arg_iter)->has_doc() && !(*arg_iter)->get_doc().empty())
        has_docs = true;
    }
    if (has_docs) {
      arg_iter = args.begin();
      f_out_ << "<br/><h4 id=\"Parameters_" << service_name_ << "_" << tfunction->get_name()
        << "\">Parameters</h4>" << endl;
      f_out_ << "<table class=\"table-bordered table-striped table-condensed\">";
      f_out_ << "<thead><th>Name</th><th>Description</th></thead>";
      for ( ; arg_iter != args.end(); arg_iter++) {
        f_out_ << "<tr><td>" << (*arg_iter)->get_name();
        f_out_ << "</td><td>";
        f_out_ << (*arg_iter)->get_doc();
        f_out_ << "</td></tr>" << endl;
      }
      f_out_ << "</table>";
    }
  }
  has_docs = false;
  vector<t_field*> excepts = tfunction->get_xceptions()->get_members();
  vector<t_field*>::iterator ex_iter = excepts.begin();
  if (ex_iter != excepts.end()) {
    for ( ; ex_iter != excepts.end(); ex_iter++) {
      if ((*ex_iter)->has_doc() && !(*ex_iter)->get_doc().empty())
        has_docs = true;
    }
    if (has_docs) {
      ex_iter = excepts.begin();
      f_out_ << "<br/><h4 id=\"Exceptions_" << service_name_ << "_" << tfunction->get_name()
        << "\">Exceptions</h4>" << endl;
      f_out_ << "<table class=\"table-bordered table-striped table-condensed\">";
      f_out_ << "<thead><th>Type</th><th>Description</th></thead>";
      for ( ; ex_iter != excepts.end(); ex_iter++) {
        f_out_ << "<tr><td>" << (*ex_iter)->get_type()->get_name();
        f_out_ << "</td><td>";
        f_out_ << (*ex_iter)->get_doc();
        f_out_ << "</td></tr>" << endl;
      }
      f_out_ << "</table>";
    }
  }
}
void t_html_generator :: print_fn_args_doc ( t_function * tfunction ) { bool has_docs = false ; vector < t_field * > args = tfunction -> get_arglist ( ) -> get_members ( ) ; vector < t_field * > :: iterator arg_iter = args . begin ( ) ; if ( arg_iter != args . end ( ) ) { for ( ; arg_iter != args . end ( ) ; arg_iter ++ ) { if ( ( * arg_iter ) -> has_doc ( ) && ! ( * arg_iter ) -> get_doc ( ) . empty ( ) ) has_docs = true ; } if ( has_docs ) { arg_iter = args . begin ( ) ; f_out_ << " \" " << service_name_ << " " << tfunction -> get_name ( ) << " \" " << endl ; f_out_ << " \" \" " ; f_out_ << " " ; for ( ; arg_iter != args . end ( ) ; arg_iter ++ ) { f_out_ << " " << ( * arg_iter ) -> get_name ( ) ; f_out_ << " " ; f_out_ << ( * arg_iter ) -> get_doc ( ) ; f_out_ << " " << endl ; } f_out_ << " " ; } } has_docs = false ; vector < t_field * > excepts = tfunction -> get_xceptions ( ) -> get_members ( ) ; vector < t_field * > :: iterator ex_iter = excepts . begin ( ) ; if ( ex_iter != excepts . end ( ) ) { for ( ; ex_iter != excepts . end ( ) ; ex_iter ++ ) { if ( ( * ex_iter ) -> has_doc ( ) && ! ( * ex_iter ) -> get_doc ( ) . empty ( ) ) has_docs = true ; } if ( has_docs ) { ex_iter = excepts . begin ( ) ; f_out_ << " \" " << service_name_ << " " << tfunction -> get_name ( ) << " \" " << endl ; f_out_ << " \" \" " ; f_out_ << " " ; for ( ; ex_iter != excepts . end ( ) ; ex_iter ++ ) { f_out_ << " " << ( * ex_iter ) -> get_type ( ) -> get_name ( ) ; f_out_ << " " ; f_out_ << ( * ex_iter ) -> get_doc ( ) ; f_out_ << " " << endl ; } f_out_ << " " ; } } }
Prints out documentation for arguments/exceptions of a function, if any documentation has been supplied.
Prints out documentation for arguments / exceptions of a function if any documentation has been supplied .