Add UnpackingNode::IsOnlyPackageNode()

It returns whether the given package node is the only package node
attached to that node.
This commit is contained in:
Ingo Weinhold 2011-07-11 20:32:09 +02:00
parent 0a9478a707
commit f391c9b0ea
5 changed files with 19 additions and 0 deletions

View File

@ -132,6 +132,14 @@ UnpackingDirectory::GetPackageNode()
}
bool
UnpackingDirectory::IsOnlyPackageNode(PackageNode* node) const
{
return node == fPackageDirectories.Head()
&& node == fPackageDirectories.Tail();
}
status_t
UnpackingDirectory::OpenAttributeDirectory(AttributeDirectoryCookie*& _cookie)
{

View File

@ -28,6 +28,7 @@ public:
virtual void RemovePackageNode(PackageNode* packageNode);
virtual PackageNode* GetPackageNode();
virtual bool IsOnlyPackageNode(PackageNode* node) const;
virtual status_t OpenAttributeDirectory(
AttributeDirectoryCookie*& _cookie);

View File

@ -156,6 +156,14 @@ UnpackingLeafNode::GetPackageNode()
}
bool
UnpackingLeafNode::IsOnlyPackageNode(PackageNode* node) const
{
PackageLeafNode* head = fPackageNodes.Head();
return node == head && fPackageNodes.GetNext(head) == NULL;
}
status_t
UnpackingLeafNode::Read(off_t offset, void* buffer, size_t* bufferSize)
{

View File

@ -31,6 +31,7 @@ public:
virtual void RemovePackageNode(PackageNode* packageNode);
virtual PackageNode* GetPackageNode();
virtual bool IsOnlyPackageNode(PackageNode* node) const;
virtual status_t Read(off_t offset, void* buffer,
size_t* bufferSize);

View File

@ -23,6 +23,7 @@ public:
virtual void RemovePackageNode(PackageNode* packageNode) = 0;
virtual PackageNode* GetPackageNode() = 0;
virtual bool IsOnlyPackageNode(PackageNode* node) const = 0;
};