00001 #ifndef __ppm_expander_h 00002 #define __ppm_expander_h 00003 00004 #include "CExpander.h" 00005 #include <sys/stat.h> 00006 00007 00008 #include "utypes.h" 00009 #include "ppm.h" 00010 00011 class PPM_ReadBuf; 00012 00013 #define SYM_EOF 256 00014 00015 class ppm_expander : public CExpander { 00016 UCHAR *buf_in,*buf_out; 00017 unsigned int bufsize; 00018 unsigned int outbytes; 00019 unsigned long blocksize; 00020 unsigned short numblocks; 00021 unsigned short curblock; 00022 unsigned short maxnode; 00023 bool needppmend; 00024 int home(); 00025 FILE* my_file_in; 00026 PPM_ReadBuf* my_read_buf; 00027 ppm_worker ppm; 00028 public: 00029 QString about() { return QString("ppms Codec (c) Tim Wentford\nCompression code (c) Fabrice Bellard"); } 00030 #ifdef USEQPE 00031 void suspend() 00032 { 00033 CExpander::suspend(my_file_in); 00034 } 00035 void unsuspend() 00036 { 00037 CExpander::unsuspend(my_file_in); 00038 } 00039 #else 00040 void suspend() {} 00041 void unsuspend() {} 00042 #endif 00043 ppm_expander() : needppmend(false), my_file_in(NULL), my_read_buf(NULL) 00044 { 00045 bufsize = 1024; 00046 buf_in = new UCHAR[bufsize]; 00047 buf_out = new UCHAR[bufsize]; 00048 outbytes = 0; 00049 } 00050 int OpenFile(const char* infile); 00051 int getch(); 00052 void locate(unsigned short block, unsigned int n); 00053 virtual ~ppm_expander(); 00054 unsigned int locate() { return outbytes; } 00055 void locate(unsigned int n); 00056 bool hasrandomaccess() { return (numblocks > 1); } 00057 void sizes(unsigned long& file, unsigned long& text); 00058 MarkupType PreferredMarkup() 00059 { 00060 return cTEXT; 00061 } 00062 }; 00063 00064 #endif
1.4.2