mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-12 13:46:02 -04:00
proofing updates
This commit is contained in:
parent
e3c89db82a
commit
bed8c016b5
@ -29,7 +29,7 @@
|
|||||||
<table summary="Title and Sourceforge logo.">
|
<table summary="Title and Sourceforge logo.">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">
|
<td align="left">
|
||||||
<h1>tclap -- Templatized C++ Command Line Parser Library</h1>
|
<h1>TCLAP -- Templatized C++ Command Line Parser Library</h1>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><a href="http://sourceforge.net"><img src=
|
<td align="right"><a href="http://sourceforge.net"><img src=
|
||||||
"http://sourceforge.net/sflogo.php?group_id=76645&type=4"
|
"http://sourceforge.net/sflogo.php?group_id=76645&type=4"
|
||||||
@ -37,21 +37,29 @@ width="125" height="37" border="0" alt=
|
|||||||
"SourceForge.net Logo" /></a></td>
|
"SourceForge.net Logo" /></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
This is a small library that provides a simple interface for
|
TCLAP is a small, flexible library that provides a simple interface for
|
||||||
defining and accessing command line arguments. It was intially
|
defining and accessing command line arguments. It was intially
|
||||||
inspired by the user friendly <a href=
|
inspired by the user friendly <a href=
|
||||||
"http://www.cs.bgu.ac.il/~cgproj/CLAP/">CLAP</a> libary. The
|
"http://www.cs.bgu.ac.il/~cgproj/CLAP/">CLAP</a> libary. The
|
||||||
difference is that this library is templatized so the argument
|
difference is that this library is templatized, so the argument
|
||||||
class is type independent which avoids identical-except-for-type
|
class is type independent. Type independence avoids identical-except-for-type
|
||||||
objects like IntArg, FloatArg, StringArg, etc. While the library is
|
objects, such as IntArg, FloatArg, and StringArg. While the library is
|
||||||
not strictly compliant with the GNU or POSIX standards, it is
|
not strictly compliant with the GNU or POSIX standards, it is
|
||||||
getting close.
|
getting close.
|
||||||
|
<br/> <br/>
|
||||||
|
TCLAP in written in ANSI C++ and is meant to be compatible with any
|
||||||
|
standards-compliant C++ compiler. It is known to work on Linux, MacOS X,
|
||||||
|
Windows, and Solaris platforms. The library is implemented
|
||||||
|
entirely in header files making it easy to use and distribute with other
|
||||||
|
software. It is licensed under the
|
||||||
|
<a href="http://opensource.org/licenses/mit-license.php">MIT License</a>
|
||||||
|
for worry free distribution.
|
||||||
<ul>
|
<ul>
|
||||||
<li>See the <a href="manual.html"><b>manual</b></a> for how things
|
<li>See the <a href="manual.html"><b>manual</b></a> for how things
|
||||||
work.</li>
|
work.</li>
|
||||||
<li>See the <a href="html/index.html"><b>API</b></a> documentation
|
<li>See the <a href="html/index.html"><b>API</b></a> documentation
|
||||||
for detailed implementation information.</li>
|
for detailed implementation information.</li>
|
||||||
<li>Visit the <a href="http://sourceforge.net">Sourceforge</a>
|
<li>Visit the <a href="http://sourceforge.net">SourceForge</a>
|
||||||
project <a href=
|
project <a href=
|
||||||
"http://sourceforge.net/projects/tclap/">page</a>.</li>
|
"http://sourceforge.net/projects/tclap/">page</a>.</li>
|
||||||
<li><a href=
|
<li><a href=
|
||||||
|
@ -39,7 +39,7 @@ width="125" height="37" border="0" alt=
|
|||||||
</table>
|
</table>
|
||||||
<h2>Table of Contents</h2>
|
<h2>Table of Contents</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="manual.html#BASIC_USAGE">Basic usage</a></li>
|
<li><a href="manual.html#BASIC_USAGE">Basic Usage</a></li>
|
||||||
<li style="list-style: none">
|
<li style="list-style: none">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="manual.html#ARGUMENT_PROPERTIES">Argument
|
<li><a href="manual.html#ARGUMENT_PROPERTIES">Argument
|
||||||
@ -71,10 +71,10 @@ allowed for a particular argument...</a></li>
|
|||||||
themselves to the CmdLine...</a></li>
|
themselves to the CmdLine...</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="manual.html#EXCEPTIONS">Exceptions</a></li>
|
<li><a href="manual.html#EXCEPTIONS">Exceptions to the Rules</a></li>
|
||||||
<li style="list-style: none">
|
<li style="list-style: none">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="manual.html#IGNORE_ARGS">Ignoring arguments</a></li>
|
<li><a href="manual.html#IGNORE_ARGS">Ignoring Arguments</a></li>
|
||||||
<li><a href="manual.html#MULTI_SWITCHES">Multiple Identical
|
<li><a href="manual.html#MULTI_SWITCHES">Multiple Identical
|
||||||
Switches</a></li>
|
Switches</a></li>
|
||||||
<li><a href="manual.html#DESCRIPTION_EXCEPTIONS">Type
|
<li><a href="manual.html#DESCRIPTION_EXCEPTIONS">Type
|
||||||
@ -85,7 +85,7 @@ Descriptions</a></li>
|
|||||||
<li><a href="manual.html#MORE_INFO">More Information</a></li>
|
<li><a href="manual.html#MORE_INFO">More Information</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<a name="BASIC_USAGE" id="BASIC_USAGE"></a>
|
<a name="BASIC_USAGE" id="BASIC_USAGE"></a>
|
||||||
<h2>Basic usage</h2>
|
<h2>Basic Usage</h2>
|
||||||
There are a few key classes to be aware of. The first is the
|
There are a few key classes to be aware of. The first is the
|
||||||
<b>CmdLine</b> (command line) class. This is the class that parses
|
<b>CmdLine</b> (command line) class. This is the class that parses
|
||||||
the command line passed to it according to the arguments that it
|
the command line passed to it according to the arguments that it
|
||||||
@ -135,7 +135,7 @@ int main(int argc, char** argv)
|
|||||||
string name = nameArg.getValue();
|
string name = nameArg.getValue();
|
||||||
bool upperCase = caseSwitch.getValue();
|
bool upperCase = caseSwitch.getValue();
|
||||||
|
|
||||||
// Do what you intend too...
|
// Do what you intend to...
|
||||||
if ( upperCase )
|
if ( upperCase )
|
||||||
transform(name.begin(),name.end(),name.begin(),::toupper);
|
transform(name.begin(),name.end(),name.begin(),::toupper);
|
||||||
else
|
else
|
||||||
@ -282,7 +282,7 @@ special cases of <b>ValueArg</b>s and are described below. All
|
|||||||
<b>ValueArg</b>s are <a href=
|
<b>ValueArg</b>s are <a href=
|
||||||
"manual.html#FOOTNOTES">templatized**</a> and will attempt to parse
|
"manual.html#FOOTNOTES">templatized**</a> and will attempt to parse
|
||||||
the string its flag matches on the command line as the type it is
|
the string its flag matches on the command line as the type it is
|
||||||
specified as. <b>ValueArg< int ></b> will attempt to parse in
|
specified as. <b>ValueArg< int ></b> will attempt to parse an
|
||||||
int, <b>ValueArg< float ></b> will attempt to parse a float,
|
int, <b>ValueArg< float ></b> will attempt to parse a float,
|
||||||
etc. If <i>operator>></i> for the specified type doesn't
|
etc. If <i>operator>></i> for the specified type doesn't
|
||||||
recognize the string on the command line as its defined type, then
|
recognize the string on the command line as its defined type, then
|
||||||
@ -308,7 +308,7 @@ distribution.<br />
|
|||||||
Finally, if you want to include TCLAP as part of your software
|
Finally, if you want to include TCLAP as part of your software
|
||||||
(which is perfectly OK, even encouraged) then simply copy the
|
(which is perfectly OK, even encouraged) then simply copy the
|
||||||
contents of /some/place/tclap-1.X/include (the tclap directory and
|
contents of /some/place/tclap-1.X/include (the tclap directory and
|
||||||
all of he header files it contains) into your include
|
all of the header files it contains) into your include
|
||||||
directory.<br />
|
directory.<br />
|
||||||
<br />
|
<br />
|
||||||
TCLAP was developed on Linux and MacOSX systems. It is also known
|
TCLAP was developed on Linux and MacOSX systems. It is also known
|
||||||
@ -411,7 +411,7 @@ id="UNLABELED_MULTI_ARG"></a>
|
|||||||
<h3><i>I want an arbitrary number of arguments to be
|
<h3><i>I want an arbitrary number of arguments to be
|
||||||
accepted...</i></h3>
|
accepted...</i></h3>
|
||||||
Don't worry, we've got you covered. Say you want a strange command
|
Don't worry, we've got you covered. Say you want a strange command
|
||||||
that searches each file specified for a given string (lets call it
|
that searches each file specified for a given string (let's call it
|
||||||
<i>grep</i>), but you don't want to have to type in all of the file
|
<i>grep</i>), but you don't want to have to type in all of the file
|
||||||
names or write a script to do it for you. Say,
|
names or write a script to do it for you. Say,
|
||||||
<pre>
|
<pre>
|
||||||
@ -452,7 +452,7 @@ already processed by a <b>UnlabeledValueArg</b> into a
|
|||||||
<i>vector</i> of type T. Any <b>UnlabeledValueArg</b> or other
|
<i>vector</i> of type T. Any <b>UnlabeledValueArg</b> or other
|
||||||
<b>UnlabeledMultiArg</b> specified after the first
|
<b>UnlabeledMultiArg</b> specified after the first
|
||||||
<b>UnlabeledMultiArg</b> will be ignored, and if they are required,
|
<b>UnlabeledMultiArg</b> will be ignored, and if they are required,
|
||||||
expections will be thrown. When you call the <i>getValue()</i>
|
exceptions will be thrown. When you call the <i>getValue()</i>
|
||||||
method of the <b>UnlabeledValueArg</b> argument, a <i>vector</i>
|
method of the <b>UnlabeledValueArg</b> argument, a <i>vector</i>
|
||||||
will be returned. If you can imagine a situation where there will
|
will be returned. If you can imagine a situation where there will
|
||||||
be multiple args of multiple types (stings, ints, floats, etc.)
|
be multiple args of multiple types (stings, ints, floats, etc.)
|
||||||
@ -467,7 +467,7 @@ not both, yet neither argument is strictly necessary by itself.
|
|||||||
This is called "exclusive or" or "XOR". To accomodate this
|
This is called "exclusive or" or "XOR". To accomodate this
|
||||||
situation, there is now an option to add two or more <b>Arg</b>s to
|
situation, there is now an option to add two or more <b>Arg</b>s to
|
||||||
a <b>CmdLine</b> that are exclusively or'd with one another:
|
a <b>CmdLine</b> that are exclusively or'd with one another:
|
||||||
xorAdd(). This means that at exactly one of the <b>Arg</b>s must be
|
xorAdd(). This means that exactly one of the <b>Arg</b>s must be
|
||||||
set and no more.<br />
|
set and no more.<br />
|
||||||
<br />
|
<br />
|
||||||
xorAdd() comes in two flavors, either xorAdd(Arg& a, Arg&
|
xorAdd() comes in two flavors, either xorAdd(Arg& a, Arg&
|
||||||
@ -607,7 +607,7 @@ example:
|
|||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
<a name="EXCEPTIONS" id="EXCEPTIONS"></a>
|
<a name="EXCEPTIONS" id="EXCEPTIONS"></a>
|
||||||
<h2>Exceptions</h2>
|
<h2>Exceptions to the Rules</h2>
|
||||||
Like all good rules, there are many exceptions.... <a name=
|
Like all good rules, there are many exceptions.... <a name=
|
||||||
"IGNORE_ARGS" id="IGNORE_ARGS"></a>
|
"IGNORE_ARGS" id="IGNORE_ARGS"></a>
|
||||||
<h3><i>Ignoring arguments</i></h3>
|
<h3><i>Ignoring arguments</i></h3>
|
||||||
@ -635,7 +635,7 @@ don't use a <b>SwitchArg</b>, instead use a <b>MultiArg</b> of type
|
|||||||
<i>bool</i>. This means you'll need to specify a 1 or 0 on the
|
<i>bool</i>. This means you'll need to specify a 1 or 0 on the
|
||||||
command line with the switch (as values are required), but this
|
command line with the switch (as values are required), but this
|
||||||
should allow you to turn your favorite switch on and off to your
|
should allow you to turn your favorite switch on and off to your
|
||||||
hearts content. <a name="DESCRIPTION_EXCEPTIONS" id=
|
heart's content. <a name="DESCRIPTION_EXCEPTIONS" id=
|
||||||
"DESCRIPTION_EXCEPTIONS"></a>
|
"DESCRIPTION_EXCEPTIONS"></a>
|
||||||
<h3><i>Type Descriptions</i></h3>
|
<h3><i>Type Descriptions</i></h3>
|
||||||
Ideally this library would use RTTI to return a human readable name
|
Ideally this library would use RTTI to return a human readable name
|
||||||
@ -654,7 +654,7 @@ Some of you may be wondering how we get the <i>--help</i>,
|
|||||||
mucking up the <b>CmdLine</b> code with lots of <i>if</i>
|
mucking up the <b>CmdLine</b> code with lots of <i>if</i>
|
||||||
statements and type checking. This is accomplished by using a
|
statements and type checking. This is accomplished by using a
|
||||||
variation on the Visitor Pattern. Actually, it may not be a Visitor
|
variation on the Visitor Pattern. Actually, it may not be a Visitor
|
||||||
Pattern at all, but thats what inspired me.<br />
|
Pattern at all, but that's what inspired me.<br />
|
||||||
<br />
|
<br />
|
||||||
If we want some argument to do some sort of special handling,
|
If we want some argument to do some sort of special handling,
|
||||||
besides simply parsing a value, then we add a <b>Visitor</b>
|
besides simply parsing a value, then we add a <b>Visitor</b>
|
||||||
@ -665,7 +665,7 @@ called. Any data that needs to be operated on is declared in the
|
|||||||
<b>Visitor</b> constructor and then operated on in the
|
<b>Visitor</b> constructor and then operated on in the
|
||||||
<i>visit()</i> method. A <b>Visitor</b> is added to an <b>Arg</b>
|
<i>visit()</i> method. A <b>Visitor</b> is added to an <b>Arg</b>
|
||||||
as the last argument in its declaration. This may sound
|
as the last argument in its declaration. This may sound
|
||||||
complicated, but its pretty straightforward. Lets see an
|
complicated, but it is pretty straightforward. Let's see an
|
||||||
example.<br />
|
example.<br />
|
||||||
<br />
|
<br />
|
||||||
Say you want to add an <i>--authors</i> flag to a program that
|
Say you want to add an <i>--authors</i> flag to a program that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user