Changeset 1630 for trunk/yat/utility/OptionArg.h
- Timestamp:
- Nov 17, 2008, 11:11:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/OptionArg.h
r1629 r1630 27 27 #include "CommandLine.h" 28 28 #include "Exception.h" 29 #include "utility.h" 29 30 30 31 #include <string> … … 52 53 \brief Constructor 53 54 54 \param cmd Commandline Option is associated with \param name 55 string such as "help" for --help, "h" for -h or "h,help" for 56 having both short and long option name \param desc string used 57 in help display \param required If true option must be found in 58 commandline or exception is thrown in validation \param arg 59 string to be used in help output such as `TARGET' in 60 `--target=TARGET'. See print3(). 55 \param cmd Commandline Option is associated with 56 \param name string such as "help" for --help, "h" for -h or 57 "h,help" for having both short and long option name 58 \param desc string used in help display 59 \param required If true option must be found in commandline or 60 exception is thrown in validation 61 \param arg string to be used in help output such as `TARGET' in 62 `--target=TARGET'. See print3(). New in yat 0.5. 61 63 */ 62 64 OptionArg(CommandLine& cmd, std::string name, std::string desc, … … 125 127 void assign(T1& lhs, std::string rhs ) 126 128 { 127 std::stringstream ss(rhs); 128 ss >> lhs; 129 bool fail = ss.fail(); 130 std::string str; 131 ss >> str; 132 if (fail || str.size()) { 129 try { 130 lhs = convert<T1>(rhs); 131 } 132 catch (std::runtime_error& e) { 133 133 std::stringstream sstr(rhs); 134 134 sstr << ": invalid argument";
Note: See TracChangeset
for help on using the changeset viewer.