00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00046
#ifndef CCXX_ZSTREAM_H_
00047
#define CCXX_ZSTREAM_H_
00048
00049
#ifndef CCXX_MISSING_H_
00050
#include <cc++/missing.h>
00051
#endif
00052
00053
#ifndef CCXX_THREAD_H_
00054
#include <cc++/thread.h>
00055
#endif
00056
00057
#ifndef CCXX_STRING_H_
00058
#include <cc++/string.h>
00059
#endif
00060
00061
#ifndef CCXX_EXCEPTION_H_
00062
#include <cc++/exception.h>
00063
#endif
00064
00065
#include <zlib.h>
00066
00067
#ifdef CCXX_NAMESPACES
00068
namespace ost {
00069
#endif
00070
00071
#ifdef COMMON_STD_EXCEPTION
00072
00073
class __EXPORT IOZException :
public IOException
00074 {
00075
public:
00076 IOZException(
const String &str) : IOException(str) {};
00077 };
00078
00079
#endif
00080
00081 class __EXPORT IZStream :
protected std::streambuf,
public std::istream
00082 {
00083
private:
00084 gzFile fp;
00085
int doallocate();
00086
bool throwflag;
00087
00088
protected:
00089 size_t bufsize;
00090 char *gbuf;
00091
00092
void allocate(size_t size);
00093
00094
int underflow();
00095
00096
int uflow();
00097
00098
public:
00099 IZStream(
bool throwflag =
false);
00100 IZStream(
const char *name, size_t size = 512,
bool tf =
false);
00101
00102
bool isOpen(
void);
00103
00104
void close(
void);
00105
00106
virtual ~IZStream();
00107
00108
void open(
const char *name, size_t size = 512);
00109
00110 inline size_t getBufferSize(
void)
00111 {
return bufsize;};
00112 };
00113
00114 class __EXPORT OZStream :
protected std::streambuf,
public std::ostream
00115 {
00116
private:
00117 gzFile fp;
00118
int doallocate();
00119
bool throwflag;
00120
00121
protected:
00122 size_t bufsize;
00123 char *pbuf;
00124
00125
void allocate(size_t size);
00126
00127
int overflow(
int ch);
00128
00129
public:
00130 OZStream(
bool throwflag =
false);
00131 OZStream(
const char *name,
int level = Z_DEFAULT_COMPRESSION, size_t size = 512,
bool tf =
false);
00132
00133
bool isOpen(
void);
00134
00135
void close(
void);
00136
00137
virtual ~OZStream();
00138
00139
void open(
const char *name,
int level = Z_DEFAULT_COMPRESSION, size_t size = 512);
00140
00141 inline size_t getBufferSize(
void)
00142 {
return bufsize;};
00143 };
00144
00145
#ifdef CCXX_NAMESPACES
00146
}
00147
#endif
00148
00149
#endif
00150