2 * Copyright 2009,2011, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 #ifndef _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_
6 #define _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_
9 #include <SupportDefs.h>
11 #include <package/hpkg/HPKGDefs.h>
14 namespace BPackageKit
{
19 struct BPackageAttributeValue
;
21 class BPackageEntryAttribute
;
22 struct BPackageInfoAttributeValue
;
25 class BLowLevelPackageContentHandler
{
27 virtual ~BLowLevelPackageContentHandler();
29 virtual status_t
HandleSectionStart(
30 BHPKGPackageSectionID sectionID
,
31 bool& _handleSection
) = 0;
32 virtual status_t
HandleSectionEnd(
33 BHPKGPackageSectionID sectionID
) = 0;
35 virtual status_t
HandleAttribute(BHPKGAttributeID attributeID
,
36 const BPackageAttributeValue
& value
,
37 void* parentToken
, void*& _token
) = 0;
38 virtual status_t
HandleAttributeDone(
39 BHPKGAttributeID attributeID
,
40 const BPackageAttributeValue
& value
,
41 void* parentToken
, void* token
) = 0;
43 virtual void HandleErrorOccurred() = 0;
46 static const char* AttributeNameForID(uint8 id
);
50 class BPackageContentHandler
{
52 virtual ~BPackageContentHandler();
54 virtual status_t
HandleEntry(BPackageEntry
* entry
) = 0;
55 virtual status_t
HandleEntryAttribute(BPackageEntry
* entry
,
56 BPackageEntryAttribute
* attribute
) = 0;
57 virtual status_t
HandleEntryDone(BPackageEntry
* entry
) = 0;
59 virtual status_t
HandlePackageAttribute(
60 const BPackageInfoAttributeValue
& value
63 virtual void HandleErrorOccurred() = 0;
69 } // namespace BPackageKit
72 #endif // _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_