24 #ifndef TCLAP_STDCMDLINEOUTPUT_H 
   25 #define TCLAP_STDCMDLINEOUTPUT_H 
  101                          const std::string& s, 
 
  104                          int secondLineOffset ) 
const;
 
  114     std::cout << std::endl << progName << 
"  version: "  
  115               << xversion << std::endl << std::endl;
 
  120     std::cout << std::endl << 
"USAGE: " << std::endl << std::endl; 
 
  124     std::cout << std::endl << std::endl << 
"Where: " << std::endl << std::endl;
 
  128     std::cout << std::endl; 
 
  137     std::cerr << 
"PARSE ERROR: " << e.
argId() << std::endl
 
  138               << 
"             " << e.
error() << std::endl << std::endl;
 
  142             std::cerr << 
"Brief USAGE: " << std::endl;
 
  146             std::cerr << std::endl << 
"For complete USAGE and HELP type: "  
  147                       << std::endl << 
"   " << progName << 
" " 
  149                       << std::endl << std::endl;
 
  159                         std::ostream& os )
 const 
  164     std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
 
  166     std::string s = progName + 
" ";
 
  169     for ( 
int i = 0; 
static_cast<unsigned int>(i) < xorList.size(); i++ )
 
  173                   it != xorList[i].end(); it++ )
 
  174                 s += (*it)->shortID() + 
"|";
 
  176             s[s.length()-1] = 
'}';
 
  181         if ( !xorHandler.
contains( (*it) ) )
 
  182             s += 
" " + (*it)->shortID();
 
  185     int secondLineOffset = 
static_cast<int>(progName.length()) + 2;
 
  186     if ( secondLineOffset > 75/2 )
 
  187         secondLineOffset = 
static_cast<int>(75/2);
 
  194                        std::ostream& os )
 const 
  199     std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
 
  202     for ( 
int i = 0; 
static_cast<unsigned int>(i) < xorList.size(); i++ )
 
  205                   it != xorList[i].end(); 
 
  209                     spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
 
  211                     if ( it+1 != xorList[i].end() )
 
  214             os << std::endl << std::endl;
 
  219         if ( !xorHandler.
contains( (*it) ) )
 
  222                 spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); 
 
  232                                    const std::string& s, 
 
  235                                    int secondLineOffset )
 const 
  237     int len = 
static_cast<int>(s.length());
 
  239     if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
 
  241             int allowedLen = maxWidth - indentSpaces;
 
  243             while ( start < len )
 
  249                     int stringLen = min<int>( len - start, allowedLen );
 
  252                     if ( stringLen == allowedLen )
 
  253                         while ( stringLen >= 0 &&
 
  254                                 s[stringLen+start] != 
' ' && 
 
  255                                 s[stringLen+start] != 
',' &&
 
  256                                 s[stringLen+start] != 
'|' ) 
 
  261                     if ( stringLen <= 0 )
 
  262                         stringLen = allowedLen;
 
  265                     for ( 
int i = 0; i < stringLen; i++ )
 
  266                         if ( s[start+i] == 
'\n' )
 
  270                     for ( 
int i = 0; i < indentSpaces; i++ )
 
  276                             indentSpaces += secondLineOffset;
 
  279                             allowedLen -= secondLineOffset;
 
  282                     os << s.substr(start,stringLen) << std::endl;
 
  285                     while ( s[stringLen+start] == 
' ' && start < len )
 
  293             for ( 
int i = 0; i < indentSpaces; i++ )
 
  295             os << s << std::endl;
 
A simple class that defines and argument exception.
std::string argId() const
Returns the argument id.
std::string error() const
Returns the error text.
static const std::string nameStartString()
The base class that manages the command line definition and passes along the parsing to the appropria...
virtual std::string & getVersion()=0
Returns the version string.
virtual XorHandler & getXorHandler()=0
Returns the XorHandler.
virtual std::string & getProgramName()=0
Returns the program name string.
virtual std::string & getMessage()=0
Returns the message string.
virtual bool hasHelpAndVersion()=0
Indicates whether or not the help and version switches were created automatically.
virtual std::list< Arg * > & getArgList()=0
Returns the argList.
The interface that any output object must implement.
Thrown when TCLAP thinks the program should exit.
A class that isolates any output from the CmdLine object so that it may be easily modified.
void spacePrint(std::ostream &os, const std::string &s, int maxWidth, int indentSpaces, int secondLineOffset) const
This function inserts line breaks and indents long strings according the params input.
virtual void version(CmdLineInterface &c)
Prints the version to stdout.
virtual void failure(CmdLineInterface &c, ArgException &e)
Prints (to stderr) an error message, short usage Can be overridden to produce alternative behavior.
void _shortUsage(CmdLineInterface &c, std::ostream &os) const
Writes a brief usage message with short args.
void _longUsage(CmdLineInterface &c, std::ostream &os) const
Writes a longer usage message with long and short args, provides descriptions and prints message.
virtual void usage(CmdLineInterface &c)
Prints the usage to stdout.
This class handles lists of Arg's that are to be XOR'd on the command line.
bool contains(const Arg *a)
Simply checks whether the Arg is contained in one of the arg lists.
const std::vector< std::vector< Arg * > > & getXorList() const
std::vector< Arg * >::const_iterator ArgVectorIterator
Typedef of an Arg vector iterator.
std::list< Arg * >::const_iterator ArgListIterator
Typedef of an Arg list iterator.