/* * Copyright (c) 2002 Robert Collins. * Copyright (c) 2003 Robert Collins. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * A copy of the GNU General Public License can be found at * http://www.gnu.org/ * * Written by Robert Collins * */ #if HAVE_CONFIG_H #include "autoconf.h" #endif #include "getopt++/OptionSet.h" #include "getopt++/Option.h" #include "getopt++/DefaultFormatter.h" #include using namespace std; bool OptionSet::isOption(string::size_type pos) const { return pos == 1 || pos == 2; } void OptionSet::processOne() { string &option (argv[0]); string::size_type pos = option.find_first_not_of("-"); if (!isOption(pos)) { /* Push the non option into storage */ if (nonOptionHandler) { lastResult = nonOptionHandler->Process(option.c_str()); } else { nonoptions.push_back(option); lastResult = Option::Ok; } } else { doOption(option, pos); } } Option * OptionSet::findOption(string &option, string::size_type const &pos) const { Option *theOption = NULL; for (std::vector