xref: /haiku/src/kits/package/hpkg/RepositoryWriter.cpp (revision c2388992ec05d5252a3c8a71a6420effce548952)
14ee7d007SOliver Tappe /*
24ee7d007SOliver Tappe  * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
34ee7d007SOliver Tappe  * Distributed under the terms of the MIT License.
44ee7d007SOliver Tappe  */
54ee7d007SOliver Tappe 
64ee7d007SOliver Tappe 
74ee7d007SOliver Tappe #include <package/hpkg/RepositoryWriter.h>
84ee7d007SOliver Tappe 
94ee7d007SOliver Tappe #include <new>
104ee7d007SOliver Tappe 
114ee7d007SOliver Tappe #include <package/hpkg/RepositoryWriterImpl.h>
120d68f6afSOliver Tappe #include <package/RepositoryInfo.h>
134ee7d007SOliver Tappe 
144ee7d007SOliver Tappe 
154ee7d007SOliver Tappe namespace BPackageKit {
164ee7d007SOliver Tappe 
174ee7d007SOliver Tappe namespace BHPKG {
184ee7d007SOliver Tappe 
194ee7d007SOliver Tappe 
200d68f6afSOliver Tappe BRepositoryWriter::BRepositoryWriter(BRepositoryWriterListener* listener,
21*c2388992SOliver Tappe 	BRepositoryInfo* repositoryInfo)
224ee7d007SOliver Tappe 	:
230d68f6afSOliver Tappe 	fImpl(new (std::nothrow) RepositoryWriterImpl(listener, repositoryInfo))
244ee7d007SOliver Tappe {
254ee7d007SOliver Tappe }
264ee7d007SOliver Tappe 
274ee7d007SOliver Tappe 
284ee7d007SOliver Tappe BRepositoryWriter::~BRepositoryWriter()
294ee7d007SOliver Tappe {
304ee7d007SOliver Tappe 	delete fImpl;
314ee7d007SOliver Tappe }
324ee7d007SOliver Tappe 
334ee7d007SOliver Tappe 
344ee7d007SOliver Tappe status_t
354ee7d007SOliver Tappe BRepositoryWriter::Init(const char* fileName)
364ee7d007SOliver Tappe {
374ee7d007SOliver Tappe 	if (fImpl == NULL)
384ee7d007SOliver Tappe 		return B_NO_MEMORY;
394ee7d007SOliver Tappe 
404ee7d007SOliver Tappe 	return fImpl->Init(fileName);
414ee7d007SOliver Tappe }
424ee7d007SOliver Tappe 
434ee7d007SOliver Tappe 
444ee7d007SOliver Tappe status_t
458b94d2ffSOliver Tappe BRepositoryWriter::AddPackage(const BEntry& packageEntry)
464ee7d007SOliver Tappe {
474ee7d007SOliver Tappe 	if (fImpl == NULL)
484ee7d007SOliver Tappe 		return B_NO_INIT;
494ee7d007SOliver Tappe 
508b94d2ffSOliver Tappe 	return fImpl->AddPackage(packageEntry);
514ee7d007SOliver Tappe }
524ee7d007SOliver Tappe 
534ee7d007SOliver Tappe 
544ee7d007SOliver Tappe status_t
554ee7d007SOliver Tappe BRepositoryWriter::Finish()
564ee7d007SOliver Tappe {
574ee7d007SOliver Tappe 	if (fImpl == NULL)
584ee7d007SOliver Tappe 		return B_NO_INIT;
594ee7d007SOliver Tappe 
604ee7d007SOliver Tappe 	return fImpl->Finish();
614ee7d007SOliver Tappe }
624ee7d007SOliver Tappe 
634ee7d007SOliver Tappe 
644ee7d007SOliver Tappe }	// namespace BHPKG
654ee7d007SOliver Tappe 
664ee7d007SOliver Tappe }	// namespace BPackageKit
67