00001 #ifndef _theplu_yat_utility_option_
00002 #define _theplu_yat_utility_option_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <string>
00027 #include <vector>
00028
00029 namespace theplu {
00030 namespace yat {
00031 namespace utility {
00032
00033 class CommandLine;
00037 class Option
00038 {
00039 public:
00048 Option(CommandLine& cmd, std::string name, std::string desc);
00049
00053 virtual ~Option(void);
00054
00058 std::string description(void) const;
00059
00063 std::string long_name(void) const;
00064
00068 void parse(std::vector<std::string>::iterator&,
00069 const std::vector<std::string>::iterator&);
00070
00076 bool present(void) const;
00077
00091 std::string print(void);
00092
00096 void reset(void);
00097
00101 char short_name(void) const;
00102
00109 void validate(void);
00110
00111 protected:
00115 const CommandLine& cmd(void) const;
00116
00117 private:
00118 virtual void do_parse(std::vector<std::string>::iterator&,
00119 const std::vector<std::string>::iterator&)=0;
00120
00123 virtual std::string print1(void) const;
00124
00127 virtual std::string print2(void) const;
00128
00131 virtual std::string print3(void) const;
00132
00135 virtual std::string print4(void) const;
00136
00139 virtual void do_validate(void) const=0;
00140
00141
00142 const CommandLine& cmd_;
00143 std::string description_;
00144 std::string long_name_;
00145 bool present_;
00146 char short_name_;
00147
00148
00149 Option(const Option&);
00150 Option& operator=(const Option&);
00151 };
00152
00153 }}}
00154
00155 #endif