gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Minor improvements in arg_parser files
0 3 0
default
3 files changed with 29 insertions and 31 deletions:
↑ Collapse diff ↑
Show white space 6 line context
... ...
@@ -22,5 +22,5 @@
22 22
///
23
/// This example shows how can the argument parser used.
23
/// This example shows how the argument parser can be used.
24 24
///
25
/// \include arg_parser.cc
25
/// \include arg_parser_demo.cc
26 26

	
... ...
@@ -37,11 +37,11 @@
37 37
  bool g1,g2,g3;
38
  ap.refOption("n", "an integer input", i, true)
39
    .refOption("val", "a double input", d)
38
  ap.refOption("n", "An integer input.", i, true)
39
    .refOption("val", "A double input.", d)
40 40
    .synonym("vals","val")
41
    .refOption("name", "a string input", s)
42
    .refOption("f", "a switch", b)
41
    .refOption("name", "A string input.", s)
42
    .refOption("f", "A switch.", b)
43 43
    .refOption("nohelp", "", sil)
44
    .refOption("gra","Choise A",g1)
45
    .refOption("grb","Choise B",g2)
46
    .refOption("grc","Choise C",g3)
44
    .refOption("gra","Choice A",g1)
45
    .refOption("grb","Choice B",g2)
46
    .refOption("grc","Choice C",g3)
47 47
    .optionGroup("gr","gra")
... ...
@@ -51,3 +51,3 @@
51 51
    .onlyOneGroup("gr")
52
    .other("infile","The input file")
52
    .other("infile","The input file.")
53 53
    .other("...");
... ...
@@ -63,3 +63,6 @@
63 63
  if(ap.given("nohelp")) std::cout << "  Value of -nohelp: " << sil << std::endl;
64

	
64
  if(ap.given("gra")) std::cout << "  -gra is given\n";
65
  if(ap.given("grb")) std::cout << "  -grb is given\n";
66
  if(ap.given("grc")) std::cout << "  -grc is given\n";
67
                                     
65 68
  switch(ap.files().size()) {
Ignore white space 6 line context
... ...
@@ -71,3 +71,2 @@
71 71
    p.mandatory=obl;
72
    p.self_delete=true;
73 72
    _opts[name]=p;
... ...
@@ -101,5 +100,2 @@
101 100
    _opts[name]=p;
102

	
103
    value = false;
104

	
105 101
    return *this;
Ignore white space 6 line context
... ...
@@ -32,5 +32,3 @@
32 32
///\file
33
///\brief A tools to parse command line arguments.
34
///
35
///\author Alpar Juttner
33
///\brief A tool to parse command line arguments.
36 34

	
... ...
@@ -41,4 +39,5 @@
41 39
  ///\ingroup misc
42
  ///Command line arguments parser
40
  ///Command line arguments parser.
43 41
  ///
42
  ///For a complete example see the \ref arg_parser_demo.cc demo file.
44 43
  class ArgParser {
... ...
@@ -167,3 +166,3 @@
167 166

	
168
    ///\name Options with an external strorage.
167
    ///\name Options with external storage
169 168
    ///Using this functions, the value of the option will be directly written
... ...
@@ -224,5 +223,5 @@
224 223
    /// You can group some option by calling this function repeatedly for each
225
    /// option to be grupped with the same groupname.
226
    ///\param group The group name
227
    ///\param opt The option name
224
    /// option to be grouped with the same groupname.
225
    ///\param group The group name.
226
    ///\param opt The option name.
228 227
    ArgParser &optionGroup(const std::string &group,
... ...
@@ -244,3 +243,3 @@
244 243

	
245
    ///With this function you can create a sysnonym called \c sys of the
244
    ///With this function you can create a synonym \c syn of the
246 245
    ///option \c opt.
... ...
@@ -254,3 +253,3 @@
254 253
    ///With this function you can give help string for non-parsed arguments.
255
    ///the parameter \c name will be printed in the short usage line, while
254
    ///The parameter \c name will be printed in the short usage line, while
256 255
    ///\c help gives a more detailed description.
... ...
@@ -259,5 +258,5 @@
259 258
    
260
    ///Non option type arguments.
259
    ///Give back the non-option type arguments.
261 260

	
262
    ///Gives back a reference to a vector consisting of the program arguments
261
    ///Give back a reference to a vector consisting of the program arguments
263 262
    ///not starting with a '-' character.
... ...
@@ -300,5 +299,5 @@
300 299
    ///This is the type of the return value of ArgParser::operator[]().
301
    ///It automatically converts to int, double, bool or std::string if
302
    ///the type of the option matches, otherwise it throws an exception.
303
    ///(i.e. it performs runtime type checking).
300
    ///It automatically converts to \c int, \c double, \c bool or
301
    ///\c std::string if the type of the option matches, otherwise it
302
    ///throws an exception (i.e. it performs runtime type checking).
304 303
    class RefType 
... ...
@@ -357,3 +356,3 @@
357 356
    
358
    ///Give back the value of an option
357
    ///Give back the value of an option.
359 358
    ///\sa RefType
0 comments (0 inline)