]> Creatis software - clitk.git/blob - utilities/gengetopt/skels/generic_option.h
Sync gengetopt cmake files with rtk
[clitk.git] / utilities / gengetopt / skels / generic_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 GENERIC_OPTION_GEN_CLASS_H
8 #define GENERIC_OPTION_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class generic_option_gen_class
17 {
18  protected:
19   string arg_type;
20   string default_value;
21   string final_instructions;
22   string gen_else;
23   string group_var_name;
24   bool has_short_option;
25   string long_option;
26   bool multiple;
27   string option_comment;
28   bool option_has_group;
29   bool option_has_mode;
30   bool option_has_type;
31   string option_var_name;
32   string possible_values;
33   string short_option;
34   string structure;
35
36  public:
37   generic_option_gen_class() :
38     has_short_option (false), multiple (false), option_has_group (false), option_has_mode (false), option_has_type (false)
39   {
40   }
41   
42   generic_option_gen_class(const string &_arg_type, const string &_default_value, const string &_final_instructions, const string &_gen_else, const string &_group_var_name, bool _has_short_option, const string &_long_option, bool _multiple, const string &_option_comment, bool _option_has_group, bool _option_has_mode, bool _option_has_type, const string &_option_var_name, const string &_possible_values, const string &_short_option, const string &_structure) :
43     arg_type (_arg_type), default_value (_default_value), final_instructions (_final_instructions), gen_else (_gen_else), group_var_name (_group_var_name), has_short_option (_has_short_option), long_option (_long_option), multiple (_multiple), option_comment (_option_comment), option_has_group (_option_has_group), option_has_mode (_option_has_mode), option_has_type (_option_has_type), option_var_name (_option_var_name), possible_values (_possible_values), short_option (_short_option), structure (_structure)
44   {
45   }
46
47   static void
48   generate_string(const string &s, ostream &stream, unsigned int indent)
49   {
50     if (!indent || s.find('\n') == string::npos)
51       {
52         stream << s;
53         return;
54       }
55
56     string::size_type pos;
57     string::size_type start = 0;
58     string ind (indent, ' ');
59     while ( (pos=s.find('\n', start)) != string::npos)
60       {
61         stream << s.substr (start, (pos+1)-start);
62         start = pos+1;
63         if (start+1 <= s.size ())
64           stream << ind;
65       }
66     if (start+1 <= s.size ())
67       stream << s.substr (start);
68   }
69
70   void set_arg_type(const string &_arg_type)
71   {
72     arg_type = _arg_type;
73   }
74
75   void set_default_value(const string &_default_value)
76   {
77     default_value = _default_value;
78   }
79
80   void set_final_instructions(const string &_final_instructions)
81   {
82     final_instructions = _final_instructions;
83   }
84
85   void set_gen_else(const string &_gen_else)
86   {
87     gen_else = _gen_else;
88   }
89
90   void set_group_var_name(const string &_group_var_name)
91   {
92     group_var_name = _group_var_name;
93   }
94
95   void set_has_short_option(bool _has_short_option)
96   {
97     has_short_option = _has_short_option;
98   }
99
100   void set_long_option(const string &_long_option)
101   {
102     long_option = _long_option;
103   }
104
105   void set_multiple(bool _multiple)
106   {
107     multiple = _multiple;
108   }
109
110   void set_option_comment(const string &_option_comment)
111   {
112     option_comment = _option_comment;
113   }
114
115   void set_option_has_group(bool _option_has_group)
116   {
117     option_has_group = _option_has_group;
118   }
119
120   void set_option_has_mode(bool _option_has_mode)
121   {
122     option_has_mode = _option_has_mode;
123   }
124
125   void set_option_has_type(bool _option_has_type)
126   {
127     option_has_type = _option_has_type;
128   }
129
130   void set_option_var_name(const string &_option_var_name)
131   {
132     option_var_name = _option_var_name;
133   }
134
135   void set_possible_values(const string &_possible_values)
136   {
137     possible_values = _possible_values;
138   }
139
140   void set_short_option(const string &_short_option)
141   {
142     short_option = _short_option;
143   }
144
145   void set_structure(const string &_structure)
146   {
147     structure = _structure;
148   }
149
150   void generate_generic_option(ostream &stream, unsigned int indent = 0);
151   
152 };
153
154 #endif // GENERIC_OPTION_GEN_CLASS_H