diff options
Diffstat (limited to 'include/Exceptions.h')
-rw-r--r-- | include/Exceptions.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index ef697e7..74ad938 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -21,8 +21,10 @@ class Base { void operator delete(void * p); static void free(void *& p); static void free(char *& p); + static void free(unsigned char *& p); static int pipe(int * p, int flag = 0); static pid_t fork(); + static void exit(int); }; class String; @@ -32,7 +34,7 @@ class GeneralException : public Base { GeneralException(String); GeneralException(const GeneralException &); ~GeneralException(); - char * GetMsg(); + const char * GetMsg() const; protected: GeneralException(); @@ -44,9 +46,11 @@ char * xstrdup(const char *); void * xmalloc(size_t) throw (GeneralException); void xfree(void *&); void xfree(char *&); +void xfree(unsigned char *&); void * xrealloc(void *, size_t); int xpipe(int *, int = 0) throw (GeneralException); pid_t xfork() throw (GeneralException); +void xexit(int) throw (GeneralException); INLINE char * Base::strdup(const char * s) { return xstrdup(s); @@ -84,6 +88,10 @@ INLINE void Base::free(char *& p) { xfree(p); } +INLINE void Base::free(unsigned char *& p) { + xfree(p); +} + INLINE int Base::pipe(int * p, int flag) { return xpipe(p, flag); } @@ -92,6 +100,10 @@ INLINE pid_t Base::fork() { return xfork(); } +INLINE void Base::exit(int status) { + xexit(status); +} + class MemoryException : public GeneralException { public: MemoryException(ssize_t); @@ -129,6 +141,14 @@ class TaskSwitch : public GeneralException { TaskSwitch(); }; +class Exit : public GeneralException { + public: + Exit(int); + int GetCode(); + private: + int code; +}; + #include <String.h> #else |