21  { 
setOptions( std::move(options_r), defaultOpt_r ); }
 
 
   36    if ( 
_options.size() <= defaultOpt_r )
 
   38      INT << 
"Invalid default option index " << defaultOpt_r << std::endl;
 
 
   58    std::ostringstream 
str;
 
   61    const char * slash = 
"";    
 
   62    for ( 
unsigned idx = 0; idx < 
_options.size(); ++idx )
 
   67      if ( shown < showmax )
 
   70        if ( !shown ) slash = 
"/";
 
   85        str << 
" " << 
_(
"shows all options");
 
 
   99    if ( help_str.empty() )
 
  104      WAR << 
"attempt to set option help for non-existing option." 
  105          << 
" text: " << help_str << std::endl;
 
 
  119    std::vector<int> ret;
 
  122    if ( reply_r[0] == 
'#' && reply_r[1] != 
'\0' )
 
  125      for ( 
const char * cp = reply_r.c_str()+1; *cp; ++cp )
 
  127        if ( 
'0' <= *cp && *cp <= 
'9' )
 
  139      if ( num != 
unsigned(-1) )
 
  144          for ( 
unsigned i = 0; i < 
_options.size(); ++i )
 
  162    for ( 
unsigned i = 0; i < 
_options.size(); ++i )
 
  169      if ( lopt == lreply ) {   
 
 
  184    const char * sep = 
"(";     
 
  185    for ( 
unsigned idx : matches_r )
 
  188      if ( *sep != 
',' ) sep =
",";
 
 
unsigned _default
index of the default option
const StrVector & options() const
bool isYesNoPrompt() const
ColorString optionString() const
Option string (may have embedded color codes)
int _shown_count
Number of options to show (the rest will still be available and visible through '?
std::vector< int > getReplyMatches(const std::string &reply_r) const
Return the indices of option string matches (lowercase/prefix or NUM).
std::string replyMatchesStr(const std::vector< int > &matches_r) const
The returned reply matches as '(,)' list.
PromptOptions()
Default c-tor.
StrVector _opt_help
help strings corresponding to options
bool isDisabled(unsigned opt) const
StrVector _options
option strings
std::vector< std::string > StrVector
void setOptionHelp(unsigned opt, const std::string &help_str)
void setOptions(StrVector options_r, unsigned defaultOpt_r)
Colored string if do_colors.
String related utilities and Regular expression matching.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
std::string toLower(const std::string &s)
Return lowercase version of s.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...