From 442e574d8859f867d1d06936ec4487c275e4dc9f Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 15 Jul 2003 01:16:29 +0000 Subject: [PATCH] Added FindDescendant() and _IsShadow(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3978 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/storage/Partition.h | 3 +++ src/kits/storage/Partition.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index 72437cdbef..426fbdaa50 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -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, diff --git a/src/kits/storage/Partition.cpp b/src/kits/storage/Partition.cpp index 154dfb9941..87cc01b837 100644 --- a/src/kits/storage/Partition.cpp +++ b/src/kits/storage/Partition.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -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(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