2 * Copyright 2009,2011, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 #ifndef _PACKAGE__HPKG__V1__PACKAGE_CONTENT_HANDLER_H_
6 #define _PACKAGE__HPKG__V1__PACKAGE_CONTENT_HANDLER_H_
9 #include <SupportDefs.h>
11 #include <package/hpkg/v1/HPKGDefs.h>
14 namespace BPackageKit
{
19 struct BPackageInfoAttributeValue
;
25 struct BPackageAttributeValue
;
27 class BPackageEntryAttribute
;
30 class BLowLevelPackageContentHandler
{
32 virtual ~BLowLevelPackageContentHandler();
34 virtual status_t
HandleSectionStart(
35 BHPKGPackageSectionID sectionID
,
36 bool& _handleSection
) = 0;
37 virtual status_t
HandleSectionEnd(
38 BHPKGPackageSectionID sectionID
) = 0;
40 virtual status_t
HandleAttribute(BHPKGAttributeID attributeID
,
41 const BPackageAttributeValue
& value
,
42 void* parentToken
, void*& _token
) = 0;
43 virtual status_t
HandleAttributeDone(
44 BHPKGAttributeID attributeID
,
45 const BPackageAttributeValue
& value
,
46 void* parentToken
, void* token
) = 0;
48 virtual void HandleErrorOccurred() = 0;
51 static const char* AttributeNameForID(uint8 id
);
55 class BPackageContentHandler
{
57 virtual ~BPackageContentHandler();
59 virtual status_t
HandleEntry(BPackageEntry
* entry
) = 0;
60 virtual status_t
HandleEntryAttribute(BPackageEntry
* entry
,
61 BPackageEntryAttribute
* attribute
) = 0;
62 virtual status_t
HandleEntryDone(BPackageEntry
* entry
) = 0;
64 virtual status_t
HandlePackageAttribute(
65 const BPackageInfoAttributeValue
& value
68 virtual void HandleErrorOccurred() = 0;
76 } // namespace BPackageKit
79 #endif // _PACKAGE__HPKG__V1__PACKAGE_CONTENT_HANDLER_H_