]> cygwin.com Git - cygwin-apps/setup.git/blame - libgetopt++/include/getopt++/OptionSet.h
Implement paired boolean options
[cygwin-apps/setup.git] / libgetopt++ / include / getopt++ / OptionSet.h
CommitLineData
7419f059
RC
1/*
2 * Copyright (c) 2002 Robert Collins.
20e315e1 3 * Copyright (c) 2003 Robert Collins.
7419f059
RC
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * A copy of the GNU General Public License can be found at
11 * http://www.gnu.org/
12 *
13 * Written by Robert Collins <robertc@hotmail.com>
14 *
15 */
16
17#ifndef _OPTIONSET_H_
18#define _OPTIONSET_H_
19
1ae8e28d 20#include <iosfwd>
6f1abe45 21#include <vector>
1d644c06 22#include "getopt++/Option.h"
7419f059
RC
23
24class OptionSet
25{
26public:
27 OptionSet();
290fdf73 28 virtual ~OptionSet();
1ae8e28d 29 virtual void Register (Option *);
1d644c06
RC
30 virtual bool Process (int argc, char **argv, Option *nonOptionHandler);
31 virtual bool Process (std::vector<std::string> const &parms, Option *nonOptionHandler);
32 virtual bool process (Option *nonOptionHandler);
e930272e 33 virtual void ParameterUsage (std::ostream &);
6f1abe45 34 virtual std::vector<Option *> const &optionsInSet() const;
1d644c06
RC
35 virtual std::vector<std::string> const &nonOptions() const;
36 virtual std::vector<std::string> const &remainingArgv() const;
7419f059
RC
37protected:
38 OptionSet (OptionSet const &);
39 OptionSet &operator= (OptionSet const &);
40 // force initialisation of variables
41 void Init ();
42private:
1d644c06
RC
43 void processOne();
44 bool isOption(std::string::size_type) const;
45 void doOption(std::string &option, std::string::size_type const &pos);
46 bool doNoArgumentOption(std::string &option, std::string::size_type const &pos);
8effde7a
JT
47 void findOption(std::string &option, std::string::size_type const &pos,
48 Option *&theOption, int & prefixIndex) const;
20e315e1 49 std::vector<Option *> options;
1d644c06
RC
50 std::vector<std::string> argv;
51 std::vector<std::string> nonoptions;
52 std::vector<std::string> remainingargv;
53 Option *nonOptionHandler;
54 Option::Result lastResult;
7419f059
RC
55};
56
57#endif // _OPTIONSET_H_
This page took 0.099651 seconds and 5 git commands to generate.