compiler/cpp/src/generate/t_hs_generator.cc
/**
 * Converts the parse type to a Protocol.t_type enum
 */
Converts the parse type to a Protocol.t_type enum
Converts the parse type to a Protocol . t_type enum
string t_hs_generator::type_to_enum(t_type* type) {
  type = get_true_type(type);
  if (type->is_base_type()) {
    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
    switch (tbase) {
    case t_base_type::TYPE_VOID:   return "T_VOID";
    case t_base_type::TYPE_STRING: return "T_STRING";
    case t_base_type::TYPE_BOOL:   return "T_BOOL";
    case t_base_type::TYPE_BYTE:   return "T_BYTE";
    case t_base_type::TYPE_I16:    return "T_I16";
    case t_base_type::TYPE_I32:    return "T_I32";
    case t_base_type::TYPE_I64:    return "T_I64";
    case t_base_type::TYPE_DOUBLE: return "T_DOUBLE";
    }
  } else if (type->is_enum()) {
    return "T_I32";
  } else if (type->is_struct() || type->is_xception()) {
    return "T_STRUCT";
  } else if (type->is_map()) {
    return "T_MAP";
  } else if (type->is_set()) {
    return "T_SET";
  } else if (type->is_list()) {
    return "T_LIST";
  }
  throw "INVALID TYPE IN type_to_enum: " + type->get_name();
}
string t_hs_generator :: type_to_enum ( t_type * type ) { type = get_true_type ( type ) ; if ( type -> is_base_type ( ) ) { t_base_type :: t_base tbase = ( ( t_base_type * ) type ) -> get_base ( ) ; switch ( tbase ) { case t_base_type :: TYPE_VOID : return " " ; case t_base_type :: TYPE_STRING : return " " ; case t_base_type :: TYPE_BOOL : return " " ; case t_base_type :: TYPE_BYTE : return " " ; case t_base_type :: TYPE_I16 : return " " ; case t_base_type :: TYPE_I32 : return " " ; case t_base_type :: TYPE_I64 : return " " ; case t_base_type :: TYPE_DOUBLE : return " " ; } } else if ( type -> is_enum ( ) ) { return " " ; } else if ( type -> is_struct ( ) || type -> is_xception ( ) ) { return " " ; } else if ( type -> is_map ( ) ) { return " " ; } else if ( type -> is_set ( ) ) { return " " ; } else if ( type -> is_list ( ) ) { return " " ; } throw " " + type -> get_name ( ) ; }
Converts the parse type to a Protocol.t_type enum
Converts the parse type to a Protocol . t_type enum