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/RepositoryWriter.h> 8 9 #include <new> 10 11 #include <package/hpkg/RepositoryWriterImpl.h> 12 13 14 namespace BPackageKit { 15 16 namespace BHPKG { 17 18 19 BRepositoryWriter::BRepositoryWriter(BRepositoryWriterListener* listener) 20 : 21 fImpl(new (std::nothrow) RepositoryWriterImpl(listener)) 22 { 23 } 24 25 26 BRepositoryWriter::~BRepositoryWriter() 27 { 28 delete fImpl; 29 } 30 31 32 status_t 33 BRepositoryWriter::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 BRepositoryWriter::AddPackage(const BPackageInfo& packageInfo) 44 { 45 if (fImpl == NULL) 46 return B_NO_INIT; 47 48 return fImpl->AddPackage(packageInfo); 49 } 50 51 52 status_t 53 BRepositoryWriter::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