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
00065 void description(const std::string& description);
00066
00070 std::string long_name(void) const;
00071
00075 void parse(std::vector<std::string>::iterator&,
00076 const std::vector<std::string>::iterator&);
00077
00083 bool present(void) const;
00084
00098 std::string print(void);
00099
00103 void reset(void);
00104
00108 char short_name(void) const;
00109
00116 void validate(void);
00117
00118 protected:
00122 const CommandLine& cmd(void) const;
00123
00124 private:
00125 virtual void do_parse(std::vector<std::string>::iterator&,
00126 const std::vector<std::string>::iterator&)=0;
00127
00130 virtual std::string print1(void) const;
00131
00134 virtual std::string print2(void) const;
00135
00138 virtual std::string print3(void) const;
00139
00142 virtual std::string print4(void) const;
00143
00146 virtual void do_validate(void) const=0;
00147
00148
00149 const CommandLine& cmd_;
00150 std::string description_;
00151 std::string long_name_;
00152 bool present_;
00153 char short_name_;
00154
00155
00156 Option(const Option&);
00157 Option& operator=(const Option&);
00158 };
00159
00160 }}}
00161
00162 #endif