15 #ifndef TCLAP_STDCMDLINEOUTPUT_H 16 #define TCLAP_STDCMDLINEOUTPUT_H 98 int secondLineOffset )
const;
106 std::string interface_version = _cmd.
getVersion();
108 std::cout << std::endl << progName <<
" version: " 109 << interface_version << std::endl << std::endl;
114 std::cout << std::endl <<
"USAGE: " << std::endl << std::endl;
118 std::cout << std::endl << std::endl <<
"Where: " << std::endl << std::endl;
122 std::cout << std::endl;
131 std::cerr <<
"PARSE ERROR: " << e.
argId() << std::endl
132 <<
" " << e.
error() << std::endl << std::endl;
136 std::cerr <<
"Brief USAGE: " << std::endl;
140 std::cerr << std::endl <<
"For complete USAGE and HELP type: " 141 << std::endl <<
" " << progName <<
" --help" 142 << std::endl << std::endl;
150 std::ostream& os )
const 155 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
157 std::string s = progName +
" ";
160 for (
int i = 0;
static_cast<unsigned int>(i) < xorList.size(); i++ )
164 it != xorList[i].end(); it++ )
165 s += (*it)->shortID() +
"|";
167 s[s.length()-1] =
'}';
172 if ( !xorHandler.
contains( (*it) ) )
173 s +=
" " + (*it)->shortID();
176 int secondLineOffset =
static_cast<int>(progName.length()) + 2;
177 if ( secondLineOffset > 75/2 )
178 secondLineOffset =
static_cast<int>(75/2);
185 std::ostream& os )
const 190 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
193 for (
int i = 0;
static_cast<unsigned int>(i) < xorList.size(); i++ )
196 it != xorList[i].end();
200 spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
202 if ( it+1 != xorList[i].end() )
205 os << std::endl << std::endl;
210 if ( !xorHandler.
contains( (*it) ) )
213 spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
223 const std::string& s,
226 int secondLineOffset )
const 228 int len =
static_cast<int>(s.length());
230 if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
232 int allowedLen = maxWidth - indentSpaces;
234 while ( start < len )
237 int stringLen = std::min<int>( len - start, allowedLen );
240 if ( stringLen == allowedLen )
241 while ( s[stringLen+start] !=
' ' &&
242 s[stringLen+start] !=
',' &&
243 s[stringLen+start] !=
'|' &&
249 if ( stringLen <= 0 )
250 stringLen = allowedLen;
253 for (
int i = 0; i < stringLen; i++ )
254 if ( s[start+i] ==
'\n' )
258 for (
int i = 0; i < indentSpaces; i++ )
264 indentSpaces += secondLineOffset;
267 allowedLen -= secondLineOffset;
270 os << s.substr(start,stringLen) << std::endl;
273 while ( s[stringLen+start] ==
' ' && start < len )
281 for (
int i = 0; i < indentSpaces; i++ )
283 os << s << std::endl;
TCLAP command line argument parser classes.
virtual void usage(CmdLineInterface &c)
std::string error() const
virtual std::string & getVersion()=0
Tclap class indirectly used by children for standardising outputs.
Managing interface for The base class that manages the command line definition and passes along the p...
std::list< Arg * >::iterator ArgListIterator
virtual std::list< Arg * > & getArgList()=0
std::vector< std::vector< Arg * > > & getXorList()
Defines the exception that is thrown whenever a command line is created and parsed.
void _longUsage(CmdLineInterface &c, std::ostream &os) const
virtual XorHandler & getXorHandler()=0
std::vector< Arg * >::iterator ArgVectorIterator
virtual std::string & getMessage()=0
TCLAP command line argument parser classes.
virtual bool hasHelpAndVersion()=0
TCLAP command line argument parser classes.
TClap class indirectly used by CmdLine for handling xor'd arguments.
void _shortUsage(CmdLineInterface &c, std::ostream &os) const
bool contains(const Arg *a)
TCLAP command line argument parser classes.
virtual void version(CmdLineInterface &c)
std::string argId() const
virtual void failure(CmdLineInterface &c, ArgException &e)
virtual std::string & getProgramName()=0
void spacePrint(std::ostream &os, const std::string &s, int maxWidth, int indentSpaces, int secondLineOffset) const
TClap class indirectly used to handle CmdLine arguments.