2011-01-30 18:05:38 +03:00
|
|
|
/*
|
2011-01-30 18:15:33 +03:00
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
2011-01-30 18:05:38 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_
|
|
|
|
#define _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
#include <package/hpkg/HPKGDefs.h>
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageAttributeValue;
|
|
|
|
class BPackageEntry;
|
|
|
|
class BPackageEntryAttribute;
|
2011-02-04 20:43:07 +03:00
|
|
|
class BPackageInfoAttributeValue;
|
2011-01-30 18:05:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
class BLowLevelPackageContentHandler {
|
|
|
|
public:
|
|
|
|
virtual ~BLowLevelPackageContentHandler();
|
|
|
|
|
2011-07-03 06:07:47 +04:00
|
|
|
virtual status_t HandleSectionStart(
|
|
|
|
BHPKGPackageSectionID sectionID,
|
|
|
|
bool& _handleSection) = 0;
|
|
|
|
virtual status_t HandleSectionEnd(
|
|
|
|
BHPKGPackageSectionID sectionID) = 0;
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
virtual status_t HandleAttribute(BHPKGAttributeID attributeID,
|
2011-01-30 18:05:38 +03:00
|
|
|
const BPackageAttributeValue& value,
|
|
|
|
void* parentToken, void*& _token) = 0;
|
2011-02-12 22:21:37 +03:00
|
|
|
virtual status_t HandleAttributeDone(
|
|
|
|
BHPKGAttributeID attributeID,
|
2011-01-30 18:05:38 +03:00
|
|
|
const BPackageAttributeValue& value,
|
2011-07-02 04:29:40 +04:00
|
|
|
void* parentToken, void* token) = 0;
|
2011-01-30 18:05:38 +03:00
|
|
|
|
|
|
|
virtual void HandleErrorOccurred() = 0;
|
2011-02-12 22:21:37 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static const char* AttributeNameForID(uint8 id);
|
2011-01-30 18:05:38 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageContentHandler {
|
|
|
|
public:
|
|
|
|
virtual ~BPackageContentHandler();
|
|
|
|
|
|
|
|
virtual status_t HandleEntry(BPackageEntry* entry) = 0;
|
|
|
|
virtual status_t HandleEntryAttribute(BPackageEntry* entry,
|
|
|
|
BPackageEntryAttribute* attribute) = 0;
|
|
|
|
virtual status_t HandleEntryDone(BPackageEntry* entry) = 0;
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
virtual status_t HandlePackageAttribute(
|
|
|
|
const BPackageInfoAttributeValue& value
|
|
|
|
) = 0;
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
virtual void HandleErrorOccurred() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_
|