]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/clear_arg.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / clear_arg.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 CLEAR_ARG_GEN_CLASS_H
8 #define CLEAR_ARG_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class clear_arg_gen_class
17 {
18  protected:
19   bool has_arg;
20   bool has_orig;
21   string name;
22   string suffix;
23   string value;
24
25  public:
26   clear_arg_gen_class() :
27     has_arg (false), has_orig (false)
28   {
29   }
30   
31   clear_arg_gen_class(bool _has_arg, bool _has_orig, const string &_name, const string &_suffix, const string &_value) :
32     has_arg (_has_arg), has_orig (_has_orig), name (_name), suffix (_suffix), value (_value)
33   {
34   }
35
36   static void
37   generate_string(const string &s, ostream &stream, unsigned int indent)
38   {
39     if (!indent || s.find('\n') == string::npos)
40       {
41         stream << s;
42         return;
43       }
44
45     string::size_type pos;
46     string::size_type start = 0;
47     string ind (indent, ' ');
48     while ( (pos=s.find('\n', start)) != string::npos)
49       {
50         stream << s.substr (start, (pos+1)-start);
51         start = pos+1;
52         if (start+1 <= s.size ())
53           stream << ind;
54       }
55     if (start+1 <= s.size ())
56       stream << s.substr (start);
57   }
58
59   void set_has_arg(bool _has_arg)
60   {
61     has_arg = _has_arg;
62   }
63
64   void set_has_orig(bool _has_orig)
65   {
66     has_orig = _has_orig;
67   }
68
69   void set_name(const string &_name)
70   {
71     name = _name;
72   }
73
74   void set_suffix(const string &_suffix)
75   {
76     suffix = _suffix;
77   }
78
79   void set_value(const string &_value)
80   {
81     value = _value;
82   }
83
84   void generate_clear_arg(ostream &stream, unsigned int indent = 0);
85   
86 };
87
88 #endif // CLEAR_ARG_GEN_CLASS_H