2011-01-30 18:05:38 +03:00
|
|
|
/*
|
2011-01-30 18:15:33 +03:00
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
2011-01-30 18:05:38 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__HPKG__PACKAGE_READER_H_
|
|
|
|
#define _PACKAGE__HPKG__PACKAGE_READER_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
2014-07-12 15:34:56 +04:00
|
|
|
class BPositionIO;
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
class PackageReaderImpl;
|
|
|
|
}
|
|
|
|
using BPrivate::PackageReaderImpl;
|
|
|
|
|
2013-05-18 06:11:01 +04:00
|
|
|
|
|
|
|
class BAbstractBufferedDataReader;
|
2011-01-30 18:05:38 +03:00
|
|
|
class BErrorOutput;
|
|
|
|
class BLowLevelPackageContentHandler;
|
|
|
|
class BPackageContentHandler;
|
2014-07-08 23:58:10 +04:00
|
|
|
class BPackageWriter;
|
2011-01-30 18:05:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
class BPackageReader {
|
|
|
|
public:
|
2013-05-18 06:11:01 +04:00
|
|
|
BPackageReader(BErrorOutput* errorOutput);
|
2011-01-30 18:05:38 +03:00
|
|
|
~BPackageReader();
|
|
|
|
|
2013-05-20 22:15:59 +04:00
|
|
|
status_t Init(const char* fileName, uint32 flags = 0);
|
|
|
|
status_t Init(int fd, bool keepFD, uint32 flags = 0);
|
2014-07-12 15:34:56 +04:00
|
|
|
status_t Init(BPositionIO* file, bool keepFile,
|
|
|
|
uint32 flags = 0);
|
2011-01-30 18:05:38 +03:00
|
|
|
status_t ParseContent(
|
|
|
|
BPackageContentHandler* contentHandler);
|
|
|
|
status_t ParseContent(BLowLevelPackageContentHandler*
|
|
|
|
contentHandler);
|
|
|
|
|
2014-07-12 15:34:56 +04:00
|
|
|
BPositionIO* PackageFile() const;
|
2013-05-18 06:11:01 +04:00
|
|
|
|
|
|
|
BAbstractBufferedDataReader* HeapReader() const;
|
|
|
|
// Only valid as long as the reader lives.
|
|
|
|
|
2014-07-08 23:58:10 +04:00
|
|
|
private:
|
|
|
|
friend class BPackageWriter;
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
private:
|
|
|
|
PackageReaderImpl* fImpl;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
2011-02-10 22:09:14 +03:00
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_READER_H_
|