diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h index b23f5b4..8fcb607 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h @@ -88,8 +88,30 @@ class CmdLine */ bool _emptyCombined(const string& s); + private: + + /** + * Encapsulates the code common to the constructors (which is all + * of it). + */ + void _constructor(); + public: + /** + * Command line constructor. DEPRECATED!!! This is here to maintain + * backwards compatibility with earlier releases. Note that the + * program name will be overwritten with argv[0]. The delimiter + * used is ' ' (as before). + * \param name - The program name - will be overwritten with argv[0]. + * \param message - The message to be used in the usage output. + * \param version - The version number to be used in the + * --version switch. + */ + CmdLine(const string& name, + const string& message, + const string& version = "none" ); + /** * Command line constructor. Defines how the arguments will be * parsed. diff --git a/src/CmdLine.cpp b/src/CmdLine.cpp index e9af286..a72a3ed 100644 --- a/src/CmdLine.cpp +++ b/src/CmdLine.cpp @@ -24,12 +24,27 @@ namespace TCLAP { +CmdLine::CmdLine(const string& n, const string& m, const string& v ) +: _progName(n), + _message(m), + _version(v), + _numRequired(0), + _delimiter(' ') +{ + _constructor(); +} + CmdLine::CmdLine(const string& m, char delim, const string& v ) : _progName("not_set_yet"), _message(m), _version(v), _numRequired(0), _delimiter(delim) +{ + _constructor(); +} + +void CmdLine::_constructor() { Arg::setDelimiter( _delimiter );