compiler/cpp/src/generate/t_html_generator.cc
/**
 * Prints out an HTML representation of the provided constant value
 */
Prints out an HTML representation of the provided constant value
Prints out an HTML representation of the provided constant value
void t_html_generator::print_const_value(t_const_value* tvalue) {
  bool first = true;
  switch (tvalue->get_type()) {
  case t_const_value::CV_INTEGER:
    f_out_ << tvalue->get_integer();
    break;
  case t_const_value::CV_DOUBLE:
    f_out_ << tvalue->get_double();
    break;
  case t_const_value::CV_STRING:
    f_out_ << '"' << get_escaped_string(tvalue) << '"';
    break;
  case t_const_value::CV_MAP:
    {
      f_out_ << "{ ";
      map<t_const_value*, t_const_value*> map_elems = tvalue->get_map();
      map<t_const_value*, t_const_value*>::iterator map_iter;
      for (map_iter = map_elems.begin(); map_iter != map_elems.end(); map_iter++) {
        if (!first) {
          f_out_ << ", ";
        }
        first = false;
        print_const_value(map_iter->first);
        f_out_ << " = ";
        print_const_value(map_iter->second);
      }
      f_out_ << " }";
    }
    break;
  case t_const_value::CV_LIST:
    {
      f_out_ << "{ ";
      vector<t_const_value*> list_elems = tvalue->get_list();;
      vector<t_const_value*>::iterator list_iter;
      for (list_iter = list_elems.begin(); list_iter != list_elems.end(); list_iter++) {
        if (!first) {
          f_out_ << ", ";
        }
        first = false;
        print_const_value(*list_iter);
      }
      f_out_ << " }";
    }
    break;
  default:
    f_out_ << "UNKNOWN";
    break;
  }
}
void t_html_generator :: print_const_value ( t_const_value * tvalue ) { bool first = true ; switch ( tvalue -> get_type ( ) ) { case t_const_value :: CV_INTEGER : f_out_ << tvalue -> get_integer ( ) ; break ; case t_const_value :: CV_DOUBLE : f_out_ << tvalue -> get_double ( ) ; break ; case t_const_value :: CV_STRING : f_out_ << ' ' << get_escaped_string ( tvalue ) << ' ' ; break ; case t_const_value :: CV_MAP : { f_out_ << " " ; map < t_const_value * , t_const_value * > map_elems = tvalue -> get_map ( ) ; map < t_const_value * , t_const_value * > :: iterator map_iter ; for ( map_iter = map_elems . begin ( ) ; map_iter != map_elems . end ( ) ; map_iter ++ ) { if ( ! first ) { f_out_ << " " ; } first = false ; print_const_value ( map_iter -> first ) ; f_out_ << " " ; print_const_value ( map_iter -> second ) ; } f_out_ << " " ; } break ; case t_const_value :: CV_LIST : { f_out_ << " " ; vector < t_const_value * > list_elems = tvalue -> get_list ( ) ; ; vector < t_const_value * > :: iterator list_iter ; for ( list_iter = list_elems . begin ( ) ; list_iter != list_elems . end ( ) ; list_iter ++ ) { if ( ! first ) { f_out_ << " " ; } first = false ; print_const_value ( * list_iter ) ; } f_out_ << " " ; } break ; default : f_out_ << " " ; break ; } }
Prints out an HTML representation of the provided constant value
Prints out an HTML representation of the provided constant value