/*
 *
 *
 *    getopt.cc
 *
 *    C++ file for options classes source code.
 *
 *    =========================================================================
 *
 *    Copyright (C) 2001-2003 by Matt Roberts, KK5JY.
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation; either
 *    version 2.1 of the License, or (at your option) any later version.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *    =========================================================================
 *
 *
 *
 */

#include <my++/stype.h>
#include <my++/getopt.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

void my::options::constructor_code (const char *opts, const char **long_opts) {
	unsigned i;
	char *cur, *end;

	if (opts) {
		cur = opts;
		end = opts + strlen(opts);

		while (cur != end) {
			switch (*cur) {
				// for an ':' operator, change the requirements of the option argument
				case ':':
					if (optlist.size()) {
						switch (optlist.front().opt_req) {
							case my::options::option::opt_required:
								optlist.front().opt_reg = my::options::option::opt_optional;
								break;
							case my::options::option::opt_none:
								optlist.front().opt_reg = my::options::option::opt_required;
								break;
							case my::options::option::opt_optional:
								throw my::options::exception("too many \':\' operators in short option list");
						}
					} else {
						throw my::options::exception("\':\' operator must follow short option");
					}
					break;

				default:

			}

			// move to the next letter
			++cur;
		}
	}
}

const std::string my::options::get (const std::string &name) const {
}

bool my::options::is_set (const std::string &name) const {
}

bool my::options::set (int argc, char **argv) {
}


