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 14namespace BPackageKit { 15 16namespace BHPKG { 17 18 19namespace BPrivate { 20 class PackageWriterImpl; 21} 22using BPrivate::PackageWriterImpl; 23 24 25class BPackageWriterListener : public BErrorOutput { 26public: 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 44class BPackageWriter { 45public: 46 BPackageWriter( 47 BPackageWriterListener* listener); 48 ~BPackageWriter(); 49 50 status_t Init(const char* fileName, uint32 flags = 0); 51 status_t SetInstallPath(const char* installPath); 52 void SetCheckLicenses(bool checkLicenses); 53 status_t AddEntry(const char* fileName, int fd = -1); 54 status_t Finish(); 55 56private: 57 PackageWriterImpl* fImpl; 58}; 59 60 61} // namespace BHPKG 62 63} // namespace BPackageKit 64 65 66#endif // _PACKAGE__HPKG__PACKAGE_WRITER_H_ 67