added CSS style

This commit is contained in:
mes5k 2004-10-01 01:16:54 +00:00
parent 9a36a7d26f
commit 8dc142e24f
3 changed files with 163 additions and 72 deletions

View File

@ -24,12 +24,13 @@
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1st August 2004), see www.w3.org" />
<title>tclap -- Templatized C++ Command Line Parser Library</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table summary="Title and Sourceforge logo.">
<tr>
<td align="left">
<h1>TCLAP -- Templatized C++ Command Line Parser Library</h1>
<h1>Templatized C++ Command Line Parser Library</h1>
</td>
<td align="right"><a href="http://sourceforge.net"><img src=
"http://sourceforge.net/sflogo.php?group_id=76645&amp;type=4"
@ -37,7 +38,19 @@ width="125" height="37" border="0" alt=
"SourceForge.net Logo" /></a></td>
</tr>
</table>
TCLAP is a small, flexible library that provides a simple interface for
<div class="links">
<h3>Links</h3>
<ul class="menu">
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=76645">Download</a> the source</li><br/>
<li>Read the <a href="manual.html">Manual</a></li><br/>
<li>Read the <a href="html/index.html">API documentation</a></li><br/>
<li>Visit the <a href="http://sourceforge.net">SourceForge</a>
<a href="http://sourceforge.net/projects/tclap/">project page</a></li><br/>
<li>Send <a mailto="mes5k@users.sourceforge.net">feedback, comments, patches, etc.</a></li></br>
</ul>
</div>
<div class="main">
<em>TCLAP</em> is a small, flexible library that provides a simple interface for
defining and accessing command line arguments. It was intially
inspired by the user friendly <a href=
"http://www.cs.bgu.ac.il/~cgproj/CLAP/">CLAP</a> libary. The
@ -47,27 +60,17 @@ objects, such as IntArg, FloatArg, and StringArg. While the library is
not strictly compliant with the GNU or POSIX standards, it is
getting close.
<br/> <br/>
TCLAP in written in ANSI C++ and is meant to be compatible with any
<em>TCLAP</em> 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>
<li>See the <a href="manual.html"><b>manual</b></a> for how things
work.</li>
<li>See the <a href="html/index.html"><b>API</b></a> documentation
for detailed implementation information.</li>
<li>Visit the <a href="http://sourceforge.net">SourceForge</a>
project <a href=
"http://sourceforge.net/projects/tclap/">page</a>.</li>
<li><a href=
"http://sourceforge.net/project/showfiles.php?group_id=76645"><b>Download</b></a>
the source here.</li>
<li>Send any feedback, comments, patches, etc. to mes (_at_) aescon
(_dot_) com.</li>
</ul>
Happy coding!
<br/>
<br/>
<em>Happy coding!</em>
</div>
</body>
</html>

View File

