1.1 --- a/lemon/arg_parser.h Thu Jul 10 16:13:50 2008 +0200
1.2 +++ b/lemon/arg_parser.h Sat Jul 12 10:21:44 2008 +0200
1.3 @@ -118,13 +118,19 @@
1.4
1.5 public:
1.6
1.7 - ///\e
1.8 + ///Constructor
1.9 ArgParser(int argc, const char **argv);
1.10
1.11 ~ArgParser();
1.12
1.13 + ///\name Options
1.14 + ///
1.15 +
1.16 + ///@{
1.17 +
1.18 ///Add a new integer type option
1.19
1.20 + ///Add a new integer type option.
1.21 ///\param name The name of the option. The leading '-' must be omitted.
1.22 ///\param help A help string.
1.23 ///\param value A default value for the option.
1.24 @@ -135,6 +141,7 @@
1.25
1.26 ///Add a new floating point type option
1.27
1.28 + ///Add a new floating point type option.
1.29 ///\param name The name of the option. The leading '-' must be omitted.
1.30 ///\param help A help string.
1.31 ///\param value A default value for the option.
1.32 @@ -145,6 +152,7 @@
1.33
1.34 ///Add a new bool type option
1.35
1.36 + ///Add a new bool type option.
1.37 ///\param name The name of the option. The leading '-' must be omitted.
1.38 ///\param help A help string.
1.39 ///\param value A default value for the option.
1.40 @@ -156,6 +164,7 @@
1.41
1.42 ///Add a new string type option
1.43
1.44 + ///Add a new string type option.
1.45 ///\param name The name of the option. The leading '-' must be omitted.
1.46 ///\param help A help string.
1.47 ///\param value A default value for the option.
1.48 @@ -164,7 +173,17 @@
1.49 const std::string &help,
1.50 std::string value="", bool obl=false);
1.51
1.52 - ///\name Options with external storage
1.53 + ///Give help string for non-parsed arguments.
1.54 +
1.55 + ///With this function you can give help string for non-parsed arguments.
1.56 + ///The parameter \c name will be printed in the short usage line, while
1.57 + ///\c help gives a more detailed description.
1.58 + ArgParser &other(const std::string &name,
1.59 + const std::string &help="");
1.60 +
1.61 + ///@}
1.62 +
1.63 + ///\name Options with External Storage
1.64 ///Using this functions, the value of the option will be directly written
1.65 ///into a variable once the option appears in the command line.
1.66
1.67 @@ -172,6 +191,7 @@
1.68
1.69 ///Add a new integer type option with a storage reference
1.70
1.71 + ///Add a new integer type option with a storage reference.
1.72 ///\param name The name of the option. The leading '-' must be omitted.
1.73 ///\param help A help string.
1.74 ///\param obl Indicate if the option is mandatory.
1.75 @@ -182,6 +202,7 @@
1.76
1.77 ///Add a new floating type option with a storage reference
1.78
1.79 + ///Add a new floating type option with a storage reference.
1.80 ///\param name The name of the option. The leading '-' must be omitted.
1.81 ///\param help A help string.
1.82 ///\param obl Indicate if the option is mandatory.
1.83 @@ -192,6 +213,7 @@
1.84
1.85 ///Add a new bool type option with a storage reference
1.86
1.87 + ///Add a new bool type option with a storage reference.
1.88 ///\param name The name of the option. The leading '-' must be omitted.
1.89 ///\param help A help string.
1.90 ///\param obl Indicate if the option is mandatory.
1.91 @@ -203,6 +225,7 @@
1.92
1.93 ///Add a new string type option with a storage reference
1.94
1.95 + ///Add a new string type option with a storage reference.
1.96 ///\param name The name of the option. The leading '-' must be omitted.
1.97 ///\param help A help string.
1.98 ///\param obl Indicate if the option is mandatory.
1.99 @@ -218,7 +241,7 @@
1.100
1.101 ///@{
1.102
1.103 - ///Boundle some options into a group
1.104 + ///Bundle some options into a group
1.105
1.106 /// You can group some option by calling this function repeatedly for each
1.107 /// option to be grouped with the same groupname.
1.108 @@ -230,7 +253,7 @@
1.109 ///Make the members of a group exclusive
1.110
1.111 ///If you call this function for a group, than at most one of them can be
1.112 - ///given at the same time
1.113 + ///given at the same time.
1.114 ArgParser &onlyOneGroup(const std::string &group);
1.115
1.116 ///Make a group mandatory
1.117 @@ -248,23 +271,6 @@
1.118
1.119 ///@}
1.120
1.121 - ///Give help string for non-parsed arguments.
1.122 -
1.123 - ///With this function you can give help string for non-parsed arguments.
1.124 - ///The parameter \c name will be printed in the short usage line, while
1.125 - ///\c help gives a more detailed description.
1.126 - ArgParser &other(const std::string &name,
1.127 - const std::string &help="");
1.128 -
1.129 - ///Give back the non-option type arguments.
1.130 -
1.131 - ///Give back a reference to a vector consisting of the program arguments
1.132 - ///not starting with a '-' character.
1.133 - std::vector<std::string> &files() { return _file_args; }
1.134 -
1.135 - ///Give back the command name (the 0th argument)
1.136 - const std::string &commandName() { return _command_name; }
1.137 -
1.138 void show(std::ostream &os,Opts::iterator i);
1.139 void show(std::ostream &os,Groups::iterator i);
1.140 void showHelp(Opts::iterator i);
1.141 @@ -286,6 +292,9 @@
1.142 return parse();
1.143 }
1.144
1.145 + ///Give back the command name (the 0th argument)
1.146 + const std::string &commandName() { return _command_name; }
1.147 +
1.148 ///Check if an opion has been given to the command.
1.149 bool given(std::string op)
1.150 {
1.151 @@ -360,10 +369,14 @@
1.152 {
1.153 return RefType(*this, n);
1.154 }
1.155 +
1.156 + ///Give back the non-option type arguments.
1.157 +
1.158 + ///Give back a reference to a vector consisting of the program arguments
1.159 + ///not starting with a '-' character.
1.160 + std::vector<std::string> &files() { return _file_args; }
1.161
1.162 };
1.163 }
1.164
1.165 -
1.166 -
1.167 -#endif // LEMON_MAIN_PARAMS
1.168 +#endif // LEMON_ARG_PARSER