xref: /haiku/headers/os/package/hpkg/PackageReader.h (revision 16c83730262f1e4f0fc69d80744bb36dcfbbe3af)
1 /*
2  * Copyright 2009,2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__HPKG__PACKAGE_READER_H_
6 #define _PACKAGE__HPKG__PACKAGE_READER_H_
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 namespace BPackageKit {
13 
14 namespace BHPKG {
15 
16 
17 namespace BPrivate {
18 	class PackageReaderImpl;
19 }
20 using BPrivate::PackageReaderImpl;
21 
22 
23 class BAbstractBufferedDataReader;
24 class BErrorOutput;
25 class BLowLevelPackageContentHandler;
26 class BPackageContentHandler;
27 
28 
29 class BPackageReader {
30 public:
31 								BPackageReader(BErrorOutput* errorOutput);
32 								~BPackageReader();
33 
34 			status_t			Init(const char* fileName, uint32 flags = 0);
35 			status_t			Init(int fd, bool keepFD, uint32 flags = 0);
36 			status_t			ParseContent(
37 									BPackageContentHandler* contentHandler);
38 			status_t			ParseContent(BLowLevelPackageContentHandler*
39 										contentHandler);
40 
41 			int					PackageFileFD();
42 
43 			BAbstractBufferedDataReader* HeapReader() const;
44 									// Only valid as long as the reader lives.
45 
46 private:
47 			PackageReaderImpl*	fImpl;
48 };
49 
50 
51 }	// namespace BHPKG
52 
53 }	// namespace BPackageKit
54 
55 
56 #endif	// _PACKAGE__HPKG__PACKAGE_READER_H_
57