]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/file_save.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / file_save.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 FILE_SAVE_GEN_CLASS_H
8 #define FILE_SAVE_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class file_save_gen_class
17 {
18  protected:
19   string arg;
20   string given;
21   string opt_name;
22   string values;
23
24  public:
25   file_save_gen_class()
26   {
27   }
28   
29   file_save_gen_class(const string &_arg, const string &_given, const string &_opt_name, const string &_values) :
30     arg (_arg), given (_given), opt_name (_opt_name), values (_values)
31   {
32   }
33
34   static void
35   generate_string(const string &s, ostream &stream, unsigned int indent)
36   {
37     if (!indent || s.find('\n') == string::npos)
38       {
39         stream << s;
40         return;
41       }
42
43     string::size_type pos;
44     string::size_type start = 0;
45     string ind (indent, ' ');
46     while ( (pos=s.find('\n', start)) != string::npos)
47       {
48         stream << s.substr (start, (pos+1)-start);
49         start = pos+1;
50         if (start+1 <= s.size ())
51           stream << ind;
52       }
53     if (start+1 <= s.size ())
54       stream << s.substr (start);
55   }
56
57   void set_arg(const string &_arg)
58   {
59     arg = _arg;
60   }
61
62   void set_given(const string &_given)
63   {
64     given = _given;
65   }
66
67   void set_opt_name(const string &_opt_name)
68   {
69     opt_name = _opt_name;
70   }
71
72   void set_values(const string &_values)
73   {
74     values = _values;
75   }
76
77   void generate_file_save(ostream &stream, unsigned int indent = 0);
78   
79 };
80
81 #endif // FILE_SAVE_GEN_CLASS_H