diff --git a/mrw/arg.cpp b/mrw/arg.cpp index 6dda7ea..b8c960a 100644 --- a/mrw/arg.cpp +++ b/mrw/arg.cpp @@ -9,6 +9,9 @@ @license LGPL, see file COPYING $Log$ + Revision 1.2 2004/11/25 18:26:04 marc + Constness corrected + Revision 1.1 2004/08/28 16:13:42 marc mrw-c++-0.92 (mrw) - new file: version.cpp @@ -72,7 +75,7 @@ namespace mrw { return *this; } - Args& Args::operator<<(const char *const*const argv) throw(std::exception) { + Args& Args::operator<<(char const*const*const argv) throw(std::exception) { if (_argc<0) throw mrw::invalid_argument("argc was not set when shifting argv"); return parse(_argc, argv); @@ -90,7 +93,7 @@ namespace mrw { return *it->second; } - Args& Args::parse(int argc, const char*const*const argv) + Args& Args::parse(int argc, char const*const*const argv) throw(std::exception) { if (argc>0) _filename = argv[0]; for (int i(1); iCOPYING $Log$ + Revision 1.5 2004/11/25 18:26:04 marc + Constness corrected + Revision 1.4 2004/10/07 09:23:39 marc bugs in documentation @@ -84,7 +87,7 @@ namespace mrw { @code // this program may be called e.g. with the following arguments: // ./a.out --coordinates 13 1 -vo out.txt -n MyName - int main(int argv, const char * const * const argv) { + int main(int argv, char const*const*const argv) { try { mrw::Args::instance() // setup the possible options @@ -104,8 +107,12 @@ namespace mrw { // example usage of simple option if (mrw::Args::instance().find('v')) // be verbose here ... - // example usage of option with (one) parameter - ifstream file(mrw::Args::instance().find('o').toString().c_str()); + // example usage of option with one parameter + ifstream file(mrw::Args::instance().find('o')[0]->toString().c_str()); + ... + // example usage of option with two parameter + int x = mrw::Args::instance().find('c')[0]->toInt().c_str()); + int y = mrw::Args::instance().find('c')[1]->toInt().c_str()); ... return 0 } @@ -182,7 +189,7 @@ namespace mrw { Do the same for all other parts Then the @c main() function reduces to: @code - int main(int argc, const char * const * const argv) { + int main(int argc, char const*const*const argv) { // set the help and evaluate the user given arguments mrw::Args::instance() < Options; typedef std::map ShortOpts; typedef std::map LongOpts;