From 2d34e9d1a1ee38bb1c939f9aac451af66f71d703 Mon Sep 17 00:00:00 2001 From: mes5k Date: Sun, 23 Jan 2005 22:57:54 +0000 Subject: [PATCH] added MultiSwitchArg docs --- docs/manual.html | 42 +++++++++++++++++++++++++++--------------- docs/manual.xml | 35 ++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/docs/manual.html b/docs/manual.html index f11d7c1..59d2b7c 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -1,17 +1,18 @@ -Templatized C++ Command Line Parser Manual

Templatized C++ Command Line Parser Manual

Michael E Smoot


Chapter 1. Basic Usage

TCLAP has a few key classes to be aware of. The first is the CmdLine (command line) class. This class parses the command line passed to it according to the arguments that it contains. Arguments are separate objects that are added to the -CmdLine object one at a time. The five +CmdLine object one at a time. The six argument classes are: ValueArg, UnlabeledValueArg, -SwitchArg, MultiArg and +SwitchArg, MultiSwitchArg, +MultiArg and UnlabeledMultiArg. These classes are templatized, which means they can be defined to parse a value of any type**. Once you add the @@ -228,7 +229,7 @@ to work on Windows, Sun and Alpha platforms. We've made every effort to keep the library compliant with the ANSI C++ standard so if your compiler meets the standard, then this library should work for you. Please let us know if this is not the case! -

Windows Note

+

Windows Note

As we understand things, Visual C++ does not have the file config.h which is used to make platform specific definitions. In this situation, we assume that you @@ -241,7 +242,7 @@ then simply tell your compiler to define the variable should work. We think. Alternatively, just edit the files ValueArg.h and MultiArg.h.

-

Random Note

+

Random Note

If your compiler doesn't support the using syntax used in UnlabeledValueArg and UnlabeledMultiArg to support two stage name lookup, @@ -317,6 +318,22 @@ a ValueArg: Note that MultiArgs can be added to the CmdLine in any order (unlike UnlabeledMultiArg). +

+New Feature! MultiSwitchArg now +allows you to set a switch multiple times on the command line. The call +to getValue() returns the number (int) of times +the switch +has been found on the command line in addition to the default value. +Here is an example using the default initial value of 0: +

+	MultiSwitchArg quiet("q","quiet","Reduce the volume of output");
+	cmd.add( quiet );
+

+Alternatively, you can specify your own initial value: +

+	MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5);
+	cmd.add( quiet );
+

I don't like labelling all of my arguments...

To this point all of our arguments have had labels (flags) indentifying them on the command line, but there are some @@ -621,7 +638,7 @@ example. NOTE: if you supply your own Out will not delete it in the CmdLine destructor. This could lead to a (very small) memory leak if you don't take care of the object yourself. -

Chapter 3. Exceptions to the Rules

+

Chapter 3. Exceptions to the Rules

Like all good rules, there are many exceptions....

Ignoring arguments

The -- flag is automatically included in the @@ -645,14 +662,9 @@ ignore arguments after the --. To accomodate t we can make both UnlabeledValueArgs and UnlabeledMultiArgs ignoreable in their constructors. See the API Documentation for details. -

Multiple Identical Switches

-If you absolutely must allow for multiple, identical switches, then -don't use a SwitchArg, instead use a -MultiArg of type -bool. This means you'll need to specify a 1 or 0 on the -command line with the switch (as values are required), but this -should allow you to turn your favorite switch on and off to your -heart's content. +

Multiple Identical Switches

+No longer a problem! Just use MultiSwitchArg. +There is a description here.

Type Descriptions

Ideally this library would use RTTI to return a human readable name of the type declared for a particular argument. Unfortunately, at diff --git a/docs/manual.xml b/docs/manual.xml index 1d97068..aa75498 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -30,7 +30,7 @@ E - 2003,2004 + 2003,2004,2005 Michael E. Smoot @@ -43,10 +43,11 @@ The first is the CmdLine (command line) class. This class parses the command line passed to it according to the arguments that it contains. Arguments are separate objects that are added to the -CmdLine object one at a time. The five +CmdLine object one at a time. The six argument classes are: ValueArg, UnlabeledValueArg, -SwitchArg, MultiArg and +SwitchArg, MultiSwitchArg, +MultiArg and UnlabeledMultiArg. These classes are templatized, which means they can be defined to parse a value of any type**. Once you add the @@ -431,6 +432,23 @@ Note that MultiArgs can be added to the CmdLine in any order (unlike UnlabeledMultiArg). + +New Feature! MultiSwitchArg now +allows you to set a switch multiple times on the command line. The call +to getValue() returns the number (int) of times +the switch +has been found on the command line in addition to the default value. +Here is an example using the default initial value of 0: + + MultiSwitchArg quiet("q","quiet","Reduce the volume of output"); + cmd.add( quiet ); + +Alternatively, you can specify your own initial value: + + MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5); + cmd.add( quiet ); + + @@ -824,16 +842,11 @@ See the API Documentation for details. - + Multiple Identical Switches -If you absolutely must allow for multiple, identical switches, then -don't use a SwitchArg, instead use a -MultiArg of type -bool. This means you'll need to specify a 1 or 0 on the -command line with the switch (as values are required), but this -should allow you to turn your favorite switch on and off to your -heart's content. +No longer a problem! Just use MultiSwitchArg. +There is a description here.