xref: /haiku/headers/os/package/hpkg/PackageWriter.h (revision 4466b89c65970de4c7236ac87faa2bee4589f413)
1 /*
2  * Copyright 2009,2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__HPKG__PACKAGE_WRITER_H_
6 #define _PACKAGE__HPKG__PACKAGE_WRITER_H_
7 
8 
9 #include <SupportDefs.h>
10 
11 #include <package/hpkg/ErrorOutput.h>
12 
13 
14 namespace BPackageKit {
15 
16 namespace BHPKG {
17 
18 
19 namespace BPrivate {
20 	class PackageWriterImpl;
21 }
22 using BPrivate::PackageWriterImpl;
23 
24 
25 class BPackageWriterListener : public BErrorOutput {
26 public:
27 	virtual	void				PrintErrorVarArgs(const char* format,
28 									va_list args) = 0;
29 
30 	virtual	void				OnEntryAdded(const char* path) = 0;
31 
32 	virtual void				OnTOCSizeInfo(uint64 uncompressedStringsSize,
33 									uint64 uncompressedMainSize,
34 									uint64 uncompressedTOCSize) = 0;
35 	virtual void				OnPackageAttributesSizeInfo(uint32 stringCount,
36 									uint32 uncompressedSize) = 0;
37 	virtual void				OnPackageSizeInfo(uint32 headerSize,
38 									uint64 heapSize, uint64 tocSize,
39 									uint32 packageAttributesSize,
40 									uint64 totalSize) = 0;
41 };
42 
43 
44 class BPackageWriter {
45 public:
46 public:
47 								BPackageWriter(
48 									BPackageWriterListener* listener);
49 								~BPackageWriter();
50 
51 			status_t			Init(const char* fileName);
52 			status_t			AddEntry(const char* fileName);
53 			status_t			Finish();
54 
55 private:
56 			PackageWriterImpl*	fImpl;
57 };
58 
59 
60 }	// namespace BHPKG
61 
62 }	// namespace BPackageKit
63 
64 
65 #endif	// _PACKAGE__HPKG__PACKAGE_WRITER_H_
66