2 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3 * Distributed under the terms of the MIT License.
7 #include <package/hpkg/PackageWriter.h>
11 #include <package/hpkg/PackageWriterImpl.h>
14 namespace BPackageKit
{
19 // #pragma mark - BPackageWriterParameters
22 BPackageWriterParameters::BPackageWriterParameters()
25 fCompression(B_HPKG_COMPRESSION_ZLIB
),
26 fCompressionLevel(B_HPKG_COMPRESSION_LEVEL_BEST
)
31 BPackageWriterParameters::~BPackageWriterParameters()
37 BPackageWriterParameters::Flags() const
44 BPackageWriterParameters::SetFlags(uint32 flags
)
51 BPackageWriterParameters::Compression() const
58 BPackageWriterParameters::SetCompression(uint32 compression
)
60 fCompression
= compression
;
65 BPackageWriterParameters::CompressionLevel() const
67 return fCompressionLevel
;
72 BPackageWriterParameters::SetCompressionLevel(int32 compressionLevel
)
74 fCompressionLevel
= compressionLevel
;
78 // #pragma mark - BPackageWriter
81 BPackageWriter::BPackageWriter(BPackageWriterListener
* listener
)
83 fImpl(new (std::nothrow
) PackageWriterImpl(listener
))
88 BPackageWriter::~BPackageWriter()
95 BPackageWriter::Init(const char* fileName
,
96 const BPackageWriterParameters
* parameters
)
101 BPackageWriterParameters defaultParameters
;
103 return fImpl
->Init(fileName
,
104 parameters
!= NULL
? *parameters
: defaultParameters
);
109 BPackageWriter::Init(BPositionIO
* file
, bool keepFile
,
110 const BPackageWriterParameters
* parameters
)
115 BPackageWriterParameters defaultParameters
;
117 return fImpl
->Init(file
, keepFile
,
118 parameters
!= NULL
? *parameters
: defaultParameters
);
123 BPackageWriter::SetInstallPath(const char* installPath
)
128 return fImpl
->SetInstallPath(installPath
);
133 BPackageWriter::SetCheckLicenses(bool checkLicenses
)
136 fImpl
->SetCheckLicenses(checkLicenses
);
141 BPackageWriter::AddEntry(const char* fileName
, int fd
)
146 return fImpl
->AddEntry(fileName
, fd
);
151 BPackageWriter::Finish()
156 return fImpl
->Finish();
161 BPackageWriter::Recompress(BPositionIO
* inputFile
)
166 return fImpl
->Recompress(inputFile
);
172 } // namespace BPackageKit