]> Creatis software - clitk.git/blobdiff - utilities/gengetopt/skels/exit_failure.h
Sync gengetopt cmake files with rtk
[clitk.git] / utilities / gengetopt / skels / exit_failure.h
diff --git a/utilities/gengetopt/skels/exit_failure.h b/utilities/gengetopt/skels/exit_failure.h
new file mode 100644 (file)
index 0000000..42bf53c
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * File automatically generated by
+ * gengen 1.4.1 by Lorenzo Bettini 
+ * http://www.gnu.org/software/gengen
+ */
+
+#ifndef EXIT_FAILURE_GEN_CLASS_H
+#define EXIT_FAILURE_GEN_CLASS_H
+
+#include <string>
+#include <iostream>
+
+using std::string;
+using std::ostream;
+
+class exit_failure_gen_class
+{
+ protected:
+  bool handle_error;
+  string parser_name;
+
+ public:
+  exit_failure_gen_class() :
+    handle_error (false)
+  {
+  }
+  
+  exit_failure_gen_class(bool _handle_error, const string &_parser_name) :
+    handle_error (_handle_error), parser_name (_parser_name)
+  {
+  }
+
+  static void
+  generate_string(const string &s, ostream &stream, unsigned int indent)
+  {
+    if (!indent || s.find('\n') == string::npos)
+      {
+        stream << s;
+        return;
+      }
+
+    string::size_type pos;
+    string::size_type start = 0;
+    string ind (indent, ' ');
+    while ( (pos=s.find('\n', start)) != string::npos)
+      {
+        stream << s.substr (start, (pos+1)-start);
+        start = pos+1;
+        if (start+1 <= s.size ())
+          stream << ind;
+      }
+    if (start+1 <= s.size ())
+      stream << s.substr (start);
+  }
+
+  void set_handle_error(bool _handle_error)
+  {
+    handle_error = _handle_error;
+  }
+
+  void set_parser_name(const string &_parser_name)
+  {
+    parser_name = _parser_name;
+  }
+
+  void generate_exit_failure(ostream &stream, unsigned int indent = 0);
+  
+};
+
+#endif // EXIT_FAILURE_GEN_CLASS_H