Restore the "GPL licensing not permitted" in GLUT license headers.
[haiku.git] / headers / os / package / hpkg / PackageWriter.h
blobb57a0423a204f738eb809a94f20609222e3990a3
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_
9 #include <SupportDefs.h>
11 #include <package/hpkg/ErrorOutput.h>
14 class BPositionIO;
17 namespace BPackageKit {
19 namespace BHPKG {
21 namespace BPrivate {
22 class PackageWriterImpl;
24 using BPrivate::PackageWriterImpl;
27 class BPackageWriterListener : public BErrorOutput {
28 public:
29 virtual void PrintErrorVarArgs(const char* format,
30 va_list args) = 0;
32 virtual void OnEntryAdded(const char* path) = 0;
34 virtual void OnTOCSizeInfo(uint64 uncompressedStringsSize,
35 uint64 uncompressedMainSize,
36 uint64 uncompressedTOCSize) = 0;
37 virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
38 uint32 uncompressedSize) = 0;
39 virtual void OnPackageSizeInfo(uint32 headerSize,
40 uint64 heapSize, uint64 tocSize,
41 uint32 packageAttributesSize,
42 uint64 totalSize) = 0;
46 class BPackageWriterParameters {
47 public:
48 BPackageWriterParameters();
49 ~BPackageWriterParameters();
51 uint32 Flags() const;
52 void SetFlags(uint32 flags);
54 uint32 Compression() const;
55 void SetCompression(uint32 compression);
57 int32 CompressionLevel() const;
58 void SetCompressionLevel(int32 compressionLevel);
60 private:
61 uint32 fFlags;
62 uint32 fCompression;
63 int32 fCompressionLevel;
67 class BPackageWriter {
68 public:
69 BPackageWriter(
70 BPackageWriterListener* listener);
71 ~BPackageWriter();
73 status_t Init(const char* fileName,
74 const BPackageWriterParameters* parameters
75 = NULL);
76 status_t Init(BPositionIO* file, bool keepFile,
77 const BPackageWriterParameters* parameters
78 = NULL);
79 status_t SetInstallPath(const char* installPath);
80 void SetCheckLicenses(bool checkLicenses);
81 status_t AddEntry(const char* fileName, int fd = -1);
82 status_t Finish();
84 status_t Recompress(BPositionIO* inputFile);
85 // to be called after Init(); no Finish()
87 private:
88 PackageWriterImpl* fImpl;
92 } // namespace BHPKG
94 } // namespace BPackageKit
97 #endif // _PACKAGE__HPKG__PACKAGE_WRITER_H_