The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
swcomprs.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * swcomprs.h - class SWCompress: used for data
4  * compression
5  *
6  * $Id: swcomprs.h 3786 2020-08-30 11:35:14Z scribe $
7  *
8  * Copyright 1996-2014 CrossWire Bible Society (http://www.crosswire.org)
9  * CrossWire Bible Society
10  * P. O. Box 2528
11  * Tempe, AZ 85280-2528
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU General Public License as published by the
15  * Free Software Foundation version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * General Public License for more details.
21  *
22  */
23 
24 #ifndef SWCOMPRS_H
25 #define SWCOMPRS_H
26 
27 #include <defs.h>
28 
30 
32 
33 private:
34  void init();
35  void cycleStream();
36 
37 protected:
38  mutable char *buf, *zbuf, direct; // 0 - encode; 1 - decode
39  unsigned long zlen, zpos, pos, slen;
40  int level;
41 
42 public:
43  SWCompress();
44  virtual ~SWCompress();
45  virtual void setUncompressedBuf(const char *buf = 0, unsigned long *len = 0);
46  virtual char *getUncompressedBuf(unsigned long *len = 0);
47  virtual void setCompressedBuf(unsigned long *len, char *buf = 0);
48  virtual char *getCompressedBuf(unsigned long *len = 0);
49  virtual unsigned long getChars(char *buf, unsigned long len); // override for other than buffer compression
50  virtual unsigned long sendChars(char *buf, unsigned long len); // override for other than buffer compression
51  virtual void encode(void); // override to provide compression algorythm
52  virtual void decode(void); // override to provide compression algorythm
53  virtual void setLevel(int l) {level = l;};
54  virtual int getLevel() {return level;};
55 };
56 
58 #endif
#define SWORD_NAMESPACE_START
Definition: defs.h:39
virtual int getLevel()
Definition: swcomprs.h:54
int pos
Definition: regex.c:5534
#define SWDLLEXPORT
Definition: defs.h:171
virtual void setLevel(int l)
Definition: swcomprs.h:53
int level
Definition: swcomprs.h:40
void init()
Definition: installmgr.cpp:164
unsigned long zpos
Definition: swcomprs.h:39
char * zbuf
Definition: swcomprs.h:38
#define SWORD_NAMESPACE_END
Definition: defs.h:40