]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/dependant_option.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / dependant_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 DEPENDANT_OPTION_GEN_CLASS_H
8 #define DEPENDANT_OPTION_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class dependant_option_gen_class
17 {
18  protected:
19   string dep_option;
20   string dep_option_descr;
21   string option_descr;
22   string option_var_name;
23   string package_var_name;
24
25  public:
26   dependant_option_gen_class()
27   {
28   }
29   
30   dependant_option_gen_class(const string &_dep_option, const string &_dep_option_descr, const string &_option_descr, const string &_option_var_name, const string &_package_var_name) :
31     dep_option (_dep_option), dep_option_descr (_dep_option_descr), option_descr (_option_descr), option_var_name (_option_var_name), package_var_name (_package_var_name)
32   {
33   }
34
35   static void
36   generate_string(const string &s, ostream &stream, unsigned int indent)
37   {
38     if (!indent || s.find('\n') == string::npos)
39       {
40         stream << s;
41         return;
42       }
43
44     string::size_type pos;
45     string::size_type start = 0;
46     string ind (indent, ' ');
47     while ( (pos=s.find('\n', start)) != string::npos)
48       {
49         stream << s.substr (start, (pos+1)-start);
50         start = pos+1;
51         if (start+1 <= s.size ())
52           stream << ind;
53       }
54     if (start+1 <= s.size ())
55       stream << s.substr (start);
56   }
57
58   void set_dep_option(const string &_dep_option)
59   {
60     dep_option = _dep_option;
61   }
62
63   void set_dep_option_descr(const string &_dep_option_descr)
64   {
65     dep_option_descr = _dep_option_descr;
66   }
67
68   void set_option_descr(const string &_option_descr)
69   {
70     option_descr = _option_descr;
71   }
72
73   void set_option_var_name(const string &_option_var_name)
74   {
75     option_var_name = _option_var_name;
76   }
77
78   void set_package_var_name(const string &_package_var_name)
79   {
80     package_var_name = _package_var_name;
81   }
82
83   void generate_dependant_option(ostream &stream, unsigned int indent = 0);
84   
85 };
86
87 #endif // DEPENDANT_OPTION_GEN_CLASS_H