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>
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2011-01-30 18:05:38 +03:00
|
|
|
status_t ParseContent(
|
|
|
|
BPackageContentHandler* contentHandler);
|
|
|
|
status_t ParseContent(BLowLevelPackageContentHandler*
|
|
|
|
contentHandler);
|
|
|
|
|
|
|
|
int PackageFileFD();
|
2013-05-18 06:11:01 +04:00
|
|
|
|
|
|
|
BAbstractBufferedDataReader* HeapReader() const;
|
|
|
|
// Only valid as long as the reader lives.
|
|
|
|
|
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_
|