diff --git a/docs/manual.html b/docs/manual.html index ddcf77b..2804725 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -104,91 +104,91 @@ calls to the getValue() methods of the argument objects.
Here is a simple example ...
-#include < string >
-#include < iostream >
-#include < tclap/CmdLine.h >
+#include <string>
+#include <iostream>
+#include <algorithm>
+#include <tclap/CmdLine.h>
+
+using namespace TCLAP;
 using namespace std;
 
 int main(int argc, char** argv)
 {
-        // Wrap everything in a try block.  Do this every time, 
-        // because exceptions will be thrown for problems. 
-        try {  
+	// Wrap everything in a try block.  Do this every time, 
+	// because exceptions will be thrown for problems. 
+	try {  
 
-        // Define the command line object.
-        CmdLine cmd("Command description message", ' ', "0.9");
+	// Define the command line object.
+	CmdLine cmd("Command description message", ' ', "0.9");
 
-        // (deprecated, but still functional)
-        // CmdLine cmd(argv[0], "Command description message", "0.9"); 
+	// Define a value argument and add it to the command line.
+	ValueArg<string> nameArg("n","name","Name to print",true,"homer","string");
+	cmd.add( nameArg );
 
-        // Define a value argument and add it to the command line.
-        ValueArg < string >  nameArg("n","name","Name to print",true,"homer",
-                                     "nameString");
-        cmd.add( nameArg );
+	// Define a switch and add it to the command line.
+	SwitchArg reverseSwitch("r","reverse","Print name backwards", false);
+	cmd.add( reverseSwitch );
 
-        // Define a switch and add it to the command line.
-        SwitchArg caseSwitch("u","upperCase","Print in upper case", false);
-        cmd.add( caseSwitch );
+	// Parse the args.
+	cmd.parse( argc, argv );
 
-        // Parse the args.
-        cmd.parse( argc, argv );
+	// Get the value parsed by each arg. 
+	string name = nameArg.getValue();
+	bool reverseName = reverseSwitch.getValue();
 
-        // Get the value parsed by each arg. 
-        string name = nameArg.getValue();
-        bool upperCase = caseSwitch.getValue();
+	// Do what you intend too...
+	if ( reverseName )
+	{
+		reverse(name.begin(),name.end());
+		cout << "My name (spelled backwards) is: " << name << endl;
+	}
+	else
+		cout << "My name is: " << name << endl;
 
-        // Do what you intend to...
-        if ( upperCase )
-                transform(name.begin(),name.end(),name.begin(),::toupper);
-        else
-                transform(name.begin(),name.end(),name.begin(),::tolower);
 
-        cout << "My name is " << name << endl;
-
-        } catch (ArgException e)  // catch any exceptions
-        { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+	} catch (ArgException &e)  // catch any exceptions
+	{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
 }
 
+
The output should look like:

 
-% tester -u -n mike
-My name is MIKE
+% test1 -n mike
+My name is: mike
 
-% tester -n mike -u
-My name is MIKE
+% test1 -n mike -r
+My name (spelled backwards) is: ekim
 
-% tester -n mike
-My name is mike
+% test1 -r -n mike
+My name (spelled backwards) is: ekim
 
-% tester -n MIKE
-My name is mike
-
-% tester
+% test1 -r
 PARSE ERROR:
-        One or more required arguments missing!
+             One or more required arguments missing!
 
 Brief USAGE:
-        tester  [-u] -n < string > [--] [-v] [-h]
+   test1  [-r] -n <string> [--] [-v] [-h]
 
 For complete USAGE and HELP type:
-        tester --help
+   test1 --help
 
-% tester --help
+
+% test1 --help
 
 USAGE:
 
-   tester  [-u] -n < string > [--] [-v] [-h]
+   test1  [-r] -n <string> [--] [-v] [-h]
 
 
 Where:
 
-   -u,  --upperCase
-     Print in upper case
+   -r,  --reverse
+     Print name backwards
 
-   -n < string >,  --name < string >
+   -n <string>  --name <string>
      (required)  (value required)  Name to print
 
    --,  --ignore_rest