From 1e58e9e2a01e2334f486dceca2d2a771629ccdfb Mon Sep 17 00:00:00 2001 From: Marian Krivos Date: Tue, 23 Aug 2011 06:51:23 +0000 Subject: [PATCH] trunk/branch integration: documentation --- Foundation/include/Poco/InflatingStream.h | 78 ++++++++++++----------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/Foundation/include/Poco/InflatingStream.h b/Foundation/include/Poco/InflatingStream.h index b8af99234..31f6c4437 100644 --- a/Foundation/include/Poco/InflatingStream.h +++ b/Foundation/include/Poco/InflatingStream.h @@ -1,7 +1,7 @@ // // InflatingStream.h // -// $Id: //poco/svn/Foundation/include/Poco/InflatingStream.h#2 $ +// $Id: //poco/1.4/Foundation/include/Poco/InflatingStream.h#2 $ // // Library: Foundation // Package: Streams @@ -44,34 +44,38 @@ #include "Poco/BufferedStreamBuf.h" #include #include +#if defined(POCO_UNBUNDLED) +#include +#else #include "Poco/zlib.h" +#endif namespace Poco { class Foundation_API InflatingStreamBuf: public BufferedStreamBuf - /// This is the streambuf class used by InflatingInputStream and InflatingOutputStream. - /// The actual work is delegated to zlib 1.2.1 (see http://www.gzip.org). - /// Both zlib (deflate) streams and gzip streams are supported. - /// Output streams should always call close() to ensure - /// proper completion of decompression. + /// This is the streambuf class used by InflatingInputStream and InflatingOutputStream. + /// The actual work is delegated to zlib (see http://zlib.net). + /// Both zlib (deflate) streams and gzip streams are supported. + /// Output streams should always call close() to ensure + /// proper completion of decompression. { public: - enum StreamType - { - STREAM_ZLIB, - STREAM_GZIP, - STREAM_ZIP // ZIP is handled as STREAM_ZLIB, except that we do not check the ADLER32 value (must be checked by an outside class!) - }; - - InflatingStreamBuf(std::istream& istr, StreamType type); - InflatingStreamBuf(std::ostream& ostr, StreamType type); - ~InflatingStreamBuf(); - int close(); + enum StreamType + { + STREAM_ZLIB, /// Expect a zlib header, use Adler-32 checksum. + STREAM_GZIP, /// Expect a gzip header, use CRC-32 checksum. + STREAM_ZIP /// STREAM_ZIP is handled as STREAM_ZLIB, except that we do not check the ADLER32 value (must be checked by caller) + }; + InflatingStreamBuf(std::istream& istr, StreamType type); + InflatingStreamBuf(std::ostream& ostr, StreamType type); + ~InflatingStreamBuf(); + int close(); + protected: - int readFromDevice(char* buffer, std::streamsize length); + int readFromDevice(char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length); private: @@ -97,26 +101,26 @@ class Foundation_API InflatingIOS: public virtual std::ios /// order of the stream buffer and base classes. { public: - InflatingIOS(std::ostream& ostr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); - InflatingIOS(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); - ~InflatingIOS(); - InflatingStreamBuf* rdbuf(); - + InflatingIOS(std::ostream& ostr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); + InflatingIOS(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); + ~InflatingIOS(); + InflatingStreamBuf* rdbuf(); + protected: - InflatingStreamBuf _buf; + InflatingStreamBuf _buf; }; class Foundation_API InflatingOutputStream: public InflatingIOS, public std::ostream - /// This stream decompresses all data passing through it - /// using zlib's inflate algorithm. - /// After all data has been written to the stream, close() - /// must be called to ensure completion of decompression. + /// This stream decompresses all data passing through it + /// using zlib's inflate algorithm. + /// After all data has been written to the stream, close() + /// must be called to ensure completion of decompression. { public: - InflatingOutputStream(std::ostream& ostr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); - ~InflatingOutputStream(); - int close(); + InflatingOutputStream(std::ostream& ostr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); + ~InflatingOutputStream(); + int close(); }; @@ -124,14 +128,14 @@ class Foundation_API InflatingInputStream: public InflatingIOS, public std::istr /// This stream decompresses all data passing through it /// using zlib's inflate algorithm. /// Example: - /// std::ifstream istr("data.gz", std::ios::binary); - /// InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP); - /// std::string data; - /// istr >> data; + /// std::ifstream istr("data.gz", std::ios::binary); + /// InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP); + /// std::string data; + /// istr >> data; { public: - InflatingInputStream(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); - ~InflatingInputStream(); + InflatingInputStream(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); + ~InflatingInputStream(); };