1 /* 2 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de> 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <package/hpkg/PackageWriter.h> 8 9 #include <new> 10 11 #include <package/hpkg/PackageWriterImpl.h> 12 13 14 namespace BPackageKit { 15 16 namespace BHPKG { 17 18 19 BPackageWriter::BPackageWriter(BPackageWriterListener* listener) 20 : 21 fImpl(new (std::nothrow) PackageWriterImpl(listener)) 22 { 23 } 24 25 26 BPackageWriter::~BPackageWriter() 27 { 28 delete fImpl; 29 } 30 31 32 status_t 33 BPackageWriter::Init(const char* fileName, uint32 flags) 34 { 35 if (fImpl == NULL) 36 return B_NO_MEMORY; 37 38 return fImpl->Init(fileName, flags); 39 } 40 41 42 status_t 43 BPackageWriter::SetInstallPath(const char* installPath) 44 { 45 if (fImpl == NULL) 46 return B_NO_INIT; 47 48 return fImpl->SetInstallPath(installPath); 49 } 50 51 52 void 53 BPackageWriter::SetCheckLicenses(bool checkLicenses) 54 { 55 if (fImpl != NULL) 56 fImpl->SetCheckLicenses(checkLicenses); 57 } 58 59 60 status_t 61 BPackageWriter::AddEntry(const char* fileName, int fd) 62 { 63 if (fImpl == NULL) 64 return B_NO_INIT; 65 66 return fImpl->AddEntry(fileName, fd); 67 } 68 69 70 status_t 71 BPackageWriter::Finish() 72 { 73 if (fImpl == NULL) 74 return B_NO_INIT; 75 76 return fImpl->Finish(); 77 } 78 79 80 } // namespace BHPKG 81 82 } // namespace BPackageKit 83