xref: /haiku/src/kits/package/hpkg/RepositoryWriter.cpp (revision 4ee7d007d6aa14cd7d9286e52dbb57580fd8f8f7)
1*4ee7d007SOliver Tappe /*
2*4ee7d007SOliver Tappe  * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3*4ee7d007SOliver Tappe  * Distributed under the terms of the MIT License.
4*4ee7d007SOliver Tappe  */
5*4ee7d007SOliver Tappe 
6*4ee7d007SOliver Tappe 
7*4ee7d007SOliver Tappe #include <package/hpkg/RepositoryWriter.h>
8*4ee7d007SOliver Tappe 
9*4ee7d007SOliver Tappe #include <new>
10*4ee7d007SOliver Tappe 
11*4ee7d007SOliver Tappe #include <package/hpkg/RepositoryWriterImpl.h>
12*4ee7d007SOliver Tappe 
13*4ee7d007SOliver Tappe 
14*4ee7d007SOliver Tappe namespace BPackageKit {
15*4ee7d007SOliver Tappe 
16*4ee7d007SOliver Tappe namespace BHPKG {
17*4ee7d007SOliver Tappe 
18*4ee7d007SOliver Tappe 
19*4ee7d007SOliver Tappe BRepositoryWriter::BRepositoryWriter(BRepositoryWriterListener* listener)
20*4ee7d007SOliver Tappe 	:
21*4ee7d007SOliver Tappe 	fImpl(new (std::nothrow) RepositoryWriterImpl(listener))
22*4ee7d007SOliver Tappe {
23*4ee7d007SOliver Tappe }
24*4ee7d007SOliver Tappe 
25*4ee7d007SOliver Tappe 
26*4ee7d007SOliver Tappe BRepositoryWriter::~BRepositoryWriter()
27*4ee7d007SOliver Tappe {
28*4ee7d007SOliver Tappe 	delete fImpl;
29*4ee7d007SOliver Tappe }
30*4ee7d007SOliver Tappe 
31*4ee7d007SOliver Tappe 
32*4ee7d007SOliver Tappe status_t
33*4ee7d007SOliver Tappe BRepositoryWriter::Init(const char* fileName)
34*4ee7d007SOliver Tappe {
35*4ee7d007SOliver Tappe 	if (fImpl == NULL)
36*4ee7d007SOliver Tappe 		return B_NO_MEMORY;
37*4ee7d007SOliver Tappe 
38*4ee7d007SOliver Tappe 	return fImpl->Init(fileName);
39*4ee7d007SOliver Tappe }
40*4ee7d007SOliver Tappe 
41*4ee7d007SOliver Tappe 
42*4ee7d007SOliver Tappe status_t
43*4ee7d007SOliver Tappe BRepositoryWriter::AddPackage(const BPackageInfo& packageInfo)
44*4ee7d007SOliver Tappe {
45*4ee7d007SOliver Tappe 	if (fImpl == NULL)
46*4ee7d007SOliver Tappe 		return B_NO_INIT;
47*4ee7d007SOliver Tappe 
48*4ee7d007SOliver Tappe 	return fImpl->AddPackage(packageInfo);
49*4ee7d007SOliver Tappe }
50*4ee7d007SOliver Tappe 
51*4ee7d007SOliver Tappe 
52*4ee7d007SOliver Tappe status_t
53*4ee7d007SOliver Tappe BRepositoryWriter::Finish()
54*4ee7d007SOliver Tappe {
55*4ee7d007SOliver Tappe 	if (fImpl == NULL)
56*4ee7d007SOliver Tappe 		return B_NO_INIT;
57*4ee7d007SOliver Tappe 
58*4ee7d007SOliver Tappe 	return fImpl->Finish();
59*4ee7d007SOliver Tappe }
60*4ee7d007SOliver Tappe 
61*4ee7d007SOliver Tappe 
62*4ee7d007SOliver Tappe }	// namespace BHPKG
63*4ee7d007SOliver Tappe 
64*4ee7d007SOliver Tappe }	// namespace BPackageKit
65