]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/c_source.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / c_source.h
1 /*
2  * File automatically generated by
3  * gengen 1.4.1 by Lorenzo Bettini 
4  * http://www.gnu.org/software/gengen
5  */
6
7 #ifndef C_SOURCE_GEN_CLASS_H
8 #define C_SOURCE_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class c_source_gen_class
17 {
18  protected:
19   string args_info;
20   string check_modes;
21   bool check_possible_values;
22   bool check_required_options;
23   string clear_arg;
24   bool cmd_list;
25   string command_line;
26   bool conf_parser;
27   string custom_getopt;
28   string description;
29   string detailed_help_option_print;
30   bool do_generate_strdup;
31   string file_save_loop;
32   string final_exit;
33   string free;
34   string full_help_option_print;
35   bool generate_string_parser;
36   string generator_version;
37   string getopt_string;
38   string given_init;
39   string handle_dependencies;
40   string handle_group;
41   string handle_no_short_option;
42   string handle_option;
43   bool handle_question_mark;
44   string handle_required;
45   bool handle_unamed;
46   bool has_arg_double;
47   bool has_arg_enum;
48   bool has_arg_flag;
49   bool has_arg_float;
50   bool has_arg_int;
51   bool has_arg_long;
52   bool has_arg_longdouble;
53   bool has_arg_longlong;
54   bool has_arg_short;
55   bool has_arg_string;
56   bool has_details;
57   bool has_hidden;
58   bool has_modes;
59   bool has_typed_options;
60   string header_file_ext;
61   string help_option_print;
62   string help_string_num;
63   bool include_getopt;
64   string init_args_info;
65   string list_def;
66   string list_free;
67   string long_option_struct;
68   string multiple_fill_array;
69   bool multiple_options;
70   bool multiple_options_all_string;
71   bool multiple_options_string;
72   bool multiple_options_with_default;
73   bool multiple_token_functions;
74   bool no_options;
75   bool no_package;
76   string option_values;
77   string package_var_name;
78   string parser_name;
79   string purpose;
80   string reset_groups;
81   string source_name;
82   string update_multiple_given;
83   string usage_string;
84   string version_var_name;
85
86  public:
87   c_source_gen_class() :
88     check_possible_values (false), check_required_options (false), cmd_list (false), conf_parser (false), do_generate_strdup (false), generate_string_parser (false), handle_question_mark (false), handle_unamed (false), has_arg_double (false), has_arg_enum (false), has_arg_flag (false), has_arg_float (false), has_arg_int (false), has_arg_long (false), has_arg_longdouble (false), has_arg_longlong (false), has_arg_short (false), has_arg_string (false), has_details (false), has_hidden (false), has_modes (false), has_typed_options (false), include_getopt (false), multiple_options (false), multiple_options_all_string (false), multiple_options_string (false), multiple_options_with_default (false), multiple_token_functions (false), no_options (false), no_package (false)
89   {
90   }
91   
92   c_source_gen_class(const string &_args_info, const string &_check_modes, bool _check_possible_values, bool _check_required_options, const string &_clear_arg, bool _cmd_list, const string &_command_line, bool _conf_parser, const string &_custom_getopt, const string &_description, const string &_detailed_help_option_print, bool _do_generate_strdup, const string &_file_save_loop, const string &_final_exit, const string &_free, const string &_full_help_option_print, bool _generate_string_parser, const string &_generator_version, const string &_getopt_string, const string &_given_init, const string &_handle_dependencies, const string &_handle_group, const string &_handle_no_short_option, const string &_handle_option, bool _handle_question_mark, const string &_handle_required, bool _handle_unamed, bool _has_arg_double, bool _has_arg_enum, bool _has_arg_flag, bool _has_arg_float, bool _has_arg_int, bool _has_arg_long, bool _has_arg_longdouble, bool _has_arg_longlong, bool _has_arg_short, bool _has_arg_string, bool _has_details, bool _has_hidden, bool _has_modes, bool _has_typed_options, const string &_header_file_ext, const string &_help_option_print, const string &_help_string_num, bool _include_getopt, const string &_init_args_info, const string &_list_def, const string &_list_free, const string &_long_option_struct, const string &_multiple_fill_array, bool _multiple_options, bool _multiple_options_all_string, bool _multiple_options_string, bool _multiple_options_with_default, bool _multiple_token_functions, bool _no_options, bool _no_package, const string &_option_values, const string &_package_var_name, const string &_parser_name, const string &_purpose, const string &_reset_groups, const string &_source_name, const string &_update_multiple_given, const string &_usage_string, const string &_version_var_name) :
93     args_info (_args_info), check_modes (_check_modes), check_possible_values (_check_possible_values), check_required_options (_check_required_options), clear_arg (_clear_arg), cmd_list (_cmd_list), command_line (_command_line), conf_parser (_conf_parser), custom_getopt (_custom_getopt), description (_description), detailed_help_option_print (_detailed_help_option_print), do_generate_strdup (_do_generate_strdup), file_save_loop (_file_save_loop), final_exit (_final_exit), free (_free), full_help_option_print (_full_help_option_print), generate_string_parser (_generate_string_parser), generator_version (_generator_version), getopt_string (_getopt_string), given_init (_given_init), handle_dependencies (_handle_dependencies), handle_group (_handle_group), handle_no_short_option (_handle_no_short_option), handle_option (_handle_option), handle_question_mark (_handle_question_mark), handle_required (_handle_required), handle_unamed (_handle_unamed), has_arg_double (_has_arg_double), has_arg_enum (_has_arg_enum), has_arg_flag (_has_arg_flag), has_arg_float (_has_arg_float), has_arg_int (_has_arg_int), has_arg_long (_has_arg_long), has_arg_longdouble (_has_arg_longdouble), has_arg_longlong (_has_arg_longlong), has_arg_short (_has_arg_short), has_arg_string (_has_arg_string), has_details (_has_details), has_hidden (_has_hidden), has_modes (_has_modes), has_typed_options (_has_typed_options), header_file_ext (_header_file_ext), help_option_print (_help_option_print), help_string_num (_help_string_num), include_getopt (_include_getopt), init_args_info (_init_args_info), list_def (_list_def), list_free (_list_free), long_option_struct (_long_option_struct), multiple_fill_array (_multiple_fill_array), multiple_options (_multiple_options), multiple_options_all_string (_multiple_options_all_string), multiple_options_string (_multiple_options_string), multiple_options_with_default (_multiple_options_with_default), multiple_token_functions (_multiple_token_functions), no_options (_no_options), no_package (_no_package), option_values (_option_values), package_var_name (_package_var_name), parser_name (_parser_name), purpose (_purpose), reset_groups (_reset_groups), source_name (_source_name), update_multiple_given (_update_multiple_given), usage_string (_usage_string), version_var_name (_version_var_name)
94   {
95   }
96
97   virtual ~c_source_gen_class()
98   {
99   }
100
101   static void
102   generate_string(const string &s, ostream &stream, unsigned int indent)
103   {
104     if (!indent || s.find('\n') == string::npos)
105       {
106         stream << s;
107         return;
108       }
109
110     string::size_type pos;
111     string::size_type start = 0;
112     string ind (indent, ' ');
113     while ( (pos=s.find('\n', start)) != string::npos)
114       {
115         stream << s.substr (start, (pos+1)-start);
116         start = pos+1;
117         if (start+1 <= s.size ())
118           stream << ind;
119       }
120     if (start+1 <= s.size ())
121       stream << s.substr (start);
122   }
123
124   void set_args_info(const string &_args_info)
125   {
126     args_info = _args_info;
127   }
128
129   virtual void generate_check_modes(ostream &stream, unsigned int indent) = 0;
130
131   void set_check_modes(const string &_check_modes)
132   {
133     check_modes = _check_modes;
134   }
135
136   void set_check_possible_values(bool _check_possible_values)
137   {
138     check_possible_values = _check_possible_values;
139   }
140
141   void set_check_required_options(bool _check_required_options)
142   {
143     check_required_options = _check_required_options;
144   }
145
146   virtual void generate_clear_arg(ostream &stream, unsigned int indent) = 0;
147
148   void set_clear_arg(const string &_clear_arg)
149   {
150     clear_arg = _clear_arg;
151   }
152
153   void set_cmd_list(bool _cmd_list)
154   {
155     cmd_list = _cmd_list;
156   }
157
158   void set_command_line(const string &_command_line)
159   {
160     command_line = _command_line;
161   }
162
163   void set_conf_parser(bool _conf_parser)
164   {
165     conf_parser = _conf_parser;
166   }
167
168   virtual void generate_custom_getopt(ostream &stream, unsigned int indent) = 0;
169
170   void set_custom_getopt(const string &_custom_getopt)
171   {
172     custom_getopt = _custom_getopt;
173   }
174
175   void set_description(const string &_description)
176   {
177     description = _description;
178   }
179
180   virtual void generate_detailed_help_option_print(ostream &stream, unsigned int indent) = 0;
181
182   void set_detailed_help_option_print(const string &_detailed_help_option_print)
183   {
184     detailed_help_option_print = _detailed_help_option_print;
185   }
186
187   void set_do_generate_strdup(bool _do_generate_strdup)
188   {
189     do_generate_strdup = _do_generate_strdup;
190   }
191
192   virtual void generate_file_save_loop(ostream &stream, unsigned int indent) = 0;
193
194   void set_file_save_loop(const string &_file_save_loop)
195   {
196     file_save_loop = _file_save_loop;
197   }
198
199   void set_final_exit(const string &_final_exit)
200   {
201     final_exit = _final_exit;
202   }
203
204   virtual void generate_free(ostream &stream, unsigned int indent) = 0;
205
206   void set_free(const string &_free)
207   {
208     free = _free;
209   }
210
211   virtual void generate_full_help_option_print(ostream &stream, unsigned int indent) = 0;
212
213   void set_full_help_option_print(const string &_full_help_option_print)
214   {
215     full_help_option_print = _full_help_option_print;
216   }
217
218   void set_generate_string_parser(bool _generate_string_parser)
219   {
220     generate_string_parser = _generate_string_parser;
221   }
222
223   void set_generator_version(const string &_generator_version)
224   {
225     generator_version = _generator_version;
226   }
227
228   void set_getopt_string(const string &_getopt_string)
229   {
230     getopt_string = _getopt_string;
231   }
232
233   virtual void generate_given_init(ostream &stream, unsigned int indent) = 0;
234
235   void set_given_init(const string &_given_init)
236   {
237     given_init = _given_init;
238   }
239
240   virtual void generate_handle_dependencies(ostream &stream, unsigned int indent) = 0;
241
242   void set_handle_dependencies(const string &_handle_dependencies)
243   {
244     handle_dependencies = _handle_dependencies;
245   }
246
247   virtual void generate_handle_group(ostream &stream, unsigned int indent) = 0;
248
249   void set_handle_group(const string &_handle_group)
250   {
251     handle_group = _handle_group;
252   }
253
254   virtual void generate_handle_no_short_option(ostream &stream, unsigned int indent) = 0;
255
256   void set_handle_no_short_option(const string &_handle_no_short_option)
257   {
258     handle_no_short_option = _handle_no_short_option;
259   }
260
261   virtual void generate_handle_option(ostream &stream, unsigned int indent) = 0;
262
263   void set_handle_option(const string &_handle_option)
264   {
265     handle_option = _handle_option;
266   }
267
268   void set_handle_question_mark(bool _handle_question_mark)
269   {
270     handle_question_mark = _handle_question_mark;
271   }
272
273   virtual void generate_handle_required(ostream &stream, unsigned int indent) = 0;
274
275   void set_handle_required(const string &_handle_required)
276   {
277     handle_required = _handle_required;
278   }
279
280   void set_handle_unamed(bool _handle_unamed)
281   {
282     handle_unamed = _handle_unamed;
283   }
284
285   void set_has_arg_double(bool _has_arg_double)
286   {
287     has_arg_double = _has_arg_double;
288   }
289
290   void set_has_arg_enum(bool _has_arg_enum)
291   {
292     has_arg_enum = _has_arg_enum;
293   }
294
295   void set_has_arg_flag(bool _has_arg_flag)
296   {
297     has_arg_flag = _has_arg_flag;
298   }
299
300   void set_has_arg_float(bool _has_arg_float)
301   {
302     has_arg_float = _has_arg_float;
303   }
304
305   void set_has_arg_int(bool _has_arg_int)
306   {
307     has_arg_int = _has_arg_int;
308   }
309
310   void set_has_arg_long(bool _has_arg_long)
311   {
312     has_arg_long = _has_arg_long;
313   }
314
315   void set_has_arg_longdouble(bool _has_arg_longdouble)
316   {
317     has_arg_longdouble = _has_arg_longdouble;
318   }
319
320   void set_has_arg_longlong(bool _has_arg_longlong)
321   {
322     has_arg_longlong = _has_arg_longlong;
323   }
324
325   void set_has_arg_short(bool _has_arg_short)
326   {
327     has_arg_short = _has_arg_short;
328   }
329
330   void set_has_arg_string(bool _has_arg_string)
331   {
332     has_arg_string = _has_arg_string;
333   }
334
335   void set_has_details(bool _has_details)
336   {
337     has_details = _has_details;
338   }
339
340   void set_has_hidden(bool _has_hidden)
341   {
342     has_hidden = _has_hidden;
343   }
344
345   void set_has_modes(bool _has_modes)
346   {
347     has_modes = _has_modes;
348   }
349
350   void set_has_typed_options(bool _has_typed_options)
351   {
352     has_typed_options = _has_typed_options;
353   }
354
355   void set_header_file_ext(const string &_header_file_ext)
356   {
357     header_file_ext = _header_file_ext;
358   }
359
360   virtual void generate_help_option_print(ostream &stream, unsigned int indent) = 0;
361
362   void set_help_option_print(const string &_help_option_print)
363   {
364     help_option_print = _help_option_print;
365   }
366
367   void set_help_string_num(const string &_help_string_num)
368   {
369     help_string_num = _help_string_num;
370   }
371
372   void set_include_getopt(bool _include_getopt)
373   {
374     include_getopt = _include_getopt;
375   }
376
377   virtual void generate_init_args_info(ostream &stream, unsigned int indent) = 0;
378
379   void set_init_args_info(const string &_init_args_info)
380   {
381     init_args_info = _init_args_info;
382   }
383
384   virtual void generate_list_def(ostream &stream, unsigned int indent) = 0;
385
386   void set_list_def(const string &_list_def)
387   {
388     list_def = _list_def;
389   }
390
391   virtual void generate_list_free(ostream &stream, unsigned int indent) = 0;
392
393   void set_list_free(const string &_list_free)
394   {
395     list_free = _list_free;
396   }
397
398   virtual void generate_long_option_struct(ostream &stream, unsigned int indent) = 0;
399
400   void set_long_option_struct(const string &_long_option_struct)
401   {
402     long_option_struct = _long_option_struct;
403   }
404
405   virtual void generate_multiple_fill_array(ostream &stream, unsigned int indent) = 0;
406
407   void set_multiple_fill_array(const string &_multiple_fill_array)
408   {
409     multiple_fill_array = _multiple_fill_array;
410   }
411
412   void set_multiple_options(bool _multiple_options)
413   {
414     multiple_options = _multiple_options;
415   }
416
417   void set_multiple_options_all_string(bool _multiple_options_all_string)
418   {
419     multiple_options_all_string = _multiple_options_all_string;
420   }
421
422   void set_multiple_options_string(bool _multiple_options_string)
423   {
424     multiple_options_string = _multiple_options_string;
425   }
426
427   void set_multiple_options_with_default(bool _multiple_options_with_default)
428   {
429     multiple_options_with_default = _multiple_options_with_default;
430   }
431
432   void set_multiple_token_functions(bool _multiple_token_functions)
433   {
434     multiple_token_functions = _multiple_token_functions;
435   }
436
437   void set_no_options(bool _no_options)
438   {
439     no_options = _no_options;
440   }
441
442   void set_no_package(bool _no_package)
443   {
444     no_package = _no_package;
445   }
446
447   virtual void generate_option_values(ostream &stream, unsigned int indent) = 0;
448
449   void set_option_values(const string &_option_values)
450   {
451     option_values = _option_values;
452   }
453
454   void set_package_var_name(const string &_package_var_name)
455   {
456     package_var_name = _package_var_name;
457   }
458
459   void set_parser_name(const string &_parser_name)
460   {
461     parser_name = _parser_name;
462   }
463
464   void set_purpose(const string &_purpose)
465   {
466     purpose = _purpose;
467   }
468
469   virtual void generate_reset_groups(ostream &stream, unsigned int indent) = 0;
470
471   void set_reset_groups(const string &_reset_groups)
472   {
473     reset_groups = _reset_groups;
474   }
475
476   void set_source_name(const string &_source_name)
477   {
478     source_name = _source_name;
479   }
480
481   virtual void generate_update_multiple_given(ostream &stream, unsigned int indent) = 0;
482
483   void set_update_multiple_given(const string &_update_multiple_given)
484   {
485     update_multiple_given = _update_multiple_given;
486   }
487
488   void set_usage_string(const string &_usage_string)
489   {
490     usage_string = _usage_string;
491   }
492
493   void set_version_var_name(const string &_version_var_name)
494   {
495     version_var_name = _version_var_name;
496   }
497
498   void generate_c_source(ostream &stream, unsigned int indent = 0);
499   
500 };
501
502 #endif // C_SOURCE_GEN_CLASS_H