2011-02-08 13:59:38 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__HPKG__PRIVATE__REPOSITORY_WRITER_IMPL_H_
|
|
|
|
#define _PACKAGE__HPKG__PRIVATE__REPOSITORY_WRITER_IMPL_H_
|
|
|
|
|
|
|
|
|
2011-02-08 23:15:50 +03:00
|
|
|
#include <Entry.h>
|
2011-02-08 13:59:38 +03:00
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
#include <package/hpkg/PackageContentHandler.h>
|
2011-02-08 23:15:50 +03:00
|
|
|
#include <package/hpkg/RepositoryWriter.h>
|
2011-02-08 13:59:38 +03:00
|
|
|
#include <package/hpkg/WriterImplBase.h>
|
2011-02-09 22:11:23 +03:00
|
|
|
#include <package/PackageInfo.h>
|
2011-02-08 13:59:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
|
2011-02-08 13:59:38 +03:00
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
class BPackageEntry;
|
|
|
|
class BPackageEntryAttribute;
|
|
|
|
class BPackageInfoAttributeValue;
|
2011-02-08 13:59:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
|
|
|
struct hpkg_header;
|
|
|
|
|
2011-02-14 20:24:50 +03:00
|
|
|
class RepositoryWriterImpl : public WriterImplBase {
|
2011-02-10 20:16:35 +03:00
|
|
|
typedef WriterImplBase inherited;
|
|
|
|
|
2011-02-08 13:59:38 +03:00
|
|
|
public:
|
|
|
|
RepositoryWriterImpl(
|
2011-02-09 22:11:23 +03:00
|
|
|
BRepositoryWriterListener* listener,
|
2011-02-14 20:24:50 +03:00
|
|
|
BRepositoryInfo* repositoryInfo);
|
2011-02-08 13:59:38 +03:00
|
|
|
~RepositoryWriterImpl();
|
|
|
|
|
|
|
|
status_t Init(const char* fileName);
|
2011-02-08 23:15:50 +03:00
|
|
|
status_t AddPackage(const BEntry& packageEntry);
|
2011-02-08 13:59:38 +03:00
|
|
|
status_t Finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t _Init(const char* fileName);
|
2011-02-08 23:15:50 +03:00
|
|
|
status_t _AddPackage(const BEntry& packageEntry);
|
2011-02-08 13:59:38 +03:00
|
|
|
status_t _Finish();
|
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
status_t _RegisterCurrentPackageInfo();
|
2011-02-10 22:05:35 +03:00
|
|
|
status_t _WriteRepositoryInfo(hpkg_repo_header& header,
|
|
|
|
ssize_t& _infoLengthCompressed);
|
2011-02-08 23:15:50 +03:00
|
|
|
off_t _WritePackageAttributes(
|
2011-02-10 22:05:35 +03:00
|
|
|
hpkg_repo_header& header, off_t startOffset,
|
|
|
|
ssize_t& _packagesLengthCompressed);
|
2011-02-09 22:11:23 +03:00
|
|
|
|
|
|
|
struct PackageNameSet;
|
2011-02-08 23:15:50 +03:00
|
|
|
|
2011-02-08 13:59:38 +03:00
|
|
|
private:
|
|
|
|
BRepositoryWriterListener* fListener;
|
2011-02-09 22:11:23 +03:00
|
|
|
|
2011-02-14 20:24:50 +03:00
|
|
|
BRepositoryInfo* fRepositoryInfo;
|
2011-02-09 22:11:23 +03:00
|
|
|
|
|
|
|
BPackageInfo fPackageInfo;
|
|
|
|
uint32 fPackageCount;
|
|
|
|
PackageNameSet* fPackageNames;
|
2011-02-08 13:59:38 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PRIVATE__REPOSITORY_WRITER_IMPL_H_
|