@ -24,6 +24,7 @@
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1st August 2004), see www.w3.org" />
<title>TCLAP Manual</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table summary="Title and Sourceforge Logo.">
@ -86,12 +87,12 @@ Descriptions</a></li>
</ul>
<a name="BASIC_USAGE" id="BASIC_USAGE"></a>
<h2>Basic Usage</h2>
There are a few key classes to be aware of. The first is the
<em>TCLAP</em> has a few key classes to be aware of. The first is the
<b>CmdLine</b> (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
<b>CmdLine</b> object one at a time. The five types of
arguments are, <b>ValueArg</b>, <b>UnlabeledValueArg</b>,
<b>CmdLine</b> object one at a time. The five
argument classes are: <b>ValueArg</b>, <b>UnlabeledValueArg</b>,
<b>SwitchArg</b>, <b>MultiArg</b> and <b>UnlabeledMultiArg</b>.
These classes are templatized, which means they can be defined to parse
a value of any <a href="manual.html#FOOTNOTES">type**</a>. Once you add the
@ -99,8 +100,9 @@ arguments to the <b>CmdLine</b> object, it parses the command line
and assigns the data it finds to the specific argument objects it
contains. Your program accesses the values parsed by
calls to the <i>getValue()</i> methods of the argument objects.<br />
<br />
Here is a simple <a href="test1.cpp">example</a> ...<br />
<br/>
Here is a simple <a href="test1.cpp">example</a> ...
<br/>
<pre>
#include &lt; string &gt;
#include &lt; iostream &gt;
@ -148,12 +150,10 @@ int main(int argc, char** argv)
}
</pre>
<br />
<br />
<br />
The output should look like:<br />
<br />
<br />
<pre>
% tester -u -n mike
My name is MIKE
@ -202,10 +202,9 @@ Where:
Command description message
</pre>
<br />
<br />
<br />
This example shows a number of different properties of the
library...
<ul>
@ -235,7 +234,7 @@ ArgExceptions!</i></b> Any problems found in constructing the
<b>ArgException</b>.</li>
</ul>
<a name="ARGUMENT_PROPERTIES" id="ARGUMENT_PROPERTIES"></a>
<h3><i>Argument Properties</i></h3>
<h3>Argument Properties</h3>
Arguments, whatever their type, have a few common basic properties.
These properties are set in the constructors of the arguments.
<ul>
@ -262,10 +261,10 @@ most part</a>, with some <a href=
"manual.html#DESCRIPTION_EXCEPTIONS">hack</a>).</li>
</ul>
<a name="ARGUMENT_TYPES" id="ARGUMENT_TYPES"></a>
<h3><i>Types of Arguments</i></h3>
<h3>Types of Arguments</h3>
There are two primary types of arguments:
<ul>
<li><b>SwitchArg</b>s are what the name implies, simple on/off,
<li><b>SwitchArg</b>s are what the name implies: simple, on/off,
boolean switches. Use <b>SwitchArg</b>s anytime you want to turn
some sort of system property on or off. <b>SwitchArg</b>s don't
parse a value. They return <i>true</i> or <i>false</i>, depending
@ -289,8 +288,8 @@ recognize the string on the command line as its defined type, then
an exception will be thrown.</li>
</ul>
<a name="COMPILING" id="COMPILING"></a>
<h3><i>Compiling</i></h3>
TCLAP is implemented entirely in header files which means you only
<h3>Compiling</h3>
<em>TCLAP</em> is implemented entirely in header files which means you only
need to include CmdLine.h to use the library.
<pre>
#include &lt; tclap/CmdLine.h &gt;
@ -305,13 +304,13 @@ complier argument to specify the exact location of the libraries.
Where /some/place/tclap-1.X is the place you have unpacked the
distribution.<br />
<br />
Finally, if you want to include TCLAP as part of your software
Finally, if you want to include <em>TCLAP</em> as part of your software
(which is perfectly OK, even encouraged) then simply copy the
contents of /some/place/tclap-1.X/include (the tclap directory and
all of the header files it contains) into your include
directory.<br />
<br />
TCLAP was developed on Linux and MacOSX systems. It is also known
<em>TCLAP</em> was developed on Linux and MacOSX systems. It is also known
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
@ -320,8 +319,8 @@ for you. Please let us know if this is not the case! <a name=
<h2>Complications</h2>
Naturally, what we have seen to this point doesn't satisfy all of
our needs. <a name="COMBINE_SWITCHES" id="COMBINE_SWITCHES"></a>
<h3><i>I want to combine multiple switches into one
argument...</i></h3>
<h3>I want to combine multiple switches into one
argument...</h3>
Multiple <b>SwitchArg</b>s can be combined into a single argument
on the command line. If you have switches -a, -b and -c it is valid
to do either:
@ -339,8 +338,8 @@ to do either:
This is to make this library more in line with the POSIX and GNU
standards (as I understand them). <a name="MULTI_ARG" id=
"MULTI_ARG"></a>
<h3><i>I tried passing multiple values on the command line with the
same flag and it didn't work...</i></h3>
<h3>I tried passing multiple values on the command line with the
same flag and it didn't work...</h3>
Correct. You can neither specify mulitple <b>ValueArg</b>s or
<b>SwitchArg</b>s with the same flag in the code nor on the command
line. Exceptions will occur in either case. For <b>SwitchArg</b>s
@ -363,18 +362,16 @@ value that it matches and parses onto a vector of values. When the
a single value is returned. A <b>MultiArg</b> is declared much like
a <b>ValueArg</b>:
<pre>
...
MultiArg &lt; int &gt; itest("i", "intTest", "multi int test", false,"int" );
cmd.add( itest );
...
</pre>
Note that <b>MultiArg</b>s can be added to the <b>CmdLine</b> in
any order (unlike <a href=
"manual.html#UNLABELED_MULTI_ARG">UnlabeledMultiArg</a>s). <a name=
"UNLABELED_VALUE_ARG" id="UNLABELED_VALUE_ARG"></a>
<h3><i>I don't like labelling all of my arguments...</i></h3>
<h3>I don't like labelling all of my arguments...</h3>
To this point all of our arguments have had labels (flags)
indentifying them on the command line, but there are some
situations where flags are burdensome and not worth the effort. One
@ -386,13 +383,11 @@ much just <b>ValueArg</b>s without the flag specified, which tells
the <b>CmdLine</b> object to treat them accordingly. The code would
look like this:
<pre>
...
UnlabeledValueArg &lt; float &gt; nolabel( "name", "unlabeled test", 3.14,
"nameString" );
cmd.add( nolabel );
...
</pre>
Everything else is handled identically to what is seen above. The
only difference to be aware of, and this is important: <b>the order
@ -408,8 +403,8 @@ declaration), but the <b>UnlabeledValueArgs</b> will still be
parsed in the order they are added. Just remember that order is
important for unlabeled arguments. <a name="UNLABELED_MULTI_ARG"
id="UNLABELED_MULTI_ARG"></a>
<h3><i>I want an arbitrary number of arguments to be
accepted...</i></h3>
<h3>I want an arbitrary number of arguments to be
accepted...</h3>
Don't worry, we've got you covered. Say you want a strange command
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
@ -433,7 +428,6 @@ that like <b>UnlabeledValueArg</b>s: order matters! In fact, <b>an
UnlabeledMultiArg must be the <i>last</i> argument added to the
CmdLine!</b>. Here is what a declaration looks like:
<pre>
...
//
// UnlabeledMultiArg must be the LAST argument added!
@ -444,7 +438,6 @@ CmdLine!</b>. Here is what a declaration looks like:
vector &lt; string &gt; fileNames = multi.getValue();
...
</pre>
You must only ever specify one (1) <b>UnlabeledMultiArg</b>. One
<b>UnlabeledMultiArg</b> will read every unlabeled Arg that wasn't
@ -459,7 +452,7 @@ be multiple args of multiple types (stings, ints, floats, etc.)
then just declare the <b>UnlabeledMultiArg</b> as type
<i>string</i> and parse the different values yourself or use
several <b>UnlabeledValueArg</b>s. <a name="XOR" id="XOR"></a>
<h3><i>I want one argument or the other, but not both...</i></h3>
<h3>I want one argument or the other, but not both...</h3>
Suppose you have a command that must read input from one of two
possible locations, either a local file or a URL. The command
<i>must</i> read something, so <i>one</i> argument is required, but
@ -475,7 +468,6 @@ b) to add just two <b>Arg</b>s to be xor'd and xorAdd( vector&lt;
Arg* &gt; xorList ) to add more than two <b>Arg</b>s.
<pre>
...
ValueArg &lt; string &gt; fileArg("f","file","File name to read",true,"homer",
"filename");
@ -485,7 +477,6 @@ Arg* &gt; xorList ) to add more than two <b>Arg</b>s.
cmd.xorAdd( fileArg, urlArg );
cmd.parse(argc, argv);
...
</pre>
Once one <b>Arg</b> in the xor list is matched on the
<b>CmdLine</b> then the others in the xor list will be marked as
@ -499,7 +490,6 @@ other <b>Arg</b> that was xor'd isSet() will return <b>FALSE</b>.
will also return <b>FALSE</b>.)
<pre>
...
if ( fileArg.isSet() )
readFile( fileArg.getValue() );
@ -510,12 +500,11 @@ will also return <b>FALSE</b>.)
// required args above has not been set.
throw("Very bad things...");
...
</pre>
<a name="NO_FLAG" id="NO_FLAG"></a>
<h3><i>I have more arguments than single flags make sense
for...</i></h3>
<h3>I have more arguments than single flags make sense
for...</h3>
Some commands have so many options that single flags no longer map
sensibly to the available options. In this case, it is desirable to
specify <b>Arg</b>s using only long options. This one is easy to
@ -525,18 +514,16 @@ option should be matched and will force users to specify the long
option on the command line. The help output is updated accordingly.
<pre>
...
ValueArg &lt; string &gt; fileArg("","file","File name",true,"homer","filename");
SwitchArg caseSwitch("","upperCase","Print in upper case",false);
...
</pre>
<a name="ALLOWED" id="ALLOWED"></a>
<h3><i>I want to constrain the values allowed for a particular
argument...</i></h3>
<h3>I want to constrain the values allowed for a particular
argument...</h3>
There are now constructors for all of the <b>Arg</b>s that parse
values that allow a list of values to be specified for that
particular <b>Arg</b>. When the value for the <b>Arg</b> is parsed,
@ -545,8 +532,6 @@ 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&lt; string &gt; allowed;
allowed.push_back("homer");
allowed.push_back("marge");
@ -557,8 +542,6 @@ not, then an exception is thrown. Here is a simple example:
ValueArg&lt; string &gt; nameArg("n","name","Name to print",true,"homer",allowed);
cmd.add( nameArg );
...
</pre>
Instead of a type description being specified in the <b>Arg</b>, a
type description is created by concatenating the values in the
@ -576,7 +559,7 @@ description provided with the <b>Arg</b> reflects the constraint
you choose.<br />
<br />
<a name="CONSTRUCTOR" id="CONSTRUCTOR"></a>
<h3><i>I want the Args to add themselves to the CmdLine...</i></h3>
<h3>I want the Args to add themselves to the CmdLine...</h3>
New constructors have beed added for each <b>Arg</b> that take a
<b>CmdLine</b> object as an argument. Each <b>Arg</b> then
<i>add</i>s itself to the <b>CmdLine</b> object. There is no
@ -585,7 +568,6 @@ calling the <i>add()</i> method directly. At the moment, there is
no way to do an <i>xorAdd()</i> from the constructor. Here is an
example:
<pre>
...
// Create the command line.
CmdLine cmd("this is a message", '=', "0.99" );
@ -604,13 +586,12 @@ example:
// Parse the command line.
cmd.parse(argc,argv);
...
</pre>
<a name="EXCEPTIONS" id="EXCEPTIONS"></a>
<h2>Exceptions to the Rules</h2>
Like all good rules, there are many exceptions.... <a name=
"IGNORE_ARGS" id="IGNORE_ARGS"></a>
<h3><i>Ignoring arguments</i></h3>
<h3>Ignoring arguments</h3>
The <i>--</i> flag is automatically included in the <b>CmdLine</b>.
As (almost) per POSIX and GNU standards, any argument specified
after the <i>--</i> flag is ignored. <i>Almost</i> because if an
@ -629,7 +610,7 @@ make both <b>UnlabeledValueArg</b>s and <b>UnlabeledMultiArg</b>s
ignoreable in their constructors. See the <a href=
"html/index.html">API Documentation</a> for details. <a name=
"MULTI_SWITCHES" id="MULTI_SWITCHES"></a>
<h3><i>Multiple Identical Switches</i></h3>
<h3>Multiple Identical Switches</h3>
If you absolutely must allow for multiple, identical switches, then
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
@ -637,7 +618,7 @@ 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. <a name="DESCRIPTION_EXCEPTIONS" id=
"DESCRIPTION_EXCEPTIONS"></a>
<h3><i>Type Descriptions</i></h3>
<h3>Type Descriptions</h3>
Ideally this library would use RTTI to return a human readable name
of the type declared for a particular argument. Unfortunately, at
least for g++, the names returned aren't particularly useful.
@ -689,13 +670,11 @@ Now include this class definition somewhere and go about creating
your command line. When you create the author switch, add the
<b>AuthorVisitor</b> pointer as follows:
<pre>
...
SwitchArg author("a","author","Prints author name", false,
new AuthorVisitor("Homer J. Simpson") );
cmd.add( author );
...
</pre>
Now, any time the <i>-a</i> or <i>--author</i> flag is specified,
the program will print the author name, Homer J. Simpson and exit
@ -706,7 +685,10 @@ For more information, look at the <a href="html/index.html">API
Documentation</a> and the examples included with the
distribution.<br />
<br />
<b>Happy coding!</b><br />
<br />
<em>Happy coding!</em><br />
<br />
<br />
<br />
<a name="FOOTNOTES" id="FOOTNOTES"></a><br />
** In theory, any type that supports operator&gt;&gt; and

