summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ZText.h
authorllornkcor <llornkcor>2002-07-01 23:24:08 (UTC)
committer llornkcor <llornkcor>2002-07-01 23:24:08 (UTC)
commit59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2 (patch) (side-by-side diff)
treef148d4858859dac3b413e675c760acfdab24b8e6 /noncore/apps/opie-reader/ZText.h
parentc08be8ae22dcc1bfb83cfdec807149b161d770f5 (diff)
downloadopie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.zip
opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.gz
opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.bz2
initial
Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/ZText.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h
new file mode 100644
index 0000000..2848af7
--- a/dev/null
+++ b/noncore/apps/opie-reader/ZText.h
@@ -0,0 +1,35 @@
+#ifndef __Text_h
+#define __Text_h
+#include <stdio.h>
+#include <zlib.h>
+#include <sys/stat.h>
+
+#include "CExpander.h"
+
+class Text: public CExpander {
+ gzFile file;
+ unsigned long fsize;
+public:
+ Text() : file(NULL) {};
+ virtual ~Text()
+ {
+ if (file != NULL) gzclose(file);
+ }
+ virtual int openfile(const char *src)
+ {
+ if (file != NULL) gzclose(file);
+ struct stat _stat;
+ stat(src,&_stat);
+ fsize = _stat.st_size;
+ return ((file = gzopen(src,"rb")) == NULL);
+ }
+ virtual int getch() { return gzgetc(file); }
+ virtual unsigned int locate() { return gztell(file); }
+ virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); }
+ virtual bool hasrandomaccess() { return true; }
+ virtual void sizes(unsigned long& _file, unsigned long& _text)
+ {
+ _text = _file = fsize;
+ }
+};
+#endif