]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/option_arg.h
Added FindGengetopt.cmake which compiles gengetopt if not installed.
[clitk.git] / cmake / gengetopt / skels / option_arg.h
1 /*
2  * File automatically generated by
3  * gengen 1.3 by Lorenzo Bettini 
4  * http://www.gnu.org/software/gengen
5  */
6
7 #ifndef OPTION_ARG_GEN_CLASS_H
8 #define OPTION_ARG_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class option_arg_gen_class
17 {
18  protected:
19   bool default_on;
20   string default_value;
21   string desc;
22   bool flag_arg;
23   bool has_arg;
24   bool has_default;
25   bool has_enum;
26   bool long_long_arg;
27   string longtype;
28   bool multiple;
29   string name;
30   string origtype;
31   string type;
32
33  public:
34   option_arg_gen_class() :
35     default_on (false), flag_arg (false), has_arg (false), has_default (false), has_enum (false), long_long_arg (false), multiple (false)
36   {
37   }
38   
39   option_arg_gen_class(bool _default_on, const string &_default_value, const string &_desc, bool _flag_arg, bool _has_arg, bool _has_default, bool _has_enum, bool _long_long_arg, const string &_longtype, bool _multiple, const string &_name, const string &_origtype, const string &_type) :
40     default_on (_default_on), default_value (_default_value), desc (_desc), flag_arg (_flag_arg), has_arg (_has_arg), has_default (_has_default), has_enum (_has_enum), long_long_arg (_long_long_arg), longtype (_longtype), multiple (_multiple), name (_name), origtype (_origtype), type (_type)
41   {
42   }
43
44   static void
45   generate_string(const string &s, ostream &stream, unsigned int indent)
46   {
47     if (!indent || s.find('\n') == string::npos)
48       {
49         stream << s;
50         return;
51       }
52
53     string::size_type pos;
54     string::size_type start = 0;
55     string ind (indent, ' ');
56     while ( (pos=s.find('\n', start)) != string::npos)
57       {
58         stream << s.substr (start, (pos+1)-start);
59         start = pos+1;
60         if (start+1 <= s.size ())
61           stream << ind;
62       }
63     if (start+1 <= s.size ())
64       stream << s.substr (start);
65   }
66
67   void set_default_on(bool _default_on)
68   {
69     default_on = _default_on;
70   }
71
72   void set_default_value(const string &_default_value)
73   {
74     default_value = _default_value;
75   }
76
77   void set_desc(const string &_desc)
78   {
79     desc = _desc;
80   }
81
82   void set_flag_arg(bool _flag_arg)
83   {
84     flag_arg = _flag_arg;
85   }
86
87   void set_has_arg(bool _has_arg)
88   {
89     has_arg = _has_arg;
90   }
91
92   void set_has_default(bool _has_default)
93   {
94     has_default = _has_default;
95   }
96
97   void set_has_enum(bool _has_enum)
98   {
99     has_enum = _has_enum;
100   }
101
102   void set_long_long_arg(bool _long_long_arg)
103   {
104     long_long_arg = _long_long_arg;
105   }
106
107   void set_longtype(const string &_longtype)
108   {
109     longtype = _longtype;
110   }
111
112   void set_multiple(bool _multiple)
113   {
114     multiple = _multiple;
115   }
116
117   void set_name(const string &_name)
118   {
119     name = _name;
120   }
121
122   void set_origtype(const string &_origtype)
123   {
124     origtype = _origtype;
125   }
126
127   void set_type(const string &_type)
128   {
129     type = _type;
130   }
131
132   void generate_option_arg(ostream &stream, unsigned int indent = 0);
133   
134 };
135
136 #endif // OPTION_ARG_GEN_CLASS_H