Changeset 88:18444049848b in lemon-1.2 for lemon
- Timestamp:
- 03/16/08 01:39:19 (17 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- lemon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/arg_parser.cc
r85 r88 70 70 p.type=INTEGER; 71 71 p.mandatory=obl; 72 p.self_delete=true;73 72 _opts[name]=p; 74 73 return *this; … … 100 99 p.mandatory=obl; 101 100 _opts[name]=p; 102 103 value = false;104 105 101 return *this; 106 102 } -
lemon/arg_parser.h
r87 r88 31 31 ///\ingroup misc 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 37 35 namespace lemon { … … 40 38 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 { 45 44 … … 166 165 std::string value="", bool obl=false); 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 170 169 ///into a variable once the option appears in the command line. … … 223 222 224 223 /// You can group some option by calling this function repeatedly for each 225 /// option to be gr upped 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, 229 228 const std::string &opt); … … 243 242 ///Create synonym to an option 244 243 245 ///With this function you can create a sy snonym called \c sysof the244 ///With this function you can create a synonym \c syn of the 246 245 ///option \c opt. 247 246 ArgParser &synonym(const std::string &syn, … … 253 252 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, while254 ///The parameter \c name will be printed in the short usage line, while 256 255 ///\c help gives a more detailed description. 257 256 ArgParser &other(const std::string &name, 258 257 const std::string &help=""); 259 258 260 /// Nonoption type arguments.261 262 ///Give sback a reference to a vector consisting of the program arguments259 ///Give back the non-option type arguments. 260 261 ///Give back a reference to a vector consisting of the program arguments 263 262 ///not starting with a '-' character. 264 263 std::vector<std::string> &files() { return _file_args; } … … 299 298 300 299 ///This is the type of the return value of ArgParser::operator[](). 301 ///It automatically converts to int, double, bool or std::string if302 /// 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 305 304 { … … 356 355 ///Give back the value of an option 357 356 358 ///Give back the value of an option 357 ///Give back the value of an option. 359 358 ///\sa RefType 360 359 RefType operator[](const std::string &n)
Note: See TracChangeset
for help on using the changeset viewer.