]> Creatis software - clitk.git/blob - utilities/gengetopt/skels/exit_failure.h
Sync gengetopt cmake files with rtk
[clitk.git] / utilities / gengetopt / skels / exit_failure.h
1 /*
2  * File automatically generated by
3  * gengen 1.4.1 by Lorenzo Bettini 
4  * http://www.gnu.org/software/gengen
5  */
6
7 #ifndef EXIT_FAILURE_GEN_CLASS_H
8 #define EXIT_FAILURE_GEN_CLASS_H
9
10 #include <string>
11 #include <iostream>
12
13 using std::string;
14 using std::ostream;
15
16 class exit_failure_gen_class
17 {
18  protected:
19   bool handle_error;
20   string parser_name;
21
22  public:
23   exit_failure_gen_class() :
24     handle_error (false)
25   {
26   }
27   
28   exit_failure_gen_class(bool _handle_error, const string &_parser_name) :
29     handle_error (_handle_error), parser_name (_parser_name)
30   {
31   }
32
33   static void
34   generate_string(const string &s, ostream &stream, unsigned int indent)
35   {
36     if (!indent || s.find('\n') == string::npos)
37       {
38         stream << s;
39         return;
40       }
41
42     string::size_type pos;
43     string::size_type start = 0;
44     string ind (indent, ' ');
45     while ( (pos=s.find('\n', start)) != string::npos)
46       {
47         stream << s.substr (start, (pos+1)-start);
48         start = pos+1;
49         if (start+1 <= s.size ())
50           stream << ind;
51       }
52     if (start+1 <= s.size ())
53       stream << s.substr (start);
54   }
55
56   void set_handle_error(bool _handle_error)
57   {
58     handle_error = _handle_error;
59   }
60
61   void set_parser_name(const string &_parser_name)
62   {
63     parser_name = _parser_name;
64   }
65
66   void generate_exit_failure(ostream &stream, unsigned int indent = 0);
67   
68 };
69
70 #endif // EXIT_FAILURE_GEN_CLASS_H