]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/handle_version.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / handle_version.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 HANDLE_VERSION_GEN_CLASS_H
8 #define HANDLE_VERSION_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class handle_version_gen_class
17 {
18  protected:
19   string parser_name;
20   bool short_opt;
21
22  public:
23   handle_version_gen_class() :
24     short_opt (false)
25   {
26   }
27   
28   handle_version_gen_class(const string &_parser_name, bool _short_opt) :
29     parser_name (_parser_name), short_opt (_short_opt)
30   {
31   }
32
33   static void
34   generate_string(const string &s, ostream &stream, unsigned int indent)
35   {
36     if (!indent || s.find('\n') == string::npos)
37       {
38         stream << s;
39         return;
40       }
41
42     string::size_type pos;
43     string::size_type start = 0;
44     string ind (indent, ' ');
45     while ( (pos=s.find('\n', start)) != string::npos)
46       {
47         stream << s.substr (start, (pos+1)-start);
48         start = pos+1;
49         if (start+1 <= s.size ())
50           stream << ind;
51       }
52     if (start+1 <= s.size ())
53       stream << s.substr (start);
54   }
55
56   void set_parser_name(const string &_parser_name)
57   {
58     parser_name = _parser_name;
59   }
60
61   void set_short_opt(bool _short_opt)
62   {
63     short_opt = _short_opt;
64   }
65
66   void generate_handle_version(ostream &stream, unsigned int indent = 0);
67   
68 };
69
70 #endif // HANDLE_VERSION_GEN_CLASS_H