]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/required_option.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / required_option.h
1 /*
2  * File automatically generated by
3  * gengen 1.2 by Lorenzo Bettini 
4  * http://www.gnu.org/software/gengen
5  */
6
7 #ifndef REQUIRED_OPTION_GEN_CLASS_H
8 #define REQUIRED_OPTION_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class required_option_gen_class
17 {
18  protected:
19   bool checkrange;
20   string mode_condition;
21   string option_descr;
22   string option_var_name;
23   string package_var_name;
24
25  public:
26   required_option_gen_class() :
27     checkrange (false)
28   {
29   }
30   
31   required_option_gen_class(bool _checkrange, const string &_mode_condition, const string &_option_descr, const string &_option_var_name, const string &_package_var_name) :
32     checkrange (_checkrange), mode_condition (_mode_condition), option_descr (_option_descr), option_var_name (_option_var_name), package_var_name (_package_var_name)
33   {
34   }
35
36   static void
37   generate_string(const string &s, ostream &stream, unsigned int indent)
38   {
39     if (!indent || s.find('\n') == string::npos)
40       {
41         stream << s;
42         return;
43       }
44
45     string::size_type pos;
46     string::size_type start = 0;
47     string ind (indent, ' ');
48     while ( (pos=s.find('\n', start)) != string::npos)
49       {
50         stream << s.substr (start, (pos+1)-start);
51         start = pos+1;
52         if (start+1 <= s.size ())
53           stream << ind;
54       }
55     if (start+1 <= s.size ())
56       stream << s.substr (start);
57   }
58
59   void set_checkrange(bool _checkrange)
60   {
61     checkrange = _checkrange;
62   }
63
64   void set_mode_condition(const string &_mode_condition)
65   {
66     mode_condition = _mode_condition;
67   }
68
69   void set_option_descr(const string &_option_descr)
70   {
71     option_descr = _option_descr;
72   }
73
74   void set_option_var_name(const string &_option_var_name)
75   {
76     option_var_name = _option_var_name;
77   }
78
79   void set_package_var_name(const string &_package_var_name)
80   {
81     package_var_name = _package_var_name;
82   }
83
84   void generate_required_option(ostream &stream, unsigned int indent = 0);
85   
86 };
87
88 #endif // REQUIRED_OPTION_GEN_CLASS_H