+enum error_on_off {
+ ERROR_PARENT,
+ ERROR_ON,
+ ERROR_OFF
+};
+
+const int err_stop= (err_unknown|err_error);
+
+class cl_error_class: public cl_base
+{
+protected:
+ enum error_type type;
+ //char *name;
+ enum error_on_off on;
+public:
+ cl_error_class(enum error_type typ, char *aname,
+ enum error_on_off be_on= ERROR_PARENT);
+ cl_error_class(enum error_type typ, char *aname,
+ class cl_error_class *parent,
+ enum error_on_off be_on= ERROR_PARENT);
+
+ enum error_on_off get_on(void) { return(on); }
+ void set_on(enum error_on_off val);
+ bool is_on(void);
+ enum error_type get_type(void);
+ char *get_type_name(void);
+ //char *get_name(void);
+};
+
+class cl_error_registry
+{
+public:
+ cl_error_registry(void);
+ class cl_error_class *find(char *type_name)
+ {
+ if (NIL == registered_errors)
+ return NIL;
+ return static_cast<class cl_error_class *>(registered_errors->first_that(compare, static_cast<void *>(type_name)));
+ }
+ static class cl_list *get_list(void)
+ {
+ return registered_errors;
+ }
+
+protected:
+ class cl_error_class *register_error(class cl_error_class *error_class)
+ {
+ if (!registered_errors)
+ registered_errors= new cl_list(2, 2, "registered errors");
+ registered_errors->add(error_class);
+ return error_class;
+ }
+
+private:
+ static class cl_list *registered_errors;
+ static int compare(void *obj1, void *obj2)
+ {
+ return (static_cast<class cl_base *>(obj1))->is_named(static_cast<char *>(obj2));
+ }
+};