mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 19:25:53 +02:00
trunk/branch integration: documentation
This commit is contained in:
@@ -44,38 +44,42 @@
|
|||||||
#include "Poco/BufferedStreamBuf.h"
|
#include "Poco/BufferedStreamBuf.h"
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#if defined(POCO_UNBUNDLED)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
#include "Poco/zlib.h"
|
#include "Poco/zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
class Foundation_API DeflatingStreamBuf: public BufferedStreamBuf
|
class Foundation_API DeflatingStreamBuf: public BufferedStreamBuf
|
||||||
/// This is the streambuf class used by DeflatingInputStream and DeflatingOutputStream.
|
/// This is the streambuf class used by DeflatingInputStream and DeflatingOutputStream.
|
||||||
/// The actual work is delegated to zlib 1.2.1 (see http://www.gzip.org).
|
/// The actual work is delegated to zlib (see http://zlib.net).
|
||||||
/// Both zlib (deflate) streams and gzip streams are supported.
|
/// Both zlib (deflate) streams and gzip streams are supported.
|
||||||
/// Output streams should always call close() to ensure
|
/// Output streams should always call close() to ensure
|
||||||
/// proper completion of compression.
|
/// proper completion of compression.
|
||||||
/// A compression level (0 to 9) can be specified in the constructor.
|
/// A compression level (0 to 9) can be specified in the constructor.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum StreamType
|
enum StreamType
|
||||||
{
|
{
|
||||||
STREAM_ZLIB,
|
STREAM_ZLIB, /// Create a zlib header, use Adler-32 checksum.
|
||||||
STREAM_GZIP
|
STREAM_GZIP /// Create a gzip header, use CRC-32 checksum.
|
||||||
};
|
};
|
||||||
|
|
||||||
DeflatingStreamBuf(std::istream& istr, StreamType type, int level);
|
DeflatingStreamBuf(std::istream& istr, StreamType type, int level);
|
||||||
DeflatingStreamBuf(std::ostream& ostr, StreamType type, int level);
|
DeflatingStreamBuf(std::ostream& ostr, StreamType type, int level);
|
||||||
~DeflatingStreamBuf();
|
~DeflatingStreamBuf();
|
||||||
int close();
|
int close();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int readFromDevice(char* buffer, std::streamsize length);
|
int readFromDevice(char* buffer, std::streamsize length);
|
||||||
int writeToDevice(const char* buffer, std::streamsize length);
|
int writeToDevice(const char* buffer, std::streamsize length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
STREAM_BUFFER_SIZE = 1024,
|
STREAM_BUFFER_SIZE = 1024,
|
||||||
DEFLATE_BUFFER_SIZE = 32768
|
DEFLATE_BUFFER_SIZE = 32768
|
||||||
@@ -96,13 +100,13 @@ class Foundation_API DeflatingIOS: public virtual std::ios
|
|||||||
/// order of the stream buffer and base classes.
|
/// order of the stream buffer and base classes.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
||||||
DeflatingIOS(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
DeflatingIOS(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
||||||
~DeflatingIOS();
|
~DeflatingIOS();
|
||||||
DeflatingStreamBuf* rdbuf();
|
DeflatingStreamBuf* rdbuf();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DeflatingStreamBuf _buf;
|
DeflatingStreamBuf _buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -119,9 +123,9 @@ class Foundation_API DeflatingOutputStream: public DeflatingIOS, public std::ost
|
|||||||
/// ostr.close();
|
/// ostr.close();
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeflatingOutputStream(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
DeflatingOutputStream(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
||||||
~DeflatingOutputStream();
|
~DeflatingOutputStream();
|
||||||
int close();
|
int close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -130,8 +134,8 @@ class Foundation_API DeflatingInputStream: public DeflatingIOS, public std::istr
|
|||||||
/// using zlib's deflate algorithm.
|
/// using zlib's deflate algorithm.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeflatingInputStream(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
DeflatingInputStream(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
|
||||||
~DeflatingInputStream();
|
~DeflatingInputStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user