]>
Commit | Line | Data |
---|---|---|
1ae8e28d RC |
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: | |
e930272e | 26 | StringOption(std::string const defaultvalue, char shortopt, char const *longopt = 0, |
20f237b4 JT |
27 | unsigned int shorthelp = 0, bool const optional = true, |
28 | OptionSet &owner=GetOption::GetInstance()); | |
1ae8e28d | 29 | virtual ~ StringOption (); |
e930272e | 30 | virtual std::string const shortOption () const; |
1d644c06 | 31 | virtual std::string const longOption () const; |
20f237b4 | 32 | virtual unsigned int shortHelp () const; |
8effde7a | 33 | virtual Result Process (char const *, int); |
1d644c06 | 34 | virtual Argument argument () const; |
6af59184 | 35 | operator const std::string& () const; |
1ae8e28d RC |
36 | |
37 | private: | |
1d644c06 | 38 | Argument _optional; |
e930272e | 39 | std::string _value; |
1ae8e28d RC |
40 | char _shortopt; |
41 | char const *_longopt; | |
20f237b4 | 42 | unsigned int _shorthelp; |
1ae8e28d RC |
43 | }; |
44 | ||
45 | #endif // _STRINGOPTION_H_ |