Move package kit Zlib* classes to support kit

Also move to B* namespace and no longer expose the zlib dependency in
the headers.
This commit is contained in:
Ingo Weinhold
2014-06-30 21:55:41 +02:00
parent b773d89eba
commit 6a89a36aa0
39 changed files with 563 additions and 634 deletions
@@ -13,7 +13,6 @@
#include <package/hpkg/PackageFileHeapWriter.h>
#include <package/hpkg/PackageWriter.h>
#include <package/hpkg/Strings.h>
#include <package/hpkg/ZlibCompressor.h>
#include <package/PackageInfo.h>
@@ -1,32 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_
#define _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_
#include <SupportDefs.h>
namespace BPackageKit {
namespace BHPKG {
namespace BPrivate {
class ZlibCompressionBase {
public:
static status_t TranslateZlibError(int error);
};
} // namespace BPrivate
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_
@@ -1,53 +0,0 @@
/*
* Copyright 2009-2014, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSOR_H_
#define _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSOR_H_
#include <zlib.h>
#include <package/hpkg/ZlibCompressionBase.h>
class BDataIO;
namespace BPackageKit {
namespace BHPKG {
namespace BPrivate {
class ZlibCompressor : public ZlibCompressionBase {
public:
ZlibCompressor(BDataIO* output);
~ZlibCompressor();
status_t Init(int compressionLevel = Z_BEST_COMPRESSION);
status_t CompressNext(const void* input,
size_t inputSize);
status_t Finish();
static status_t CompressSingleBuffer(const void* input,
size_t inputSize, void* output,
size_t outputSize, size_t& _compressedSize,
int compressionLevel = Z_BEST_COMPRESSION);
private:
z_stream fStream;
BDataIO* fOutput;
bool fStreamInitialized;
};
} // namespace BPrivate
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSOR_H_
@@ -1,54 +0,0 @@
/*
* Copyright 2009-2014, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_
#define _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_
#include <zlib.h>
#include <package/hpkg/ZlibCompressionBase.h>
class BDataIO;
namespace BPackageKit {
namespace BHPKG {
namespace BPrivate {
class ZlibDecompressor : public ZlibCompressionBase {
public:
ZlibDecompressor(BDataIO* output);
~ZlibDecompressor();
status_t Init();
status_t DecompressNext(const void* input,
size_t inputSize);
status_t Finish();
static status_t DecompressSingleBuffer(const void* input,
size_t inputSize, void* output,
size_t outputSize,
size_t& _uncompressedSize);
private:
z_stream fStream;
BDataIO* fOutput;
bool fStreamInitialized;
bool fFinished;
};
} // namespace BPrivate
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_