diff options
author | Pixel <Pixel> | 2001-12-08 13:57:52 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-12-08 13:57:52 +0000 |
commit | a83a43e57be59ed407d98f465d02953af5ae0160 (patch) | |
tree | 91aa1ea4a24e5b85ef26686828054e858cec21aa /include | |
parent | c54dfe9b844f6c5d8969669f5144e721e2af82b0 (diff) |
*hum* some changes...
Diffstat (limited to 'include')
-rw-r--r-- | include/Action.h | 2 | ||||
-rw-r--r-- | include/Buffer.h | 5 | ||||
-rw-r--r-- | include/Confirm.h | 2 | ||||
-rw-r--r-- | include/CopyJob.h | 4 | ||||
-rw-r--r-- | include/Form.h | 2 | ||||
-rw-r--r-- | include/Handle.h | 2 | ||||
-rw-r--r-- | include/Image.h | 61 | ||||
-rw-r--r-- | include/Input.h | 2 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/Menu.h | 2 | ||||
-rw-r--r-- | include/Message.h | 2 | ||||
-rw-r--r-- | include/Table.h | 2 |
12 files changed, 76 insertions, 12 deletions
diff --git a/include/Action.h b/include/Action.h index 99ad7ea..d11162f 100644 --- a/include/Action.h +++ b/include/Action.h @@ -12,7 +12,7 @@ class Action : public Base { Action(const String & = ""); virtual ~Action(); Action * Look4URL(const String &); - virtual Task * Do(Variables *, Handle *) = 0; + virtual Task * Do(Variables *, 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 5b35139..cf6481f 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -21,9 +21,12 @@ class Buffer : public Handle { virtual String GetName(); virtual Buffer operator=(const Buffer &); virtual bool CanWatch(); + virtual ssize_t GetSize(); + char operator[](size_t) const; + char & operator[](size_t); private: - char * buffer; + char * buffer, zero; int realsiz, bufsiz, ptr; }; diff --git a/include/Confirm.h b/include/Confirm.h index be0b659..da0365d 100644 --- a/include/Confirm.h +++ b/include/Confirm.h @@ -11,7 +11,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 Task * Do(Variables *, Handle *); + virtual Task * Do(Variables *, Variables *, Handle *); private: String tit, msg; diff --git a/include/CopyJob.h b/include/CopyJob.h index bd859bb..2a886c5 100644 --- a/include/CopyJob.h +++ b/include/CopyJob.h @@ -9,14 +9,14 @@ class CopyJob : public Task { public: - CopyJob(Handle *, Handle *, ssize_t = -1, bool = false); + CopyJob(Handle *, Handle *, ssize_t = -1, bool = false, bool = false); virtual ~CopyJob(); virtual int Do() throw (GeneralException); virtual String GetName(); private: Handle * s, * d; - bool ds; + bool ds, dd; ssize_t siz, cursiz; char buffer[COPY_BUFSIZ]; int r; diff --git a/include/Form.h b/include/Form.h index 77498a8..9e77967 100644 --- a/include/Form.h +++ b/include/Form.h @@ -13,7 +13,7 @@ class Form : public Action { int nb, Action * ok = 0); virtual ~Form() { } virtual String GetTitle(); - virtual Task * Do(Variables *, Handle *); + virtual Task * Do(Variables *, Variables *, Handle *); private: String tit, iv, * nms, * ivs, * defs, ** lsts, ** dscs; diff --git a/include/Handle.h b/include/Handle.h index 9fef098..3b9c9dc 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -23,7 +23,7 @@ class Handle : public Base { virtual bool CanRead(); virtual bool CanWrite(); virtual String GetName(); - virtual off_t GetSize(); + virtual ssize_t GetSize(); virtual time_t GetModif(); void close() throw (GeneralException); int GetHandle(); diff --git a/include/Image.h b/include/Image.h new file mode 100644 index 0000000..8fd719c --- /dev/null +++ b/include/Image.h @@ -0,0 +1,61 @@ +#ifndef __IMAGE_H__ +#define __IMAGE_H__ +#ifdef __cplusplus + +#include <Buffer.h> + +enum { + FORMAT_TGA_BASIC, +} format_t; + +struct Color { + Color(unsigned char aR, unsigned char aG, unsigned char aB, unsigned char aA = 255) : + R(aR), G(aG), B(aB), A(aA) { } + unsigned char R, G, B, A; +}; + +class Image : public Buffer { + public: + Image(unsigned int, unsigned int); + virtual ~Image(); + Color GetPixel(unsigned int, unsigned int); + void SetPixel(unsigned int, unsigned int, Color); + bool Prepare(unsigned int = FORMAT_TGA_BASIC); + void Fill(Color = Color(0, 0, 0)); + virtual String GetName(); + virtual bool CanWrite(); + + private: + typedef unsigned char Byte; + typedef unsigned short int Word; + typedef unsigned long int DWord; + struct TGAHeader { + Byte IDLength; + Byte ColorMapType; + Byte ImageType; + Word CM_FirstEntry; + Word CM_Length; + Byte CM_EntrySize; + Word IS_XOrigin; + Word IS_YOrigin; + Word IS_Width; + Word IS_Height; + Byte IS_Depth; + Byte IS_Descriptor; + } __attribute__((packed)); + + struct TGAFooter { + DWord ExtOffset; + DWord DevOffset; + char Sig[18]; + } __attribute__((packed)); + + unsigned int x, y; + bool r; + Color * img; +}; + +#else +#error This only works with a C++ compiler +#endif +#endif diff --git a/include/Input.h b/include/Input.h index 7aa0ff2..87190f1 100644 --- a/include/Input.h +++ b/include/Input.h @@ -14,7 +14,7 @@ class Input : public Handle { virtual bool CanWrite(); virtual bool CanRead(); virtual String GetName(); - virtual off_t GetSize(); + virtual ssize_t GetSize(); virtual time_t GetModif(); protected: diff --git a/include/Makefile.am b/include/Makefile.am index c748342..de443e0 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 +CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h Input.h Image.h diff --git a/include/Menu.h b/include/Menu.h index 6e77c70..2558920 100644 --- a/include/Menu.h +++ b/include/Menu.h @@ -11,7 +11,7 @@ class Menu : public Action { Menu(const String & titre, const String & url, String * labels, Action ** listac, int nb); virtual ~Menu() {} virtual String GetTitle(); - virtual Task * Do(Variables *, Handle *); + virtual Task * Do(Variables *, Variables *, Handle *); private: String tit; diff --git a/include/Message.h b/include/Message.h index 043f4d6..35437bd 100644 --- a/include/Message.h +++ b/include/Message.h @@ -11,7 +11,7 @@ class Message : public Action { Message(const String & titre, const String & msg, const String & url, Action * ok = 0); virtual ~Message() { } virtual String GetTitle(); - virtual Task * Do(Variables *, Handle *); + virtual Task * Do(Variables *, Variables *, Handle *); private: String tit, msg; diff --git a/include/Table.h b/include/Table.h index 5b01aab..c616e7e 100644 --- a/include/Table.h +++ b/include/Table.h @@ -11,7 +11,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 Task * Do(Variables *, Handle *); + virtual Task * Do(Variables *, Variables *, Handle *); private: String tit, * hds, * cls; |