author | llornkcor <llornkcor> | 2002-07-01 23:24:08 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-01 23:24:08 (UTC) |
commit | 59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2 (patch) (side-by-side diff) | |
tree | f148d4858859dac3b413e675c760acfdab24b8e6 /noncore/apps/opie-reader/Text.h | |
parent | c08be8ae22dcc1bfb83cfdec807149b161d770f5 (diff) | |
download | opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.zip opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.gz opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.bz2 |
initial
Diffstat (limited to 'noncore/apps/opie-reader/Text.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Text.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Text.h b/noncore/apps/opie-reader/Text.h new file mode 100644 index 0000000..4c689be --- a/dev/null +++ b/noncore/apps/opie-reader/Text.h @@ -0,0 +1,28 @@ +#ifndef __Text_h +#define __Text_h +#include <stdio.h> +#include <sys/stat.h> +#include "CExpander.h" + +class Text: public CExpander { + FILE* file; +public: + Text() : file(NULL) {}; + virtual ~Text() { if (file != NULL) fclose(file); } + virtual int openfile(const tchar *src) + { + if (file != NULL) fclose(file); + return ((file = fopen(src,"rb")) == NULL); + } + virtual int getch() { return fgetc(file); } + virtual unsigned int locate() { return ftell(file); } + virtual void locate(unsigned int n) { fseek(file,n,SEEK_SET); } + virtual bool hasrandomaccess() { return true; } + virtual void sizes(unsigned long& _file, unsigned long& _text) + { + struct stat _stat; + fstat(fileno(file),&_stat); + _text = _file = _stat.st_size; + } +}; +#endif |