Class MultiSwitchArg

Inheritance Relationships

Base Type

Class Documentation

class MultiSwitchArg : public ecl::SwitchArg

A multiple switch argument. If the switch is set on the command line, then the getValue method will return the number of times the switch appears.

Public Functions

inline MultiSwitchArg(const std::string &flag, const std::string &name, const std::string &desc, int init = 0, Visitor *v = NULL)

MultiSwitchArg constructor.

Parameters:
  • flag – - The one character flag that identifies this argument on the command line.

  • name – - A one word name for the argument. Can be used as a long flag on the command line.

  • desc – - A description of what the argument is for or does.

  • init – - Optional. The initial/default value of this Arg. Defaults to 0.

  • v – - An optional visitor. You probably should not use this unless you have a very good reason.

inline MultiSwitchArg(const std::string &flag, const std::string &name, const std::string &desc, CmdLineInterface &parser, int init = 0, Visitor *v = NULL)

MultiSwitchArg constructor.

Parameters:
  • flag – - The one character flag that identifies this argument on the command line.

  • name – - A one word name for the argument. Can be used as a long flag on the command line.

  • desc – - A description of what the argument is for or does.

  • parser – - A CmdLine parser object to add this Arg to

  • init – - Optional. The initial/default value of this Arg. Defaults to 0.

  • v – - An optional visitor. You probably should not use this unless you have a very good reason.

inline virtual bool processArg(int *i, std::vector<std::string> &args)

Handles the processing of the argument. This re-implements the SwitchArg version of this method to set the _value of the argument appropriately.

Parameters:
  • i – - Pointer the the current argument in the list.

  • args – - Mutable list of strings. Passed in from main().

inline int getValue()

Returns int, the number of times the switch has been set.

inline virtual std::string shortID(const std::string &val) const

Returns the shortID for this Arg.

inline virtual std::string longID(const std::string &val) const

Returns the longID for this Arg.

Protected Attributes

int _value

The value of the switch.