haiku/headers/os/package/hpkg/v1/PackageDataReader.h
Ingo Weinhold 7575abbca2 Clone read support functionality for HPKG format version 1
It uses sub-namespace BPackage::BHPKG::V1. Unlike the one for the
current format version, the V1 version of BPackageInfoContentHandler
lives in BHPKG(::V1) sub-namespace and is private.
2013-05-25 01:12:22 +02:00

69 lines
1.3 KiB
C++

/*
* Copyright 2009,2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__V1__PACKAGE_DATA_READER_H_
#define _PACKAGE__HPKG__V1__PACKAGE_DATA_READER_H_
#include <package/hpkg/DataReader.h>
namespace BPackageKit {
namespace BHPKG {
class BBufferCache;
class BDataOutput;
namespace V1 {
class BPackageData;
class BPackageDataReader : public BDataReader {
public:
BPackageDataReader(BDataReader* dataReader);
virtual ~BPackageDataReader();
virtual status_t Init(const BPackageData& data) = 0;
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;
virtual uint64 Size() const = 0;
virtual size_t BlockSize() const = 0;
protected:
BDataReader* fDataReader;
};
class BPackageDataReaderFactory {
public:
BPackageDataReaderFactory(
BBufferCache* bufferCache);
status_t CreatePackageDataReader(BDataReader* dataReader,
const BPackageData& data,
BPackageDataReader*& _reader);
private:
BBufferCache* fBufferCache;
};
} // namespace V1
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__V1__PACKAGE_DATA_READER_H_