00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _plError_h_
00022 #define _plError_h_
00023
00024
00025
00026 #include <plObject.h>
00027 #include <string>
00028 #include <iostream>
00029 #include <plLanguage.h>
00030 #include <vector>
00031 using namespace std;
00032
00033 #define NUMBER_OF_MESSAGES 100
00034
00035
00036
00037
00038
00039
00042 class plError : public plObject
00043 {
00044 protected:
00045 static const char *english_error_messages[NUMBER_OF_MESSAGES];
00046 static const char *french_error_messages [NUMBER_OF_MESSAGES];
00047 static const char *spanish_error_messages [NUMBER_OF_MESSAGES];
00048 static vector <bool> ignore_message;
00049
00052 static bool abort_in_error;
00053
00057 static bool always_display_error;
00058
00060 static plLanguage language;
00061
00063 bool fatal;
00064
00066 unsigned int error_number ;
00067
00068 public:
00069
00070
00073 std::string other_info;
00074
00076 plError(){};
00077
00080 plError(const int &error_id);
00081
00083 plError(const int &error_id, const std::string &additional_info);
00084
00086 virtual ~plError();
00087
00089 void display(std::ostream &out = std::cerr)const;
00090
00092 unsigned int get_error_number();
00093
00095 std::ostream &operator <<(std::ostream &out)const{display(out); return out;}
00096
00098 virtual void action();
00099
00104 static void AbortInError(const bool &abort_flag);
00105
00111 static void AlwaysDisplay(const bool &display_flag);
00112
00120 static void ignore_this_message(unsigned int id_message,
00121 bool ignoring_state);
00122
00124 static void SetLanguage(const plLanguage &chosen_language);
00125 };
00126
00129 class plWarning : public plError
00130 {
00131 private:
00132
00133 static bool always_display_warning;
00134 static bool abort_in_warning;
00135 public:
00139 static void AlwaysDisplay(const bool &display_flag);
00140
00144 static void AbortInWarning(const bool &wie_flag);
00145
00146
00148 plWarning(const int &error_id);
00149
00151 plWarning(const int &error_id, const std::string &additional_info);
00152
00153
00154 static bool getDisplayState() {return always_display_warning;}
00155 };
00156
00157 #endif