2011-01-30 15:05:38 +00:00
|
|
|
/*
|
2011-01-30 15:15:33 +00:00
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
2011-01-30 15:05:38 +00: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 15:43:33 +00:00
|
|
|
#include <package/hpkg/ErrorOutput.h>
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
class PackageWriterImpl;
|
|
|
|
}
|
|
|
|
using BPrivate::PackageWriterImpl;
|
|
|
|
|
|
|
|
|
2011-01-31 15:43:33 +00: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 19:21:37 +00:00
|
|
|
virtual void OnTOCSizeInfo(uint64 uncompressedStringsSize,
|
2011-01-31 15:43:33 +00:00
|
|
|
uint64 uncompressedMainSize,
|
|
|
|
uint64 uncompressedTOCSize) = 0;
|
2011-02-08 19:50:36 +00:00
|
|
|
virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
|
2011-01-31 15:43:33 +00:00
|
|
|
uint32 uncompressedSize) = 0;
|
|
|
|
virtual void OnPackageSizeInfo(uint32 headerSize,
|
|
|
|
uint64 heapSize, uint64 tocSize,
|
|
|
|
uint32 packageAttributesSize,
|
|
|
|
uint64 totalSize) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-05-19 01:07:08 +02:00
|
|
|
class BPackageWriterParameters {
|
|
|
|
public:
|
|
|
|
BPackageWriterParameters();
|
|
|
|
~BPackageWriterParameters();
|
|
|
|
|
|
|
|
uint32 Flags() const;
|
|
|
|
void SetFlags(uint32 flags);
|
|
|
|
|
|
|
|
int32 CompressionLevel() const;
|
|
|
|
void SetCompressionLevel(int32 compressionLevel);
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32 fFlags;
|
|
|
|
int32 fCompressionLevel;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
class BPackageWriter {
|
2011-01-31 15:43:33 +00:00
|
|
|
public:
|
|
|
|
BPackageWriter(
|
|
|
|
BPackageWriterListener* listener);
|
2011-01-30 15:05:38 +00:00
|
|
|
~BPackageWriter();
|
|
|
|
|
2013-05-19 01:07:08 +02:00
|
|
|
status_t Init(const char* fileName,
|
|
|
|
const BPackageWriterParameters* parameters
|
|
|
|
= NULL);
|
2011-07-11 14:00:55 +02:00
|
|
|
status_t SetInstallPath(const char* installPath);
|
2011-07-11 13:55:35 +02:00
|
|
|
void SetCheckLicenses(bool checkLicenses);
|
2011-07-01 01:41:28 +02:00
|
|
|
status_t AddEntry(const char* fileName, int fd = -1);
|
2011-01-30 15:05:38 +00:00
|
|
|
status_t Finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PackageWriterImpl* fImpl;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_WRITER_H_
|