]> Creatis software - clitk.git/blob - cmake/gengetopt/skels/given_field.h
auto generate dicom file UIDs when new series/study is specified
[clitk.git] / cmake / gengetopt / skels / given_field.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 GIVEN_FIELD_GEN_CLASS_H
8 #define GIVEN_FIELD_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class given_field_gen_class
17 {
18  protected:
19   string arg_name;
20   bool group;
21   string long_opt;
22
23  public:
24   given_field_gen_class() :
25     group (false)
26   {
27   }
28   
29   given_field_gen_class(const string &_arg_name, bool _group, const string &_long_opt) :
30     arg_name (_arg_name), group (_group), long_opt (_long_opt)
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_name(const string &_arg_name)
58   {
59     arg_name = _arg_name;
60   }
61
62   void set_group(bool _group)
63   {
64     group = _group;
65   }
66
67   void set_long_opt(const string &_long_opt)
68   {
69     long_opt = _long_opt;
70   }
71
72   void generate_given_field(ostream &stream, unsigned int indent = 0);
73   
74 };
75
76 #endif // GIVEN_FIELD_GEN_CLASS_H