Added FindDescendant() and _IsShadow().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3978 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-07-15 01:16:29 +00:00
parent 92b9e33326
commit 442e574d88
2 changed files with 19 additions and 0 deletions

View File

@ -60,6 +60,7 @@ public:
BPartition *Parent() const;
BPartition *ChildAt(int32 index) const;
int32 CountChildren() const;
BPartition *FindDescendant(partition_id id) const;
status_t GetPartitioningInfo(BPartitioningInfo *info) const;
@ -132,6 +133,8 @@ private:
user_partition_data *data);
void _Unset();
bool _IsShadow() const;
int32 _Level() const;
virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
BPartition *_VisitEachDescendant(BDiskDeviceVisitor *visitor,

View File

@ -8,6 +8,7 @@
#include <Partition.h>
#include <DiskDevice.h>
#include <DiskDevicePrivate.h>
#include <DiskDeviceVisitor.h>
#include <Message.h>
#include <Volume.h>
@ -358,6 +359,14 @@ BPartition::CountChildren() const
return (fPartitionData ? fPartitionData->child_count : 0);
}
// FindDescendant
BPartition *
BPartition::FindDescendant(partition_id id) const
{
IDFinderVisitor visitor(id);
return const_cast<BPartition*>(this)->VisitEachDescendant(&visitor);
}
// GetPartitioningInfo
status_t
BPartition::GetPartitioningInfo(BPartitioningInfo *info) const
@ -435,6 +444,13 @@ BPartition::_Unset()
fPartitionData = NULL;
}
// _IsShadow
bool
BPartition::_IsShadow() const
{
return (fPartitionData && fPartitionData->shadow_id >= 0);
}
// _Level
int32
BPartition::_Level() const