diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-05 10:54:12 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-05 11:10:14 +0900 |
commit | 430373ae38565e0d7f62b8fca0cbad73de73ec7f (patch) | |
tree | 670a7322ddd2732c8824b1fb73090b937e2a1f82 /src/tclap/MultiSwitchArg.h | |
parent | d833de5bbe40d780fe02dc95d1c981a4b1007108 (diff) | |
download | universal-indent-gui-tqt-430373ae38565e0d7f62b8fca0cbad73de73ec7f.tar.gz universal-indent-gui-tqt-430373ae38565e0d7f62b8fca0cbad73de73ec7f.zip |
Format code using uncrustify
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/tclap/MultiSwitchArg.h')
-rw-r--r--[-rwxr-xr-x] | src/tclap/MultiSwitchArg.h | 319 |
1 files changed, 152 insertions, 167 deletions
diff --git a/src/tclap/MultiSwitchArg.h b/src/tclap/MultiSwitchArg.h index 8820b64..33cd144 100755..100644 --- a/src/tclap/MultiSwitchArg.h +++ b/src/tclap/MultiSwitchArg.h @@ -1,5 +1,4 @@ - -/****************************************************************************** +/****************************************************************************** * * file: MultiSwitchArg.h * @@ -30,187 +29,173 @@ #include <tclap/SwitchArg.h> -namespace TCLAP { - -/** -* 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. -*/ -class MultiSwitchArg : public SwitchArg +namespace TCLAP { - protected: - - /** - * The value of the switch. - */ - int _value; - - /** - * Used to support the reset() method so that ValueArg can be - * reset to their constructed value. - */ - int _default; - - public: - - /** - * MultiSwitchArg constructor. - * \param flag - The one character flag that identifies this - * argument on the command line. - * \param name - A one word name for the argument. Can be - * used as a long flag on the command line. - * \param desc - A description of what the argument is for or - * does. - * \param init - Optional. The initial/default value of this Arg. - * Defaults to 0. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - int init = 0, - Visitor* v = NULL); - - - /** - * MultiSwitchArg constructor. - * \param flag - The one character flag that identifies this - * argument on the command line. - * \param name - A one word name for the argument. Can be - * used as a long flag on the command line. - * \param desc - A description of what the argument is for or - * does. - * \param parser - A CmdLine parser object to add this Arg to - * \param init - Optional. The initial/default value of this Arg. - * Defaults to 0. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - CmdLineInterface& parser, - int init = 0, - Visitor* v = NULL); - - - /** - * Handles the processing of the argument. - * This re-implements the SwitchArg version of this method to set the - * _value of the argument appropriately. - * \param i - Pointer the the current argument in the list. - * \param args - Mutable list of strings. Passed - * in from main(). - */ - virtual bool processArg(int* i, std::vector<std::string>& args); - - /** - * Returns int, the number of times the switch has been set. - */ - int getValue(); - - /** - * Returns the shortID for this Arg. - */ - std::string shortID(const std::string& val) const; - - /** - * Returns the longID for this Arg. - */ - std::string longID(const std::string& val) const; - - void reset(); - -}; - -////////////////////////////////////////////////////////////////////// -//BEGIN MultiSwitchArg.cpp -////////////////////////////////////////////////////////////////////// -inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - int init, - Visitor* v ) -: SwitchArg(flag, name, desc, false, v), -_value( init ), -_default( init ) -{ } - -inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - CmdLineInterface& parser, - int init, - Visitor* v ) -: SwitchArg(flag, name, desc, false, v), -_value( init ), -_default( init ) -{ - parser.add( this ); -} - -inline int MultiSwitchArg::getValue() { return _value; } - -inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; - - if ( argMatches( args[*i] )) + /** + * 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. + */ + class MultiSwitchArg : public SwitchArg { - // so the isSet() method will work - _alreadySet = true; - - // Matched argument: increment value. - ++_value; + protected: + /** + * The value of the switch. + */ + int _value; + + /** + * Used to support the reset() method so that ValueArg can be + * reset to their constructed value. + */ + int _default; + + public: + /** + * MultiSwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string &flag, const std::string &name, const std::string &desc, + int init = 0, Visitor *v = NULL); + + + /** + * MultiSwitchArg constructor. + * \param flag - The one character flag that identifies this + * argument on the command line. + * \param name - A one word name for the argument. Can be + * used as a long flag on the command line. + * \param desc - A description of what the argument is for or + * does. + * \param parser - A CmdLine parser object to add this Arg to + * \param init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string &flag, const std::string &name, const std::string &desc, + CmdLineInterface &parser, int init = 0, Visitor *v = NULL); + + + /** + * Handles the processing of the argument. + * This re-implements the SwitchArg version of this method to set the + * _value of the argument appropriately. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. Passed + * in from main(). + */ + virtual bool processArg(int *i, std::vector<std::string> &args); + + /** + * Returns int, the number of times the switch has been set. + */ + int getValue(); + + /** + * Returns the shortID for this Arg. + */ + std::string shortID(const std::string &val) const; + + /** + * Returns the longID for this Arg. + */ + std::string longID(const std::string &val) const; + + void reset(); + }; + + ////////////////////////////////////////////////////////////////////// + //BEGIN MultiSwitchArg.cpp + ////////////////////////////////////////////////////////////////////// + inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, const std::string &name, + const std::string &desc, int init, Visitor *v) : + SwitchArg(flag, name, desc, false, v), _value(init), _default(init) + { + } - _checkWithVisitor(); + inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, const std::string &name, + const std::string &desc, CmdLineInterface &parser, int init, + Visitor *v) : + SwitchArg(flag, name, desc, false, v), _value(init), _default(init) + { + parser.add(this); + } - return true; + inline int MultiSwitchArg::getValue() + { + return _value; } - else if ( combinedSwitchesMatch( args[*i] ) ) + + inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string> &args) { - // so the isSet() method will work - _alreadySet = true; + if (_ignoreable && Arg::ignoreRest()) + { + return false; + } - // Matched argument: increment value. - ++_value; + if (argMatches(args[*i])) + { + // so the isSet() method will work + _alreadySet = true; - // Check for more in argument and increment value. - while ( combinedSwitchesMatch( args[*i] ) ) + // Matched argument: increment value. ++_value; - _checkWithVisitor(); + _checkWithVisitor(); - return false; - } - else - return false; -} + return true; + } + else if (combinedSwitchesMatch(args[*i])) + { + // so the isSet() method will work + _alreadySet = true; -inline std::string -MultiSwitchArg::shortID(const std::string& val) const -{ - return Arg::shortID(val) + " ... "; -} + // Matched argument: increment value. + ++_value; -inline std::string -MultiSwitchArg::longID(const std::string& val) const -{ - return Arg::longID(val) + " (accepted multiple times)"; -} + // Check for more in argument and increment value. + while (combinedSwitchesMatch(args[*i])) + { + ++_value; + } -inline void -MultiSwitchArg::reset() -{ - MultiSwitchArg::_value = MultiSwitchArg::_default; -} + _checkWithVisitor(); -////////////////////////////////////////////////////////////////////// -//END MultiSwitchArg.cpp -////////////////////////////////////////////////////////////////////// + return false; + } + else + { + return false; + } + } + + inline std::string MultiSwitchArg::shortID(const std::string &val) const + { + return Arg::shortID(val) + " ... "; + } + + inline std::string MultiSwitchArg::longID(const std::string &val) const + { + return Arg::longID(val) + " (accepted multiple times)"; + } + + inline void MultiSwitchArg::reset() + { + MultiSwitchArg::_value = MultiSwitchArg::_default; + } + ////////////////////////////////////////////////////////////////////// + //END MultiSwitchArg.cpp + ////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif |