From 8dc142e24ff10e1b0d6a18023eb6ea42a13e27be Mon Sep 17 00:00:00 2001 From: mes5k Date: Fri, 1 Oct 2004 01:16:54 +0000 Subject: [PATCH] added CSS style --- docs/index.html | 39 +++++++++-------- docs/manual.html | 90 ++++++++++++++++------------------------ docs/style.css | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 72 deletions(-) create mode 100755 docs/style.css diff --git a/docs/index.html b/docs/index.html index 6de68b4..e5f6564 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,12 +24,13 @@ tclap -- Templatized C++ Command Line Parser Library +
-

TCLAP -- Templatized C++ Command Line Parser Library

+

Templatized C++ Command Line Parser Library

SourceForge.net Logo
-TCLAP is a small, flexible 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 inspired by the user friendly CLAP 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.

-TCLAP in written in ANSI C++ and is meant to be compatible with any +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 MIT License for worry free distribution. - -Happy coding! +
+
+Happy coding! +
+ diff --git a/docs/manual.html b/docs/manual.html index dd5ba7f..ddcf77b 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -24,6 +24,7 @@ TCLAP Manual + @@ -86,12 +87,12 @@ Descriptions

Basic Usage

-There are a few key classes to be aware of. The first is the +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 types of -arguments are, ValueArg, UnlabeledValueArg, +CmdLine object one at a time. The five +argument classes are: ValueArg, UnlabeledValueArg, SwitchArg, MultiArg and UnlabeledMultiArg. These classes are templatized, which means they can be defined to parse a value of any type**. Once you add the @@ -99,8 +100,9 @@ arguments to the CmdLine 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 getValue() methods of the argument objects.
-
-Here is a simple example ...
+
+Here is a simple example ... +
 #include < string >
 #include < iostream >
@@ -148,12 +150,10 @@ int main(int argc, char** argv)
 }
 

-
-
The output should look like:

-
+
 % tester -u -n mike
 My name is MIKE
 
@@ -202,10 +202,9 @@ Where:
 
 
    Command description message
+
 

-
-
This example shows a number of different properties of the library... -

Argument Properties

+

Argument Properties

Arguments, whatever their type, have a few common basic properties. These properties are set in the constructors of the arguments. -

Types of Arguments

+

Types of Arguments

There are two primary types of arguments: -

Compiling

-TCLAP is implemented entirely in header files which means you only +

Compiling

+TCLAP is implemented entirely in header files which means you only need to include CmdLine.h to use the library.
         #include < tclap/CmdLine.h >
@@ -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.

-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 contents of /some/place/tclap-1.X/include (the tclap directory and all of the header files it contains) into your include directory.

-TCLAP was developed on Linux and MacOSX systems. It is also known +TCLAP 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! Complications Naturally, what we have seen to this point doesn't satisfy all of our needs. -

I want to combine multiple switches into one -argument...

+

I want to combine multiple switches into one +argument...

Multiple SwitchArgs 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). -

I tried passing multiple values on the command line with the -same flag and it didn't work...

+

I tried passing multiple values on the command line with the +same flag and it didn't work...

Correct. You can neither specify mulitple ValueArgs or SwitchArgs with the same flag in the code nor on the command line. Exceptions will occur in either case. For SwitchArgs @@ -363,18 +362,16 @@ value that it matches and parses onto a vector of values. When the a single value is returned. A MultiArg is declared much like a ValueArg:
-                ...
 
                 MultiArg < int > itest("i", "intTest", "multi int test", false,"int" );
                 cmd.add( itest );
 
-                ...
 
Note that MultiArgs can be added to the CmdLine in any order (unlike UnlabeledMultiArgs). -

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

+

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 situations where flags are burdensome and not worth the effort. One @@ -386,13 +383,11 @@ much just ValueArgs without the flag specified, which tells the CmdLine object to treat them accordingly. The code would look like this:
-                ...
 
                 UnlabeledValueArg < float >  nolabel( "name", "unlabeled test", 3.14,
                                                   "nameString"  );
                 cmd.add( nolabel );
 
-                ...
 
Everything else is handled identically to what is seen above. The only difference to be aware of, and this is important: the order @@ -408,8 +403,8 @@ declaration), but the UnlabeledValueArgs will still be parsed in the order they are added. Just remember that order is important for unlabeled arguments. -

