From 3f720784d55707024fff675a5238fde0168d1a40 Mon Sep 17 00:00:00 2001 From: Pixel Date: Thu, 15 Nov 2001 14:52:43 +0000 Subject: More work into TaskMan... --- include/Action.h | 3 ++- include/Buffer.h | 2 +- include/Confirm.h | 2 +- include/CopyJob.h | 4 +++- include/Form.h | 2 +- include/HttpServ.h | 4 +++- include/Menu.h | 2 +- include/Message.h | 2 +- include/Socket.h | 2 -- include/Table.h | 2 +- include/Task.h | 10 +++++++++- 11 files changed, 23 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/Action.h b/include/Action.h index 185cd1a..bf3dc1a 100644 --- a/include/Action.h +++ b/include/Action.h @@ -2,6 +2,7 @@ #define __ACTION_H__ #ifdef __cplusplus +#include #include #include #include @@ -35,7 +36,7 @@ class Action : public Base { Action(const String & = ""); virtual ~Action(); Action * Look4URL(const String &); - virtual void Do(Variables *, Handle *) = 0; + virtual Task * Do(Variables *, Handle *) = 0; virtual void SendHead(Handle *); virtual void SendFoot(Handle *); virtual void ShowButton(Handle *, const String & = " Ok ", const String & = "start"); diff --git a/include/Buffer.h b/include/Buffer.h index cf57cb6..8b1c131 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -14,7 +14,7 @@ class Buffer : public Handle { Buffer(); ~Buffer(); virtual ssize_t write(const void *buf, size_t count); - virtual ssize_t read(void *buf, size_t count); + virtual ssize_t read(void *buf, size_t count) throw (GeneralException); virtual bool CanRead(); virtual bool CanWrite(); virtual String GetName(); diff --git a/include/Confirm.h b/include/Confirm.h index efd0606..d327f23 100644 --- a/include/Confirm.h +++ b/include/Confirm.h @@ -21,7 +21,7 @@ class Confirm : public Action { Confirm(const String & titre, const String & msg, const String & url, Action * yes, Action * no = 0); virtual ~Confirm() { } virtual String GetTitle(); - virtual void Do(Variables *, Handle *); + virtual Task * Do(Variables *, Handle *); private: String tit, msg; Action * NYes, * NNo; diff --git a/include/CopyJob.h b/include/CopyJob.h index 67cbf36..c4cda81 100644 --- a/include/CopyJob.h +++ b/include/CopyJob.h @@ -9,14 +9,16 @@ class CopyJob : public Task { public: - CopyJob(Handle *, Handle *, ssize_t = -1); + CopyJob(Handle *, Handle *, ssize_t = -1, bool = false); virtual ~CopyJob(); virtual int Do() throw (GeneralException); virtual String GetName(); private: Handle * s, * d; + bool ds; ssize_t siz, cursiz; char buffer[COPY_BUFSIZ]; + int r; }; #else diff --git a/include/Form.h b/include/Form.h index 50b7e3c..1b22742 100644 --- a/include/Form.h +++ b/include/Form.h @@ -29,7 +29,7 @@ class Form : public Action { int nb, Action * ok = 0); virtual ~Form() { } virtual String GetTitle(); - virtual void Do(Variables *, Handle *); + virtual Task * Do(Variables *, Handle *); private: String tit, iv, * nms, * ivs, * defs, ** lsts, ** dscs; int n; diff --git a/include/HttpServ.h b/include/HttpServ.h index 18295bc..51511b2 100644 --- a/include/HttpServ.h +++ b/include/HttpServ.h @@ -19,7 +19,7 @@ class HttpServ : public Task { public: - HttpServ(int = 1500, const String & = String("GruiK Server v0.1")) throw (GeneralException); + HttpServ(Action *, int = 1500, const String & = String("GruiK Server v0.1")) throw (GeneralException); ~HttpServ() {} void SetMenu(Action *); virtual String GetName(); @@ -27,6 +27,8 @@ class HttpServ : public Task { virtual int Do(); private: Socket Listener; + Action * p; + String name; int localport; }; diff --git a/include/Menu.h b/include/Menu.h index 4167656..e656657 100644 --- a/include/Menu.h +++ b/include/Menu.h @@ -21,7 +21,7 @@ class Menu : public Action { Menu(const String & titre, const String & url, String * labels, Action ** listac, int nb); virtual ~Menu() {} virtual String GetTitle(); - virtual void Do(Variables *, Handle *); + virtual Task * Do(Variables *, Handle *); private: String tit; String * lt; diff --git a/include/Message.h b/include/Message.h index 96b9aa4..77bd62c 100644 --- a/include/Message.h +++ b/include/Message.h @@ -20,7 +20,7 @@ class Message : public Action { Message(const String & titre, const String & msg, const String & url, Action * ok = 0); virtual ~Message() { } virtual String GetTitle(); - virtual void Do(Variables *, Handle *); + virtual Task * Do(Variables *, Handle *); private: String tit, msg; Action * Next; diff --git a/include/Socket.h b/include/Socket.h index 6bd612c..514db43 100644 --- a/include/Socket.h +++ b/include/Socket.h @@ -39,8 +39,6 @@ class Socket : public Handle { Socket Accept() throw (GeneralException); bool IsConnected(); bool IsListening(); - size_t WriteFile(Output &); - size_t ReadFile(Input &); virtual bool CanRead(); virtual bool CanWrite(); virtual String GetName(); diff --git a/include/Table.h b/include/Table.h index 64cf249..f1ec6c6 100644 --- a/include/Table.h +++ b/include/Table.h @@ -23,7 +23,7 @@ class Table : public Action { Table(const String & titre, const String & url, String * heads, String * cells, int nbcol, int nblgn, Action * ok = 0); virtual ~Table() { } virtual String GetTitle(); - virtual void Do(Variables *, Handle *); + virtual Task * Do(Variables *, Handle *); private: String tit, * hds, * cls; int nc, nl; diff --git a/include/Task.h b/include/Task.h index 1842314..503e0df 100644 --- a/include/Task.h +++ b/include/Task.h @@ -10,6 +10,7 @@ #define TASK_ON_HOLD 0 #define TASK_DONE 1 +#define TASK_BURST 2 class Task : public Base { public: @@ -23,13 +24,20 @@ class Task : public Base { void WaitFor(Task *); void WaitFor(pid_t); void WaitFor(struct timeval); + void SetBurst(); + void SetCleanUp(); + bool HasToClean(); + void Stop(); + void Restart(); + bool IsStopped(); protected: virtual int Do() throw (GeneralException); - int current; private: int state; + bool stopped; + bool cleanup; bool suspended; vector w4ha; vector w4ta; -- cgit v1.2.3