File: CharCache.H

package info (click to toggle)
dxpc 3.8.0-5
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 672 kB
  • ctags: 780
  • sloc: cpp: 10,145; sh: 173; makefile: 87
file content (37 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (4)
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
#ifndef CharCache_H
#define CharCache_H

// CharCache is a counterpart of IntCache that is
// optimized for use in compressing text composed
// of 8-bit characters.  (There used to be an
// abstract class Cache from which CharCache and
// IntCache were derived.  This has been eliminated,
// however, since the use of virtual functions
// increased the size of each CharCache by 50%
// (not a good thing when TextCompressor has an
// array of several thousand CharCaches :-)

class CharCache
{
  public:
  CharCache():length_(0)
  {
  }
   ~CharCache()
  {
  }
  unsigned int getSize() const
  {
    return (unsigned int) length_;
  }
  int lookup(unsigned char value, unsigned int &index);
  unsigned int get(unsigned int i);
  void insert(unsigned char value);

private:
  unsigned char length_;
  unsigned char buffer_[7];	// limit to 7 chars so object will fit in 8 bytes

};

#endif /* CharCache_H */