made processArg pure virtual

This commit is contained in:
mes5k 2004-10-14 17:19:27 +00:00
parent cd1bf5af14
commit 706f0b28b7

View File

@ -36,10 +36,9 @@
namespace TCLAP { namespace TCLAP {
/** /**
* A base class that defines the essential data for all arguments. * A virtual base class that defines the essential data for all arguments.
* This is not an abstract class, although it can't really be used * This class, or one of its existing children, must be subclassed to do
* because the processArg() method just emits a warning. Arg, or one * anything.
* of its existing children, should be subclassed for new behavior.
*/ */
class Arg class Arg
{ {
@ -215,17 +214,13 @@ class Arg
static void setDelimiter( char c ) { delimiterRef() = c; } static void setDelimiter( char c ) { delimiterRef() = c; }
/** /**
* Processes the argument. * Pure virtual method meant to handle the parsing and value assignment
* This is the method that handles the parsing and value assignment * of the string on the command line.
* of the string on the command line. This implementation just
* emits that an argument has matched and is being ignored. This
* should never really be used, any subclass should implement its
* own version of processArg.
* \param i - Pointer the the current argument in the list. * \param i - Pointer the the current argument in the list.
* \param args - Mutable list of strings. What is * \param args - Mutable list of strings. What is
* passed in from main. * passed in from main.
*/ */
virtual bool processArg(int *i, std::vector<std::string>& args); virtual bool processArg(int *i, std::vector<std::string>& args) = 0;
/** /**
* Operator ==. * Operator ==.
@ -442,14 +437,6 @@ inline bool Arg::operator==(const Arg& a)
return false; return false;
} }
// should be overridden
inline bool Arg::processArg(int* i, std::vector<std::string>& args)
{
std::cerr << "WARNING: Ignoring unknown argument: "
<< args[*i] << std::endl;
return false;
}
inline std::string Arg::getDescription() const inline std::string Arg::getDescription() const
{ {
std::string desc = ""; std::string desc = "";