From 2fce201893210a48fb65ac7b35969c5dbe68e5e3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 2 Jul 2011 02:29:40 +0200 Subject: [PATCH] BLowLevelPackageContentHandler interface extension HandleAttributeDone(): Add parentToken parameter. --- headers/os/package/hpkg/PackageContentHandler.h | 2 +- headers/private/package/hpkg/ReaderImplBase.h | 4 +++- src/bin/package/command_dump.cpp | 2 +- src/kits/package/hpkg/ReaderImplBase.cpp | 12 +++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/headers/os/package/hpkg/PackageContentHandler.h b/headers/os/package/hpkg/PackageContentHandler.h index 1314d92785..2d421155d1 100644 --- a/headers/os/package/hpkg/PackageContentHandler.h +++ b/headers/os/package/hpkg/PackageContentHandler.h @@ -32,7 +32,7 @@ public: virtual status_t HandleAttributeDone( BHPKGAttributeID attributeID, const BPackageAttributeValue& value, - void* token) = 0; + void* parentToken, void* token) = 0; virtual void HandleErrorOccurred() = 0; diff --git a/headers/private/package/hpkg/ReaderImplBase.h b/headers/private/package/hpkg/ReaderImplBase.h index 5ddc5aa73d..a65a7c80bc 100644 --- a/headers/private/package/hpkg/ReaderImplBase.h +++ b/headers/private/package/hpkg/ReaderImplBase.h @@ -145,7 +145,8 @@ protected: struct LowLevelAttributeHandler : AttributeHandler { LowLevelAttributeHandler(); LowLevelAttributeHandler(uint8 id, - const BPackageAttributeValue& value, void* token); + const BPackageAttributeValue& value, void* parentToken, + void* token); virtual status_t HandleAttribute( AttributeHandlerContext* context, uint8 id, @@ -153,6 +154,7 @@ protected: virtual status_t Delete(AttributeHandlerContext* context); private: + void* fParentToken; void* fToken; uint8 fID; AttributeValue fValue; diff --git a/src/bin/package/command_dump.cpp b/src/bin/package/command_dump.cpp index 789c32c8ec..c5387c31b6 100644 --- a/src/bin/package/command_dump.cpp +++ b/src/bin/package/command_dump.cpp @@ -50,7 +50,7 @@ struct PackageContentDumpHandler : BLowLevelPackageContentHandler { } virtual status_t HandleAttributeDone(BHPKGAttributeID attributeID, - const BPackageAttributeValue& value, void* token) + const BPackageAttributeValue& value, void* parentToken, void* token) { if (fErrorOccurred) return B_OK; diff --git a/src/kits/package/hpkg/ReaderImplBase.cpp b/src/kits/package/hpkg/ReaderImplBase.cpp index 44706b9bf7..8da4d32073 100644 --- a/src/kits/package/hpkg/ReaderImplBase.cpp +++ b/src/kits/package/hpkg/ReaderImplBase.cpp @@ -463,6 +463,7 @@ ReaderImplBase::PackageAttributeHandler::HandleAttribute( ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler() : + fParentToken(NULL), fToken(NULL), fID(B_HPKG_ATTRIBUTE_ID_ENUM_COUNT) { @@ -470,8 +471,9 @@ ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler() ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler(uint8 id, - const BPackageAttributeValue& value, void* token) + const BPackageAttributeValue& value, void* parentToken, void* token) : + fParentToken(NULL), fToken(token), fID(id), fValue(value) @@ -494,10 +496,10 @@ ReaderImplBase::LowLevelAttributeHandler::HandleAttribute( // create a subhandler for the attribute, if it has children if (_handler != NULL) { *_handler = new(std::nothrow) LowLevelAttributeHandler(id, value, - token); + fToken, token); if (*_handler == NULL) { context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id, - value, token); + value, fToken, token); return B_NO_MEMORY; } return B_OK; @@ -505,7 +507,7 @@ ReaderImplBase::LowLevelAttributeHandler::HandleAttribute( // no children -- just call the done hook return context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id, - value, token); + value, fToken, token); } @@ -516,7 +518,7 @@ ReaderImplBase::LowLevelAttributeHandler::Delete( status_t error = B_OK; if (fID != B_HPKG_ATTRIBUTE_ID_ENUM_COUNT) { error = context->lowLevelHandler->HandleAttributeDone( - (BHPKGAttributeID)fID, fValue, fToken); + (BHPKGAttributeID)fID, fValue, fParentToken, fToken); } delete this;