# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1205627959 -3600
# Node ID 18444049848ba4b115c8c54165db97231fc9e04d
# Parent  81e138275860c55ce3ae9cf9a3ab7dd16e61cee2
Minor improvements in arg_parser files

diff -r 81e138275860 -r 18444049848b demo/arg_parser_demo.cc
--- a/demo/arg_parser_demo.cc	Thu Jan 24 17:25:31 2008 +0000
+++ b/demo/arg_parser_demo.cc	Sun Mar 16 01:39:19 2008 +0100
@@ -20,9 +20,9 @@
 ///\file
 ///\brief Argument parser demo
 ///
-/// This example shows how can the argument parser used.
+/// This example shows how the argument parser can be used.
 ///
-/// \include arg_parser.cc
+/// \include arg_parser_demo.cc
 
 #include <lemon/arg_parser.h>
 
@@ -35,21 +35,21 @@
   double d;
   bool b,sil;
   bool g1,g2,g3;
-  ap.refOption("n", "an integer input", i, true)
-    .refOption("val", "a double input", d)
+  ap.refOption("n", "An integer input.", i, true)
+    .refOption("val", "A double input.", d)
     .synonym("vals","val")
-    .refOption("name", "a string input", s)
-    .refOption("f", "a switch", b)
+    .refOption("name", "A string input.", s)
+    .refOption("f", "A switch.", b)
     .refOption("nohelp", "", sil)
-    .refOption("gra","Choise A",g1)
-    .refOption("grb","Choise B",g2)
-    .refOption("grc","Choise C",g3)
+    .refOption("gra","Choice A",g1)
+    .refOption("grb","Choice B",g2)
+    .refOption("grc","Choice C",g3)
     .optionGroup("gr","gra")
     .optionGroup("gr","grb")
     .optionGroup("gr","grc")
     .mandatoryGroup("gr")
     .onlyOneGroup("gr")
-    .other("infile","The input file")
+    .other("infile","The input file.")
     .other("...");
   
   ap.parse();
@@ -61,7 +61,10 @@
   if(ap.given("name")) std::cout << "  Value of -name: " << s << std::endl;
   if(ap.given("f")) std::cout << "  -f is given\n";
   if(ap.given("nohelp")) std::cout << "  Value of -nohelp: " << sil << std::endl;
-
+  if(ap.given("gra")) std::cout << "  -gra is given\n";
+  if(ap.given("grb")) std::cout << "  -grb is given\n";
+  if(ap.given("grc")) std::cout << "  -grc is given\n";
+                                     
   switch(ap.files().size()) {
   case 0:
     std::cout << "  No file argument was given.\n";
diff -r 81e138275860 -r 18444049848b lemon/arg_parser.cc
--- a/lemon/arg_parser.cc	Thu Jan 24 17:25:31 2008 +0000
+++ b/lemon/arg_parser.cc	Sun Mar 16 01:39:19 2008 +0100
@@ -69,7 +69,6 @@
     p.help=help;
     p.type=INTEGER;
     p.mandatory=obl;
-    p.self_delete=true;
     _opts[name]=p;
     return *this;
   }
@@ -99,9 +98,6 @@
     p.type=BOOL;
     p.mandatory=obl;
     _opts[name]=p;
-
-    value = false;
-
     return *this;
   }
 
diff -r 81e138275860 -r 18444049848b lemon/arg_parser.h
--- a/lemon/arg_parser.h	Thu Jan 24 17:25:31 2008 +0000
+++ b/lemon/arg_parser.h	Sun Mar 16 01:39:19 2008 +0100
@@ -30,17 +30,16 @@
 
 ///\ingroup misc
 ///\file
-///\brief A tools to parse command line arguments.
-///
-///\author Alpar Juttner
+///\brief A tool to parse command line arguments.
 
 namespace lemon {
 
   ///Command line arguments parser
 
   ///\ingroup misc
-  ///Command line arguments parser
+  ///Command line arguments parser.
   ///
+  ///For a complete example see the \ref arg_parser_demo.cc demo file.
   class ArgParser {
     
     static void _showHelp(void *p);
@@ -165,7 +164,7 @@
 		      const std::string &help,
 		      std::string value="", bool obl=false);
 
-    ///\name Options with an external strorage.
+    ///\name Options with external storage
     ///Using this functions, the value of the option will be directly written
     ///into a variable once the option appears in the command line.
 
@@ -222,9 +221,9 @@
     ///Boundle some options into a group
 
     /// You can group some option by calling this function repeatedly for each
-    /// option to be grupped with the same groupname.
-    ///\param group The group name
-    ///\param opt The option name
+    /// option to be grouped with the same groupname.
+    ///\param group The group name.
+    ///\param opt The option name.
     ArgParser &optionGroup(const std::string &group,
 			   const std::string &opt);
 
@@ -242,7 +241,7 @@
     
     ///Create synonym to an option
 
-    ///With this function you can create a sysnonym called \c sys of the
+    ///With this function you can create a synonym \c syn of the
     ///option \c opt.
     ArgParser &synonym(const std::string &syn,
 			   const std::string &opt);
@@ -252,14 +251,14 @@
     ///Give help string for non-parsed arguments.
 
     ///With this function you can give help string for non-parsed arguments.
-    ///the parameter \c name will be printed in the short usage line, while
+    ///The parameter \c name will be printed in the short usage line, while
     ///\c help gives a more detailed description.
     ArgParser &other(const std::string &name,
 		     const std::string &help="");
     
-    ///Non option type arguments.
+    ///Give back the non-option type arguments.
 
-    ///Gives back a reference to a vector consisting of the program arguments
+    ///Give back a reference to a vector consisting of the program arguments
     ///not starting with a '-' character.
     std::vector<std::string> &files() { return _file_args; }
 
@@ -298,9 +297,9 @@
     ///Magic type for operator[]
     
     ///This is the type of the return value of ArgParser::operator[]().
-    ///It automatically converts to int, double, bool or std::string if
-    ///the type of the option matches, otherwise it throws an exception.
-    ///(i.e. it performs runtime type checking).
+    ///It automatically converts to \c int, \c double, \c bool or
+    ///\c std::string if the type of the option matches, otherwise it
+    ///throws an exception (i.e. it performs runtime type checking).
     class RefType 
     {
       ArgParser &_parser;
@@ -355,7 +354,7 @@
 
     ///Give back the value of an option
     
-    ///Give back the value of an option
+    ///Give back the value of an option.
     ///\sa RefType
     RefType operator[](const std::string &n)
     {