BLowLevelPackageContentHandler interface extension
HandleAttributeDone(): Add parentToken parameter.
This commit is contained in:
@@ -32,7 +32,7 @@ public:
|
|||||||
virtual status_t HandleAttributeDone(
|
virtual status_t HandleAttributeDone(
|
||||||
BHPKGAttributeID attributeID,
|
BHPKGAttributeID attributeID,
|
||||||
const BPackageAttributeValue& value,
|
const BPackageAttributeValue& value,
|
||||||
void* token) = 0;
|
void* parentToken, void* token) = 0;
|
||||||
|
|
||||||
virtual void HandleErrorOccurred() = 0;
|
virtual void HandleErrorOccurred() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ protected:
|
|||||||
struct LowLevelAttributeHandler : AttributeHandler {
|
struct LowLevelAttributeHandler : AttributeHandler {
|
||||||
LowLevelAttributeHandler();
|
LowLevelAttributeHandler();
|
||||||
LowLevelAttributeHandler(uint8 id,
|
LowLevelAttributeHandler(uint8 id,
|
||||||
const BPackageAttributeValue& value, void* token);
|
const BPackageAttributeValue& value, void* parentToken,
|
||||||
|
void* token);
|
||||||
|
|
||||||
virtual status_t HandleAttribute(
|
virtual status_t HandleAttribute(
|
||||||
AttributeHandlerContext* context, uint8 id,
|
AttributeHandlerContext* context, uint8 id,
|
||||||
@@ -153,6 +154,7 @@ protected:
|
|||||||
virtual status_t Delete(AttributeHandlerContext* context);
|
virtual status_t Delete(AttributeHandlerContext* context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void* fParentToken;
|
||||||
void* fToken;
|
void* fToken;
|
||||||
uint8 fID;
|
uint8 fID;
|
||||||
AttributeValue fValue;
|
AttributeValue fValue;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ struct PackageContentDumpHandler : BLowLevelPackageContentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual status_t HandleAttributeDone(BHPKGAttributeID attributeID,
|
virtual status_t HandleAttributeDone(BHPKGAttributeID attributeID,
|
||||||
const BPackageAttributeValue& value, void* token)
|
const BPackageAttributeValue& value, void* parentToken, void* token)
|
||||||
{
|
{
|
||||||
if (fErrorOccurred)
|
if (fErrorOccurred)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -463,6 +463,7 @@ ReaderImplBase::PackageAttributeHandler::HandleAttribute(
|
|||||||
|
|
||||||
ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler()
|
ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler()
|
||||||
:
|
:
|
||||||
|
fParentToken(NULL),
|
||||||
fToken(NULL),
|
fToken(NULL),
|
||||||
fID(B_HPKG_ATTRIBUTE_ID_ENUM_COUNT)
|
fID(B_HPKG_ATTRIBUTE_ID_ENUM_COUNT)
|
||||||
{
|
{
|
||||||
@@ -470,8 +471,9 @@ ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler()
|
|||||||
|
|
||||||
|
|
||||||
ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler(uint8 id,
|
ReaderImplBase::LowLevelAttributeHandler::LowLevelAttributeHandler(uint8 id,
|
||||||
const BPackageAttributeValue& value, void* token)
|
const BPackageAttributeValue& value, void* parentToken, void* token)
|
||||||
:
|
:
|
||||||
|
fParentToken(NULL),
|
||||||
fToken(token),
|
fToken(token),
|
||||||
fID(id),
|
fID(id),
|
||||||
fValue(value)
|
fValue(value)
|
||||||
@@ -494,10 +496,10 @@ ReaderImplBase::LowLevelAttributeHandler::HandleAttribute(
|
|||||||
// create a subhandler for the attribute, if it has children
|
// create a subhandler for the attribute, if it has children
|
||||||
if (_handler != NULL) {
|
if (_handler != NULL) {
|
||||||
*_handler = new(std::nothrow) LowLevelAttributeHandler(id, value,
|
*_handler = new(std::nothrow) LowLevelAttributeHandler(id, value,
|
||||||
token);
|
fToken, token);
|
||||||
if (*_handler == NULL) {
|
if (*_handler == NULL) {
|
||||||
context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id,
|
context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id,
|
||||||
value, token);
|
value, fToken, token);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -505,7 +507,7 @@ ReaderImplBase::LowLevelAttributeHandler::HandleAttribute(
|
|||||||
|
|
||||||
// no children -- just call the done hook
|
// no children -- just call the done hook
|
||||||
return context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id,
|
return context->lowLevelHandler->HandleAttributeDone((BHPKGAttributeID)id,
|
||||||
value, token);
|
value, fToken, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -516,7 +518,7 @@ ReaderImplBase::LowLevelAttributeHandler::Delete(
|
|||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
if (fID != B_HPKG_ATTRIBUTE_ID_ENUM_COUNT) {
|
if (fID != B_HPKG_ATTRIBUTE_ID_ENUM_COUNT) {
|
||||||
error = context->lowLevelHandler->HandleAttributeDone(
|
error = context->lowLevelHandler->HandleAttributeDone(
|
||||||
(BHPKGAttributeID)fID, fValue, fToken);
|
(BHPKGAttributeID)fID, fValue, fParentToken, fToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
|
|||||||
Reference in New Issue
Block a user