summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ppm_expander.h
blob: c5f8a173cb0d5c37b92a1f7e1bae869fb6ab02e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __ppm_expander_h
#define __ppm_expander_h

#include "CExpander.h"
#include <sys/stat.h>


#include "utypes.h"
#include "ppm.h"

class PPM_ReadBuf;

#define SYM_EOF 256

class ppm_expander : public CExpander {
  UCHAR *buf_in,*buf_out;
  unsigned int bufsize;
  unsigned int outbytes;
  unsigned long blocksize;
  unsigned short numblocks;
  unsigned short curblock;
  unsigned short maxnode;
  bool needppmend;
  int home();
  FILE* my_file_in;
  PPM_ReadBuf* my_read_buf;
  ppm_worker ppm;
public:
  QString about() { return QString("ppms Codec (c) Tim Wentford\nCompression code (c) Fabrice Bellard"); }
#ifdef USEQPE
	void suspend()
      {
	  CExpander::suspend(my_file_in);
      }
  void unsuspend()
      {
	  CExpander::unsuspend(my_file_in);
      }
#else
      void suspend() {}
      void unsuspend() {}
#endif
  ppm_expander() : needppmend(false), my_file_in(NULL), my_read_buf(NULL)
    {
    bufsize = 1024;
    buf_in = new UCHAR[bufsize];
    buf_out = new UCHAR[bufsize];
    outbytes = 0;
  }
  int OpenFile(const char* infile);
  int getch();
  void locate(unsigned short block, unsigned int n);
  virtual ~ppm_expander();
  unsigned int locate() { return outbytes; }
  void locate(unsigned int n);
  bool hasrandomaccess() { return (numblocks > 1); }
  void sizes(unsigned long& file, unsigned long& text);
  MarkupType PreferredMarkup()
      {
	  return cTEXT;
      }
};

#endif