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) 34 { 35 if (fImpl == NULL) 36 return B_NO_MEMORY; 37 38 return fImpl->Init(fileName); 39 } 40 41 42 status_t 43 BPackageWriter::AddEntry(const char* fileName, int fd) 44 { 45 if (fImpl == NULL) 46 return B_NO_INIT; 47 48 return fImpl->AddEntry(fileName, fd); 49 } 50 51 52 status_t 53 BPackageWriter::Finish() 54 { 55 if (fImpl == NULL) 56 return B_NO_INIT; 57 58 return fImpl->Finish(); 59 } 60 61 62 } // namespace BHPKG 63 64 } // namespace BPackageKit 65