compiler/cpp/src/generate/t_html_generator.cc
/**
 * Emits the Table of Contents links at the top of the module's page
 */
Emits the Table of Contents links at the top of the module's page
Emits the Table of Contents links at the top of the module ' s page
void t_html_generator::generate_program_toc_row(t_program* tprog) {
  string fname = tprog->get_name() + ".html";
  f_out_ << "<tr>" << endl << "<td>" << tprog->get_name() << "</td><td>";
  if (!tprog->get_services().empty()) {
    vector<t_service*> services = tprog->get_services();
    vector<t_service*>::iterator sv_iter;
    for (sv_iter = services.begin(); sv_iter != services.end(); ++sv_iter) {
      string name = get_service_name(*sv_iter);
      f_out_ << "<a href=\"" << fname << "#Svc_" << name << "\">" << name
        << "</a><br/>" << endl;
      f_out_ << "<ul>" << endl;
      map<string,string> fn_html;
      vector<t_function*> functions = (*sv_iter)->get_functions();
      vector<t_function*>::iterator fn_iter;
      for (fn_iter = functions.begin(); fn_iter != functions.end(); ++fn_iter) {
        string fn_name = (*fn_iter)->get_name();
        string html = "<li><a href=\"" + fname + "#Fn_" + name + "_" +
          fn_name + "\">" + fn_name + "</a></li>";
        fn_html.insert(pair<string,string>(fn_name, html));
      }
      for (map<string,string>::iterator html_iter = fn_html.begin();
        html_iter != fn_html.end(); html_iter++) {
        f_out_ << html_iter->second << endl;
      }
      f_out_ << "</ul>" << endl;
    }
  }
  f_out_ << "</td>" << endl << "<td>";
  map<string,string> data_types;
  if (!tprog->get_enums().empty()) {
    vector<t_enum*> enums = tprog->get_enums();
    vector<t_enum*>::iterator en_iter;
    for (en_iter = enums.begin(); en_iter != enums.end(); ++en_iter) {
      string name = (*en_iter)->get_name();
      string html = "<a href=\"" + fname + "#Enum_" + name + "\">" + name +
        "</a>";
      data_types.insert(pair<string,string>(name, html));
    }
  }
  if (!tprog->get_typedefs().empty()) {
    vector<t_typedef*> typedefs = tprog->get_typedefs();
    vector<t_typedef*>::iterator td_iter;
    for (td_iter = typedefs.begin(); td_iter != typedefs.end(); ++td_iter) {
      string name = (*td_iter)->get_symbolic();
      string html = "<a href=\"" + fname + "#Typedef_" + name + "\">" + name +
        "</a>";
      data_types.insert(pair<string,string>(name, html));
    }
  }
  if (!tprog->get_objects().empty()) {
    vector<t_struct*> objects = tprog->get_objects();
    vector<t_struct*>::iterator o_iter;
    for (o_iter = objects.begin(); o_iter != objects.end(); ++o_iter) {
      string name = (*o_iter)->get_name();
      string html = "<a href=\"" + fname + "#Struct_" + name + "\">" + name +
        "</a>";
      data_types.insert(pair<string,string>(name, html));
    }
  }
  for (map<string,string>::iterator dt_iter = data_types.begin();
       dt_iter != data_types.end(); dt_iter++) {
    f_out_ << dt_iter->second << "<br/>" << endl;
  }
  f_out_ << "</td>" << endl << "<td>";
  if (!tprog->get_consts().empty()) {
    map<string,string> const_html;
    vector<t_const*> consts = tprog->get_consts();
    vector<t_const*>::iterator con_iter;
    for (con_iter = consts.begin(); con_iter != consts.end(); ++con_iter) {
      string name = (*con_iter)->get_name();
      string html ="<code><a href=\"" + fname + "#Const_" + name +
        "\">" + name + "</a></code>";
      const_html.insert(pair<string,string>(name, html));
    }
    for (map<string,string>::iterator con_iter = const_html.begin();
   con_iter != const_html.end(); con_iter++) {
      f_out_ << con_iter->second << "<br/>" << endl;
    }
  }
  f_out_ << "</code></td>" << endl << "</tr>";
}
void t_html_generator :: generate_program_toc_row ( t_program * tprog ) { string fname = tprog -> get_name ( ) + " " ; f_out_ << " " << endl << " " << tprog -> get_name ( ) << " " ; if ( ! tprog -> get_services ( ) . empty ( ) ) { vector < t_service * > services = tprog -> get_services ( ) ; vector < t_service * > :: iterator sv_iter ; for ( sv_iter = services . begin ( ) ; sv_iter != services . end ( ) ; ++ sv_iter ) { string name = get_service_name ( * sv_iter ) ; f_out_ << " \" " << fname << " " << name << " \" " << name << " " << endl ; f_out_ << " " << endl ; map < string , string > fn_html ; vector < t_function * > functions = ( * sv_iter ) -> get_functions ( ) ; vector < t_function * > :: iterator fn_iter ; for ( fn_iter = functions . begin ( ) ; fn_iter != functions . end ( ) ; ++ fn_iter ) { string fn_name = ( * fn_iter ) -> get_name ( ) ; string html = " \" " + fname + " " + name + " " + fn_name + " \" " + fn_name + " " ; fn_html . insert ( pair < string , string > ( fn_name , html ) ) ; } for ( map < string , string > :: iterator html_iter = fn_html . begin ( ) ; html_iter != fn_html . end ( ) ; html_iter ++ ) { f_out_ << html_iter -> second << endl ; } f_out_ << " " << endl ; } } f_out_ << " " << endl << " " ; map < string , string > data_types ; if ( ! tprog -> get_enums ( ) . empty ( ) ) { vector < t_enum * > enums = tprog -> get_enums ( ) ; vector < t_enum * > :: iterator en_iter ; for ( en_iter = enums . begin ( ) ; en_iter != enums . end ( ) ; ++ en_iter ) { string name = ( * en_iter ) -> get_name ( ) ; string html = " \" " + fname + " " + name + " \" " + name + " " ; data_types . insert ( pair < string , string > ( name , html ) ) ; } } if ( ! tprog -> get_typedefs ( ) . empty ( ) ) { vector < t_typedef * > typedefs = tprog -> get_typedefs ( ) ; vector < t_typedef * > :: iterator td_iter ; for ( td_iter = typedefs . begin ( ) ; td_iter != typedefs . end ( ) ; ++ td_iter ) { string name = ( * td_iter ) -> get_symbolic ( ) ; string html = " \" " + fname + " " + name + " \" " + name + " " ; data_types . insert ( pair < string , string > ( name , html ) ) ; } } if ( ! tprog -> get_objects ( ) . empty ( ) ) { vector < t_struct * > objects = tprog -> get_objects ( ) ; vector < t_struct * > :: iterator o_iter ; for ( o_iter = objects . begin ( ) ; o_iter != objects . end ( ) ; ++ o_iter ) { string name = ( * o_iter ) -> get_name ( ) ; string html = " \" " + fname + " " + name + " \" " + name + " " ; data_types . insert ( pair < string , string > ( name , html ) ) ; } } for ( map < string , string > :: iterator dt_iter = data_types . begin ( ) ; dt_iter != data_types . end ( ) ; dt_iter ++ ) { f_out_ << dt_iter -> second << " " << endl ; } f_out_ << " " << endl << " " ; if ( ! tprog -> get_consts ( ) . empty ( ) ) { map < string , string > const_html ; vector < t_const * > consts = tprog -> get_consts ( ) ; vector < t_const * > :: iterator con_iter ; for ( con_iter = consts . begin ( ) ; con_iter != consts . end ( ) ; ++ con_iter ) { string name = ( * con_iter ) -> get_name ( ) ; string html = " \" " + fname + " " + name + " \" " + name + " " ; const_html . insert ( pair < string , string > ( name , html ) ) ; } for ( map < string , string > :: iterator con_iter = const_html . begin ( ) ; con_iter != const_html . end ( ) ; con_iter ++ ) { f_out_ << con_iter -> second << " " << endl ; } } f_out_ << " " << endl << " " ; }
Emits the Table of Contents links at the top of the module's page
Emits the Table of Contents links at the top of the module ' s page
// f_out_ << "<a href=\"" << fname << "#Enum_" << name << "\">" << name // <<  "</a><br/>" << endl; // f_out_ << "<a href=\"" << fname << "#Typedef_" << name << "\">" << name // << "</a><br/>" << endl; //f_out_ << "<a href=\"" << fname << "#Struct_" << name << "\">" << name //<< "</a><br/>" << endl;