diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Exceptions.h | 54 | ||||
-rw-r--r-- | include/Main.h | 24 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/String.h | 4 |
4 files changed, 28 insertions, 56 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index 74ad938..4e84bc4 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -8,7 +8,7 @@ #include <string.h> #include <stdlib.h> -#define INLINE __inline__ +/* #define INLINE __inline__ */ class Base { public: @@ -52,58 +52,6 @@ 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); -} - -INLINE void * Base::malloc(ssize_t s) { - return xmalloc(s); -} - -INLINE void * Base::realloc(void * p, size_t s) { - return xrealloc(p, s); -} - -INLINE void * Base::calloc(size_t n, size_t s) { - return xmalloc(n * s); -} - -INLINE void * Base::operator new(size_t s) { - return xmalloc(s); -} - -INLINE void * Base::operator new(size_t s, void * p) { - return memset(p, 0, s); -} - -INLINE void Base::operator delete(void * p) { - xfree(p); -} - -INLINE void Base::free(void *& p) { - xfree(p); -} - -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); -} - -INLINE pid_t Base::fork() { - return xfork(); -} - -INLINE void Base::exit(int status) { - xexit(status); -} - class MemoryException : public GeneralException { public: MemoryException(ssize_t); diff --git a/include/Main.h b/include/Main.h new file mode 100644 index 0000000..4a81b3e --- /dev/null +++ b/include/Main.h @@ -0,0 +1,24 @@ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include "Exceptions.h" + +class Main : public Base { + public: + Main(); + virtual ~Main(); + virtual int startup() throw (GeneralException) = 0; + protected: + void set_args(int, char **, char **); + int argc; + char ** argv; + char ** enve; + bool setted; + + friend int main(int, char **, char **); +}; + +#define CODE_BEGINS class Appli : public Main { +#define CODE_ENDS } * Application = new Appli(); + +#endif diff --git a/include/Makefile.am b/include/Makefile.am index de443e0..5d895be 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,4 +2,4 @@ pkginclude_HEADERS = \ Exceptions.h Handle.h String.h Output.h Socket.h HttpServ.h Variables.h Menu.h \ Action.h Message.h Form.h Confirm.h Table.h IRC.h Task.h Buffer.h General.h \ -CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h Input.h Image.h +CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h Input.h Image.h Main.h diff --git a/include/String.h b/include/String.h index 27a7f2c..72fc135 100644 --- a/include/String.h +++ b/include/String.h @@ -57,9 +57,9 @@ class String : public Base { String & tolower(); private: - String(int hs, const char *); + String(int hs, char *); static char t[]; - char * str; + char * str, * ostr; size_t siz; }; |