mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-07 19:29:07 -04:00
minor tweaks
This commit is contained in:
parent
403c23972a
commit
0f006d4b94
@ -281,8 +281,8 @@ special cases of <b>ValueArg</b>s and are described below. All
|
||||
<b>ValueArg</b>s are <a href=
|
||||
"manual.html#FOOTNOTES">templatized**</a> and will attempt to parse
|
||||
the string its flag matches on the command line as the type it is
|
||||
specified as. <b>ValueArg< int ></b> will attempt to parse an
|
||||
int, <b>ValueArg< float ></b> will attempt to parse a float,
|
||||
specified as. <b>ValueArg<int></b> will attempt to parse an
|
||||
int, <b>ValueArg<float></b> will attempt to parse a float,
|
||||
etc. If <i>operator>></i> for the specified type doesn't
|
||||
recognize the string on the command line as its defined type, then
|
||||
an exception will be thrown.</li>
|
||||
@ -292,7 +292,7 @@ an exception will be thrown.</li>
|
||||
<em>TCLAP</em> is implemented entirely in header files which means you only
|
||||
need to include CmdLine.h to use the library.
|
||||
<pre>
|
||||
#include < tclap/CmdLine.h >
|
||||
#include <tclap/CmdLine.h>
|
||||
</pre>
|
||||
You'll need to make sure that your compiler can see the header
|
||||
files. If you do the usual "make install" then your compiler should
|
||||
@ -363,7 +363,7 @@ a single value is returned. A <b>MultiArg</b> is declared much like
|
||||
a <b>ValueArg</b>:
|
||||
<pre>
|
||||
|
||||
MultiArg < int > itest("i", "intTest", "multi int test", false,"int" );
|
||||
MultiArg <int> itest("i", "intTest", "multi int test", false,"int" );
|
||||
cmd.add( itest );
|
||||
|
||||
</pre>
|
||||
@ -384,7 +384,7 @@ the <b>CmdLine</b> object to treat them accordingly. The code would
|
||||
look like this:
|
||||
<pre>
|
||||
|
||||
UnlabeledValueArg < float > nolabel( "name", "unlabeled test", 3.14,
|
||||
UnlabeledValueArg <float> nolabel( "name", "unlabeled test", 3.14,
|
||||
"nameString" );
|
||||
cmd.add( nolabel );
|
||||
|
||||
@ -432,11 +432,11 @@ CmdLine!</b>. Here is what a declaration looks like:
|
||||
//
|
||||
// UnlabeledMultiArg must be the LAST argument added!
|
||||
//
|
||||
UnlabeledMultiArg < string > multi("file names");
|
||||
UnlabeledMultiArg <string> multi("file names");
|
||||
cmd.add( multi );
|
||||
cmd.parse(argc, argv);
|
||||
|
||||
vector < string > fileNames = multi.getValue();
|
||||
vector <string> fileNames = multi.getValue();
|
||||
|
||||
</pre>
|
||||
You must only ever specify one (1) <b>UnlabeledMultiArg</b>. One
|
||||
@ -464,14 +464,14 @@ xorAdd(). This means that exactly one of the <b>Arg</b>s must be
|
||||
set and no more.<br />
|
||||
<br />
|
||||
xorAdd() comes in two flavors, either xorAdd(Arg& a, Arg&
|
||||
b) to add just two <b>Arg</b>s to be xor'd and xorAdd( vector<
|
||||
Arg* > xorList ) to add more than two <b>Arg</b>s.
|
||||
b) to add just two <b>Arg</b>s to be xor'd and xorAdd( vector<Arg*>
|
||||
xorList ) to add more than two <b>Arg</b>s.
|
||||
<pre>
|
||||
|
||||
|
||||
ValueArg < string > fileArg("f","file","File name to read",true,"homer",
|
||||
ValueArg <string> fileArg("f","file","File name to read",true,"homer",
|
||||
"filename");
|
||||
ValueArg < string > urlArg("u","url","URL to load",true,
|
||||
ValueArg <string> urlArg("u","url","URL to load",true,
|
||||
"http://example.com", "URL");
|
||||
|
||||
cmd.xorAdd( fileArg, urlArg );
|
||||
@ -515,7 +515,7 @@ option on the command line. The help output is updated accordingly.
|
||||
<pre>
|
||||
|
||||
|
||||
ValueArg < string > fileArg("","file","File name",true,"homer","filename");
|
||||
ValueArg <string> fileArg("","file","File name",true,"homer","filename");
|
||||
|
||||
SwitchArg caseSwitch("","upperCase","Print in upper case",false);
|
||||
|
||||
@ -532,14 +532,14 @@ constructor. If the value is in the list then it is accepted. If
|
||||
not, then an exception is thrown. Here is a simple example:
|
||||
<pre>
|
||||
|
||||
vector< string > allowed;
|
||||
vector<string> allowed;
|
||||
allowed.push_back("homer");
|
||||
allowed.push_back("marge");
|
||||
allowed.push_back("bart");
|
||||
allowed.push_back("lisa");
|
||||
allowed.push_back("maggie");
|
||||
|
||||
ValueArg< string > nameArg("n","name","Name to print",true,"homer",allowed);
|
||||
ValueArg<string> nameArg("n","name","Name to print",true,"homer",allowed);
|
||||
cmd.add( nameArg );
|
||||
|
||||
</pre>
|
||||
@ -575,10 +575,10 @@ example:
|
||||
// Note that the following args take the "cmd" object as arguments.
|
||||
SwitchArg btest("B","existTestB", "exist Test B", false, cmd );
|
||||
|
||||
ValueArg< string > stest("s", "stringTest", "string test", true, "homer",
|
||||
ValueArg<string> stest("s", "stringTest", "string test", true, "homer",
|
||||
"string", cmd );
|
||||
|
||||
UnlabeledValueArg< string > utest("unTest1","unlabeled test one",
|
||||
UnlabeledValueArg<string> utest("unTest1","unlabeled test one",
|
||||
"default","string", cmd );
|
||||
|
||||
// NO add() calls!
|
||||
@ -654,8 +654,8 @@ prints the names of the authors when present. First subclass
|
||||
<b>Visitor</b>:
|
||||
<pre>
|
||||
#include "Visitor.h"
|
||||
#include < string >
|
||||
#include < iostream >
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class AuthorVisitor : public Visitor
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user