]> Creatis software - clitk.git/blob - utilities/gengetopt/skels/group_counter.h
auto generate dicom file UIDs when new series/study is specified
[clitk.git] / utilities / gengetopt / skels / group_counter.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 GROUP_COUNTER_GEN_CLASS_H
8 #define GROUP_COUNTER_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class group_counter_gen_class
17 {
18  protected:
19   string group_name;
20   string name;
21
22  public:
23   group_counter_gen_class()
24   {
25   }
26   
27   group_counter_gen_class(const string &_group_name, const string &_name) :
28     group_name (_group_name), name (_name)
29   {
30   }
31
32   static void
33   generate_string(const string &s, ostream &stream, unsigned int indent)
34   {
35     if (!indent || s.find('\n') == string::npos)
36       {
37         stream << s;
38         return;
39       }
40
41     string::size_type pos;
42     string::size_type start = 0;
43     string ind (indent, ' ');
44     while ( (pos=s.find('\n', start)) != string::npos)
45       {
46         stream << s.substr (start, (pos+1)-start);
47         start = pos+1;
48         if (start+1 <= s.size ())
49           stream << ind;
50       }
51     if (start+1 <= s.size ())
52       stream << s.substr (start);
53   }
54
55   void set_group_name(const string &_group_name)
56   {
57     group_name = _group_name;
58   }
59
60   void set_name(const string &_name)
61   {
62     name = _name;
63   }
64
65   void generate_group_counter(ostream &stream, unsigned int indent = 0);
66   
67 };
68
69 #endif // GROUP_COUNTER_GEN_CLASS_H