]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/handle_help.h
1759c9f9c97cfc59a4811ba806513346115c57d0
[clitk.git] / cmake / gengetopt / skels / handle_help.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 HANDLE_HELP_GEN_CLASS_H
8 #define HANDLE_HELP_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class handle_help_gen_class
17 {
18  protected:
19   bool detailed_help;
20   bool full_help;
21   string parser_name;
22   bool short_opt;
23
24  public:
25   handle_help_gen_class() :
26     detailed_help (false), full_help (false), short_opt (false)
27   {
28   }
29   
30   handle_help_gen_class(bool _detailed_help, bool _full_help, const string &_parser_name, bool _short_opt) :
31     detailed_help (_detailed_help), full_help (_full_help), parser_name (_parser_name), short_opt (_short_opt)
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_detailed_help(bool _detailed_help)
59   {
60     detailed_help = _detailed_help;
61   }
62
63   void set_full_help(bool _full_help)
64   {
65     full_help = _full_help;
66   }
67
68   void set_parser_name(const string &_parser_name)
69   {
70     parser_name = _parser_name;
71   }
72
73   void set_short_opt(bool _short_opt)
74   {
75     short_opt = _short_opt;
76   }
77
78   void generate_handle_help(ostream &stream, unsigned int indent = 0);
79   
80 };
81
82 #endif // HANDLE_HELP_GEN_CLASS_H