libopenfpga/libopenfpgashell/src/command.cpp
/* Add a short name to an option */
Add a short name to an option
Add a short name to an option
bool Command::set_option_short_name(const CommandOptionId& option_id, 
                                    const char* short_name) {
  VTR_ASSERT(true == valid_option_id(option_id));
  if (true == std::string(short_name).empty()) {
    return false;
  }
  std::map<std::string, CommandOptionId>::const_iterator short_name_it = option_short_name2ids_.find(std::string(short_name));
  if (short_name_it != option_short_name2ids_.end()) {
    return false;
  }
  option_short_names_[option_id] = std::string(short_name);
  option_short_name2ids_[std::string(short_name)] = option_id;
  return true;
}
bool Command :: set_option_short_name ( const CommandOptionId & option_id , const char * short_name ) { VTR_ASSERT ( true == valid_option_id ( option_id ) ) ; if ( true == std :: string ( short_name ) . empty ( ) ) { return false ; } std :: map < std :: string , CommandOptionId > :: const_iterator short_name_it = option_short_name2ids_ . find ( std :: string ( short_name ) ) ; if ( short_name_it != option_short_name2ids_ . end ( ) ) { return false ; } option_short_names_ [ option_id ] = std :: string ( short_name ) ; option_short_name2ids_ [ std :: string ( short_name ) ] = option_id ; return true ; }
Add a short name to an option
Add a short name to an option
/* Validate the option id */ /* Short name is optional, so do the following only when it is not empty
   * Ensure that the short name is unique in the option list 
   */ /* Short name is optional, so register it only when it is not empty */