]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/print_help_string.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / print_help_string.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 PRINT_HELP_STRING_GEN_CLASS_H
8 #define PRINT_HELP_STRING_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class print_help_string_gen_class
17 {
18  protected:
19   string from;
20   string full_index;
21   string helpstring;
22   string index;
23   bool last;
24   bool shared;
25   string target;
26
27  public:
28   print_help_string_gen_class() :
29     last (false), shared (false)
30   {
31   }
32   
33   print_help_string_gen_class(const string &_from, const string &_full_index, const string &_helpstring, const string &_index, bool _last, bool _shared, const string &_target) :
34     from (_from), full_index (_full_index), helpstring (_helpstring), index (_index), last (_last), shared (_shared), target (_target)
35   {
36   }
37
38   static void
39   generate_string(const string &s, ostream &stream, unsigned int indent)
40   {
41     if (!indent || s.find('\n') == string::npos)
42       {
43         stream << s;
44         return;
45       }
46
47     string::size_type pos;
48     string::size_type start = 0;
49     string ind (indent, ' ');
50     while ( (pos=s.find('\n', start)) != string::npos)
51       {
52         stream << s.substr (start, (pos+1)-start);
53         start = pos+1;
54         if (start+1 <= s.size ())
55           stream << ind;
56       }
57     if (start+1 <= s.size ())
58       stream << s.substr (start);
59   }
60
61   void set_from(const string &_from)
62   {
63     from = _from;
64   }
65
66   void set_full_index(const string &_full_index)
67   {
68     full_index = _full_index;
69   }
70
71   void set_helpstring(const string &_helpstring)
72   {
73     helpstring = _helpstring;
74   }
75
76   void set_index(const string &_index)
77   {
78     index = _index;
79   }
80
81   void set_last(bool _last)
82   {
83     last = _last;
84   }
85
86   void set_shared(bool _shared)
87   {
88     shared = _shared;
89   }
90
91   void set_target(const string &_target)
92   {
93     target = _target;
94   }
95
96   void generate_print_help_string(ostream &stream, unsigned int indent = 0);
97   
98 };
99
100 #endif // PRINT_HELP_STRING_GEN_CLASS_H