Repository file format: group attributes of a package

* Introduce new package attribute B_HPKG_ATTRIBUTE_ID_PACKAGE (valid
  only in a repository file) to group the attributes belonging to a
  package.
* BRepositoryContentHandler:
  - No longer derive from BPackageContentHandler.
  - Add hooks HandlePackage() and HandlePackageDone() that bracket the
    attributes for a package. This is more explicit and robust than
    handlers having to guess when one package ended and the next began.
* BRepositoryCache: Make use of BPackageInfoContentHandler. No need to
  duplicate the code for reading a package info from package info
  attributes.
This commit is contained in:
Ingo Weinhold
2013-07-04 19:20:14 +02:00
parent 17d00ecd27
commit e85334022e
12 changed files with 238 additions and 162 deletions
@@ -81,3 +81,4 @@ B_DEFINE_HPKG_ATTRIBUTE(52, STRING, "package:post-install-script",
PACKAGE_POST_INSTALL_SCRIPT)
B_DEFINE_HPKG_ATTRIBUTE(53, UINT, "package:is-writable-directory",
PACKAGE_IS_WRITABLE_DIRECTORY)
B_DEFINE_HPKG_ATTRIBUTE(54, STRING, "package", PACKAGE)
@@ -8,7 +8,7 @@
#include <SupportDefs.h>
#include <package/hpkg/PackageContentHandler.h>
#include <package/hpkg/HPKGDefs.h>
namespace BPackageKit {
@@ -20,10 +20,24 @@ class BRepositoryInfo;
namespace BHPKG {
class BRepositoryContentHandler : public BPackageContentHandler {
class BPackageInfoAttributeValue;
class BRepositoryContentHandler {
public:
virtual ~BRepositoryContentHandler();
virtual status_t HandleRepositoryInfo(
const BRepositoryInfo& info) = 0;
virtual status_t HandlePackage(const char* packageName) = 0;
virtual status_t HandlePackageAttribute(
const BPackageInfoAttributeValue& value)
= 0;
virtual status_t HandlePackageDone(const char* packageName) = 0;
virtual void HandleErrorOccurred() = 0;
};