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_WRITER_H_
|
|
|
|
#define _PACKAGE__HPKG__PACKAGE_WRITER_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2011-01-31 18:43:33 +03:00
|
|
|
#include <package/hpkg/ErrorOutput.h>
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
class PackageWriterImpl;
|
|
|
|
}
|
|
|
|
using BPrivate::PackageWriterImpl;
|
|
|
|
|
|
|
|
|
2011-01-31 18:43:33 +03:00
|
|
|
class BPackageWriterListener : public BErrorOutput {
|
|
|
|
public:
|
|
|
|
virtual void PrintErrorVarArgs(const char* format,
|
|
|
|
va_list args) = 0;
|
|
|
|
|
|
|
|
virtual void OnEntryAdded(const char* path) = 0;
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
virtual void OnTOCSizeInfo(uint64 uncompressedStringsSize,
|
2011-01-31 18:43:33 +03:00
|
|
|
uint64 uncompressedMainSize,
|
|
|
|
uint64 uncompressedTOCSize) = 0;
|
2011-02-08 22:50:36 +03:00
|
|
|
virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
|
2011-01-31 18:43:33 +03:00
|
|
|
uint32 uncompressedSize) = 0;
|
|
|
|
virtual void OnPackageSizeInfo(uint32 headerSize,
|
|
|
|
uint64 heapSize, uint64 tocSize,
|
|
|
|
uint32 packageAttributesSize,
|
|
|
|
uint64 totalSize) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
class BPackageWriter {
|
2011-01-31 18:43:33 +03:00
|
|
|
public:
|
|
|
|
BPackageWriter(
|
|
|
|
BPackageWriterListener* listener);
|
2011-01-30 18:05:38 +03:00
|
|
|
~BPackageWriter();
|
|
|
|
|
2011-07-03 06:26:54 +04:00
|
|
|
status_t Init(const char* fileName, uint32 flags = 0);
|
2011-07-11 16:00:55 +04:00
|
|
|
status_t SetInstallPath(const char* installPath);
|
2011-07-11 15:55:35 +04:00
|
|
|
void SetCheckLicenses(bool checkLicenses);
|
2011-07-01 03:41:28 +04:00
|
|
|
status_t AddEntry(const char* fileName, int fd = -1);
|
2011-01-30 18:05:38 +03:00
|
|
|
status_t Finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PackageWriterImpl* fImpl;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_WRITER_H_
|