106
docs/style.css Executable file
View File

@ -0,0 +1,106 @@
/*
color:#ffffff; white
color:#e0e0e0; light gray
color:#f8f8f8; light gray
color:#003366; dark blue
color:#555555; gray
color:#ff9933; light orange
color:#cc3300; red/brown/orange
color:#660066; purple
color:#669900; green
*/
a {
color:#003366;
text-decoration:underline;
}
a:hover {
text-decoration: blink;
color:#ff9933;
}
body {
font-family: verdana, tahoma, helvetica, arial, sans-serif;
font-size: 100%;
background-color:#ffffff;
margin: 1em;
}
pre {
background-color:#f8f8f8;
margin: 1.5em;
font-size:90%;
}
ul {
list-style: square inside;
}
ul.menu { /* inherits from ul */
list-style: square outside;
padding-left: 1em;
}
table {
background-color:#f8f8f8;
border-style:solid;
border-width:1px;
border-color:#d0d0d0;
}
em {
color:#ff9933;
font-size:110%;
}
h1 {
color:#ff9933;
font-weight:bold;
padding-top: 0.2em;
}
h2 {
color:#ff9933;
font-size:120%;
font-weight:bold;
border-bottom-style:solid;
border-bottom-width:1px;
border-bottom-color:#d0d0d0;
}
h3 {
color:#ff9933;
font-size:110%;
font-weight:bold;
font-style:italic;
}
p {
color:#555555;
font-size: 90%;
line-height: 1.5em;
}
div.links{
float: left;
clear: left;
width: 12em;
background-color:#f8f8f8;
border-style:solid;
border-width:1px;
border-color:#d0d0d0;
margin-bottom: 0.5em;
padding: 0.5em 0.5em 0.5em 0.5em;
margin: 0.5em 0.5em 0em 0em;
}
div.main{
border-style:solid;
border-width:1px;
border-color:#d0d0d0;
margin: 0.5em 0em 0.5em 14em;
padding: 0.5em 0.5em 0.5em 0.5em;
}