I want an arbitrary number of arguments to be -accepted...

+

I want an arbitrary number of arguments to be +accepted...

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 grep), but you don't want to have to type in all of the file @@ -433,7 +428,6 @@ that like UnlabeledValueArgs: order matters! In fact, an UnlabeledMultiArg must be the last argument added to the CmdLine!. Here is what a declaration looks like:
-                ...
 
                 //
                 // UnlabeledMultiArg must be the LAST argument added!
@@ -444,7 +438,6 @@ CmdLine!. Here is what a declaration looks like:
 
                 vector < string >  fileNames = multi.getValue();
 
-                ...
 
You must only ever specify one (1) UnlabeledMultiArg. One UnlabeledMultiArg 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 UnlabeledMultiArg as type string and parse the different values yourself or use several UnlabeledValueArgs. -

I want one argument or the other, but not both...

+

I want one argument or the other, but not both...

Suppose you have a command that must read input from one of two possible locations, either a local file or a URL. The command must read something, so one argument is required, but @@ -475,7 +468,6 @@ b) to add just two Args to be xor'd and xorAdd( vector< Arg* > xorList ) to add more than two Args.
 
-        ...
 
         ValueArg < string >  fileArg("f","file","File name to read",true,"homer",
                                  "filename");
@@ -485,7 +477,6 @@ Arg* > xorList ) to add more than two Args.
         cmd.xorAdd( fileArg, urlArg );
         cmd.parse(argc, argv);
 
-        ...
 
Once one Arg in the xor list is matched on the CmdLine then the others in the xor list will be marked as @@ -499,7 +490,6 @@ other Arg that was xor'd isSet() will return FALSE. will also return FALSE.)
 
-        ...
 
         if ( fileArg.isSet() )
                 readFile( fileArg.getValue() );
@@ -510,12 +500,11 @@ will also return FALSE.)
                 // required args above has not been set.
                 throw("Very bad things...");
 
-        ...
 
 
-

I have more arguments than single flags make sense -for...

+

I have more arguments than single flags make sense +for...

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 Args 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.
 
-        ...
 
         ValueArg < string >  fileArg("","file","File name",true,"homer","filename");
 
         SwitchArg  caseSwitch("","upperCase","Print in upper case",false);
 
-        ...
 
 
-

I want to constrain the values allowed for a particular -argument...

+

I want to constrain the values allowed for a particular +argument...

There are now constructors for all of the Args that parse values that allow a list of values to be specified for that particular Arg. When the value for the Arg 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:
 
-        ...
-
         vector< string > 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< string > nameArg("n","name","Name to print",true,"homer",allowed);
         cmd.add( nameArg );
 
-        ...
-
 
Instead of a type description being specified in the Arg, a type description is created by concatenating the values in the @@ -576,7 +559,7 @@ description provided with the Arg reflects the constraint you choose.

-

I want the Args to add themselves to the CmdLine...

+

I want the Args to add themselves to the CmdLine...

New constructors have beed added for each Arg that take a CmdLine object as an argument. Each Arg then adds itself to the CmdLine object. There is no @@ -585,7 +568,6 @@ calling the add() method directly. At the moment, there is no way to do an xorAdd() from the constructor. Here is an example:
-        ...
 
         // 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);
 
-        ...
 

Exceptions to the Rules

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

Ignoring arguments

+

Ignoring arguments

The -- flag is automatically included in the CmdLine. As (almost) per POSIX and GNU standards, any argument specified after the -- flag is ignored. Almost because if an @@ -629,7 +610,7 @@ make both UnlabeledValueArgs and UnlabeledMultiArgs ignoreable in their constructors. See the API Documentation for details. -

Multiple Identical Switches

+

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 @@ -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. -

Type Descriptions

+

Type Descriptions

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 AuthorVisitor pointer as follows:
-                ...
 
                 SwitchArg author("a","author","Prints author name", false, 
                                          new AuthorVisitor("Homer J. Simpson") );
                 cmd.add( author );
 
-                ...
 
Now, any time the -a or --author 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 API Documentation and the examples included with the distribution.

-Happy coding!
+
+Happy coding!
+
+


** In theory, any type that supports operator>> and diff --git a/docs/style.css b/docs/style.css new file mode 100755 index 0000000..715bee8 --- /dev/null +++ b/docs/style.css @@ -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; +} +