From d2252afcd74af0248c6141c8086d03e12a0a316f Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 11 Oct 2011 00:47:18 -0700 Subject: Input class seems to be done. --- includes/Handle.h | 10 ++++++++++ includes/Input.h | 1 + 2 files changed, 11 insertions(+) (limited to 'includes') diff --git a/includes/Handle.h b/includes/Handle.h index 489ab75..e3e22cd 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -9,6 +9,11 @@ class EAgain : public GeneralException { EAgain() : GeneralException("Try Again") { } }; +class ENoEnt : public GeneralException { + public: + ENoEnt(const char * name) : GeneralException(String("No such file or directory: `") + name + "'") { } +}; + class IO; class Handle { @@ -16,6 +21,7 @@ class Handle { virtual ~Handle() { Assert(m_refCount == 0); } virtual void close() throw (GeneralException) = 0; virtual bool isClosed() = 0; + virtual bool isEOF() = 0; virtual bool canSeek(); virtual bool canRead(); virtual bool canWrite(); @@ -59,6 +65,10 @@ class SeekableHandle : public Handle { virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual off_t rtell() throw (GeneralException); virtual off_t wtell() throw (GeneralException); + virtual bool isEOF(); + protected: + off_t getWOffset() { return m_wOffset; } + off_t getROffset() { return m_rOffset; } private: off_t m_wOffset, m_rOffset; }; diff --git a/includes/Input.h b/includes/Input.h index 71e6845..518db39 100644 --- a/includes/Input.h +++ b/includes/Input.h @@ -8,6 +8,7 @@ class Input : public SeekableHandle { public: Input(const char * fname) throw (GeneralException); virtual void close() throw (GeneralException); + virtual ssize_t read(void * buf, size_t count) throw (GeneralException); virtual bool isClosed(); virtual bool canRead(); virtual const char * getName(); -- cgit v1.2.3