From c17ad76595c679f8f0bed93bd9b1a57bcafd0187 Mon Sep 17 00:00:00 2001 From: mes5k Date: Fri, 13 Feb 2004 23:21:38 +0000 Subject: [PATCH] now the Arg adds itself to the CmdLine arglist --- include/tclap/Arg.h | 6 ++++++ include/tclap/UnlabeledMultiArg.h | 11 +++++++++++ include/tclap/UnlabeledValueArg.h | 11 +++++++++++ 3 files changed, 28 insertions(+) diff --git a/include/tclap/Arg.h b/include/tclap/Arg.h index ef5c902..da36513 100644 --- a/include/tclap/Arg.h +++ b/include/tclap/Arg.h @@ -132,6 +132,12 @@ class Arg void _checkWithVisitor() const; public: + + /** + * Adds this to the specified list of Args. + * \param argList - The list to add this to. + */ + virtual void addToList( list& argList ) const; /** * Begin ignoring arguments since the "--" argument was specified. diff --git a/include/tclap/UnlabeledMultiArg.h b/include/tclap/UnlabeledMultiArg.h index 558f266..1aadc24 100644 --- a/include/tclap/UnlabeledMultiArg.h +++ b/include/tclap/UnlabeledMultiArg.h @@ -91,6 +91,11 @@ class UnlabeledMultiArg : public MultiArg */ virtual bool operator==(const Arg& a) const; + /** + * Pushes this to back of list rather than front. + * \param argList - The list this should be added to. + */ + virtual void addToList( list& argList ) const; }; template @@ -142,6 +147,12 @@ bool UnlabeledMultiArg::operator==(const Arg& a) const return false; } +template +void UnlabeledMultiArg::addToList( list& argList ) const +{ + argList.push_back( (Arg*)this ); +} + } #endif diff --git a/include/tclap/UnlabeledValueArg.h b/include/tclap/UnlabeledValueArg.h index 478d6ff..8fb7e67 100644 --- a/include/tclap/UnlabeledValueArg.h +++ b/include/tclap/UnlabeledValueArg.h @@ -101,6 +101,11 @@ class UnlabeledValueArg : public ValueArg */ virtual bool operator==(const Arg& a ) const; + /** + * Instead of pushing to the front of list, push to the back. + * \param argList - The list to add this to. + */ + virtual void addToList( list& argList ) const; }; /** @@ -175,5 +180,11 @@ bool UnlabeledValueArg::operator==(const Arg& a ) const return false; } +template +void UnlabeledValueArg::addToList( list& argList ) const +{ + argList.push_back( (Arg*)this ); +} + } #endif