Remove BPackageKit::BDataOutput

Use BDataIO instead.
This commit is contained in:
Ingo Weinhold
2014-06-23 22:58:15 +02:00
parent 0d8b44e25b
commit 32832cbe47
32 changed files with 102 additions and 211 deletions
@@ -1 +0,0 @@
#include <../os/package/hpkg/DataOutput.h>
-45
View File
@@ -1,45 +0,0 @@
/*
* Copyright 2009,2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__DATA_OUTPUT_H_
#define _PACKAGE__HPKG__DATA_OUTPUT_H_
#include <SupportDefs.h>
namespace BPackageKit {
namespace BHPKG {
class BDataOutput {
public:
virtual ~BDataOutput();
virtual status_t WriteData(const void* buffer, size_t size) = 0;
};
class BBufferDataOutput : public BDataOutput {
public:
BBufferDataOutput(void* buffer, size_t size);
size_t BytesWritten() const { return fBytesWritten; }
virtual status_t WriteData(const void* buffer, size_t size);
private:
void* fBuffer;
size_t fSize;
size_t fBytesWritten;
};
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__DATA_OUTPUT_H_
+6 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009,2011, Haiku, Inc.
* Copyright 2009-2014, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__DATA_READER_H_
@@ -9,14 +9,14 @@
#include <SupportDefs.h>
class BDataIO;
namespace BPackageKit {
namespace BHPKG {
class BDataOutput;
class BDataReader {
public:
virtual ~BDataReader();
@@ -33,7 +33,7 @@ public:
virtual status_t ReadData(off_t offset, void* buffer,
size_t size);
virtual status_t ReadDataToOutput(off_t offset, size_t size,
BDataOutput* output) = 0;
BDataIO* output) = 0;
};
@@ -73,7 +73,7 @@ public:
virtual status_t ReadData(off_t offset, void* buffer,
size_t size);
virtual status_t ReadDataToOutput(off_t offset, size_t size,
BDataOutput* output);
BDataIO* output);
private:
const void* fData;
+5 -5
View File
@@ -1,13 +1,13 @@
/*
* Copyright 2011, Oliver Tappe <[email protected]>
* Copyright 2013, Ingo Weinhold, [email protected].
* Copyright 2013-2014, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__DATA_WRITERS_H_
#define _PACKAGE__HPKG__PRIVATE__DATA_WRITERS_H_
#include <package/hpkg/DataOutput.h>
#include <DataIO.h>
#include <package/hpkg/ZlibCompressor.h>
@@ -59,7 +59,7 @@ private:
};
class ZlibDataWriter : public AbstractDataWriter, private BDataOutput {
class ZlibDataWriter : public AbstractDataWriter, private BDataIO {
public:
ZlibDataWriter(AbstractDataWriter* dataWriter);
@@ -70,8 +70,8 @@ public:
size_t size);
private:
// BDataOutput
virtual status_t WriteData(const void* buffer, size_t size);
// BDataIO
virtual ssize_t Write(const void* buffer, size_t size);
private:
AbstractDataWriter* fDataWriter;
@@ -1,5 +1,5 @@
/*
* Copyright 2013, Ingo Weinhold, [email protected].
* Copyright 2013-2014, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_ACCESSOR_BASE_H_
@@ -48,8 +48,8 @@ public:
{ fFD = fd; }
// BAbstractBufferedDataReader
virtual status_t ReadDataToOutput(off_t offset, size_t size,
BDataOutput* output);
virtual status_t ReadDataToOutput(off_t offset,
size_t size, BDataIO* output);
public:
static const size_t kChunkSize = 64 * 1024;
@@ -10,7 +10,6 @@
#include <package/hpkg/HPKGDefsPrivate.h>
#include <package/hpkg/DataOutput.h>
#include <package/hpkg/DataWriters.h>
#include <package/hpkg/PackageWriter.h>
#include <package/hpkg/Strings.h>
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2009-2014, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSOR_H_
@@ -11,20 +11,19 @@
#include <package/hpkg/ZlibCompressionBase.h>
class BDataIO;
namespace BPackageKit {
namespace BHPKG {
class BDataOutput;
namespace BPrivate {
class ZlibCompressor : public ZlibCompressionBase {
public:
ZlibCompressor(BDataOutput* output);
ZlibCompressor(BDataIO* output);
~ZlibCompressor();
status_t Init(int compressionLevel = Z_BEST_COMPRESSION);
@@ -39,7 +38,7 @@ public:
private:
z_stream fStream;
BDataOutput* fOutput;
BDataIO* fOutput;
bool fStreamInitialized;
};
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2009-2014, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_
@@ -11,20 +11,19 @@
#include <package/hpkg/ZlibCompressionBase.h>
class BDataIO;
namespace BPackageKit {
namespace BHPKG {
class BDataOutput;
namespace BPrivate {
class ZlibDecompressor : public ZlibCompressionBase {
public:
ZlibDecompressor(BDataOutput* output);
ZlibDecompressor(BDataIO* output);
~ZlibDecompressor();
status_t Init();
@@ -39,7 +38,7 @@ public:
private:
z_stream fStream;
BDataOutput* fOutput;
BDataIO* fOutput;
bool fStreamInitialized;
bool fFinished;
};