diff options
author | Pixel <Pixel> | 2001-11-26 23:11:40 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-11-26 23:11:40 +0000 |
commit | 3baa9d168c02a8734b95d1cc467601b6aaf2f6e4 (patch) | |
tree | 6c254e9d75dee5a1e305283788fea3d3fff2a445 /include | |
parent | 3aa63fcbddbce8762ad0f3f54d90ad985c0f9c41 (diff) |
Big job here. Many bugs out. Hurray!!
Diffstat (limited to 'include')
-rw-r--r-- | include/Exceptions.h | 13 | ||||
-rw-r--r-- | include/Handle.h | 5 | ||||
-rw-r--r-- | include/InPipe.h | 22 | ||||
-rw-r--r-- | include/Input.h | 6 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/OutPipe.h | 22 | ||||
-rw-r--r-- | include/String.h | 3 | ||||
-rw-r--r-- | include/Variables.h | 2 |
8 files changed, 70 insertions, 5 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index 090ace9..e72a8a2 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -34,10 +34,11 @@ class GeneralException; -char * xstrdup(const char *) throw (GeneralException); -void * xmalloc(ssize_t) throw (GeneralException); +char * xstrdup(const char *); +void * xmalloc(size_t) throw (GeneralException); void xfree(void *&); -void * xrealloc(void *, size_t) throw (GeneralException); +void * xrealloc(void *, size_t); +int xpipe(int *, int = 0) throw (GeneralException); // On prédéfinit la classe String, pour éviter // les deadlocks de compilation... @@ -54,6 +55,9 @@ class Base { static void * realloc(void * p, size_t s) { return xrealloc(p, s); } + static void * calloc(size_t n, size_t s) { + return xmalloc(n * s); + } void * operator new(size_t s) { return xmalloc(s); } @@ -69,6 +73,9 @@ class Base { static void free(char *& p) { xfree((void *) p); } + static int pipe(int * p, int flag = 0) { + return xpipe(p); + } }; class GeneralException : public Base { diff --git a/include/Handle.h b/include/Handle.h index 14eb92d..8d006ff 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -24,6 +24,9 @@ * GetName donne le nom associe au handle. (nom de fichier ou autre) */ +#include <sys/types.h> +#include <time.h> + class Handle : public Base { public: Handle(const Handle &); @@ -36,6 +39,8 @@ class Handle : public Base { virtual bool CanRead(); virtual bool CanWrite(); virtual String GetName(); + virtual off_t GetSize(); + virtual time_t GetModif(); void close(); int GetHandle(); diff --git a/include/InPipe.h b/include/InPipe.h new file mode 100644 index 0000000..251523d --- /dev/null +++ b/include/InPipe.h @@ -0,0 +1,22 @@ +#ifndef __INPIPE_H__ +#define __INPIPE_H__ +#ifdef __cplusplus + +#include <Handle.h> + +class InPipe : public Handle { + public: + InPipe(); + virtual ~InPipe(); + void Hook(); + virtual bool CanWrite(); + virtual bool CanRead(); + virtual String GetName(); + private: + int p[2], hooked; +}; + +#else +#error This only works with a C++ compiler +#endif +#endif diff --git a/include/Input.h b/include/Input.h index 471ba91..ae8ef09 100644 --- a/include/Input.h +++ b/include/Input.h @@ -2,6 +2,8 @@ #define __INPUT_H__ #ifdef __cplusplus +#include <sys/types.h> +#include <time.h> #include <String.h> #include <Handle.h> @@ -16,9 +18,13 @@ class Input : public Handle { virtual bool CanWrite(); virtual bool CanRead(); virtual String GetName(); + virtual off_t GetSize(); + virtual time_t GetModif(); protected: String n; + off_t size; + time_t date_modif; }; class Stdin_t : public Handle { diff --git a/include/Makefile.am b/include/Makefile.am index bc93b8d..35f88b5 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 +CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h diff --git a/include/OutPipe.h b/include/OutPipe.h new file mode 100644 index 0000000..9861d6d --- /dev/null +++ b/include/OutPipe.h @@ -0,0 +1,22 @@ +#ifndef __OUTPIPE_H__ +#define __OUTPIPE_H__ +#ifdef __cplusplus + +#include <Handle.h> + +class OutPipe : public Handle { + public: + OutPipe(); + virtual ~OutPipe(); + void Hook(); + virtual bool CanWrite(); + virtual bool CanRead(); + virtual String GetName(); + private: + int p[2], hooked; +}; + +#else +#error This only works with a C++ compiler +#endif +#endif diff --git a/include/String.h b/include/String.h index 0e8372f..b614d8d 100644 --- a/include/String.h +++ b/include/String.h @@ -45,6 +45,9 @@ class String : public Base { String(const char * = ""); String(char); String(int); + String(unsigned int); + String(long long); + String(unsigned long long); String(double); ~String(); const char * set(char *, ...); diff --git a/include/Variables.h b/include/Variables.h index 199e96f..f24daa0 100644 --- a/include/Variables.h +++ b/include/Variables.h @@ -34,7 +34,7 @@ class Variables : public Base { void SetTo(int i, const String &); String operator[](const String &); String operator[](int i); - void Dump(Handle *); + void Dump(Handle *, const String & = ""); int GetNb(); void Add(const String &); void Del(int); |