00001 //file gberr.h for handling errors in g2a 00002 #ifndef GBERR_H 00003 #define GBERR_H 00004 #include <iostream> 00005 #include <string> 00006 00007 using namespace std; 00008 00009 /* for dealing error messages */ 00010 class gberr 00011 { 00012 public: 00013 gberr(); 00014 gberr(const char message[]) : info(message) {} 00015 gberr(const string message) : info(message) {} 00016 gberr &pick(const string &m); 00017 gberr &pick(const char *m); 00018 void print(ostream &ous) const; 00019 void context(istream &ins, int sz=500); //pick the context of the error 00020 void prtContext(ostream &ous) const; 00021 00022 private: 00023 string info; 00024 string cntxt; //context 00025 }; 00026 00027 class gbreferr : public gberr { 00028 public: 00029 gbreferr(const char message[]) : gberr(message) {} 00030 }; 00031 #endif
1.5.6