]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2002 Robert Collins. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Robert Collins <robertc@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef _STRINGOPTION_H_ | |
17 | #define _STRINGOPTION_H_ | |
18 | ||
19 | #include <getopt++/Option.h> | |
20 | #include <getopt++/GetOption.h> | |
21 | ||
22 | // Each registered option must implement this class. | |
23 | class StringOption : public Option | |
24 | { | |
25 | public: | |
26 | StringOption(std::string const defaultvalue, char shortopt, char const *longopt = 0, | |
27 | unsigned int shorthelp = 0, bool const optional = true, | |
28 | OptionSet &owner=GetOption::GetInstance()); | |
29 | virtual ~ StringOption (); | |
30 | virtual std::string const shortOption () const; | |
31 | virtual std::string const longOption () const; | |
32 | virtual unsigned int shortHelp () const; | |
33 | virtual Result Process (char const *, int); | |
34 | virtual Argument argument () const; | |
35 | operator const std::string& () const; | |
36 | ||
37 | private: | |
38 | Argument _optional; | |
39 | std::string _value; | |
40 | char _shortopt; | |
41 | char const *_longopt; | |
42 | unsigned int _shorthelp; | |
43 | }; | |
44 | ||
45 | #endif // _STRINGOPTION_H_ |