1 /* 2 * Copyright 2009,2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_ 6 #define _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_ 7 8 9 #include <SupportDefs.h> 10 11 #include <package/hpkg/HPKGDefs.h> 12 13 14 namespace BPackageKit { 15 16 namespace BHPKG { 17 18 19 class BPackageAttributeValue; 20 class BPackageEntry; 21 class BPackageEntryAttribute; 22 class BPackageInfoAttributeValue; 23 24 25 class BLowLevelPackageContentHandler { 26 public: 27 virtual ~BLowLevelPackageContentHandler(); 28 29 virtual status_t HandleAttribute(BHPKGAttributeID attributeID, 30 const BPackageAttributeValue& value, 31 void* parentToken, void*& _token) = 0; 32 virtual status_t HandleAttributeDone( 33 BHPKGAttributeID attributeID, 34 const BPackageAttributeValue& value, 35 void* token) = 0; 36 37 virtual void HandleErrorOccurred() = 0; 38 39 protected: 40 static const char* AttributeNameForID(uint8 id); 41 }; 42 43 44 class BPackageContentHandler { 45 public: 46 virtual ~BPackageContentHandler(); 47 48 virtual status_t HandleEntry(BPackageEntry* entry) = 0; 49 virtual status_t HandleEntryAttribute(BPackageEntry* entry, 50 BPackageEntryAttribute* attribute) = 0; 51 virtual status_t HandleEntryDone(BPackageEntry* entry) = 0; 52 53 virtual status_t HandlePackageAttribute( 54 const BPackageInfoAttributeValue& value 55 ) = 0; 56 57 virtual void HandleErrorOccurred() = 0; 58 }; 59 60 61 } // namespace BHPKG 62 63 } // namespace BPackageKit 64 65 66 #endif // _PACKAGE__HPKG__PACKAGE_CONTENT_HANDLER_H_ 67