git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9713 a95241bf-73f2-0310-859d-f6bbb57e9c96
65 lines
1.2 KiB
C++
65 lines
1.2 KiB
C++
//----------------------------------------------------------------------
|
|
// This software is part of the OpenBeOS distribution and is covered
|
|
// by the OpenBeOS license.
|
|
//---------------------------------------------------------------------
|
|
|
|
#include <DiskDevicePrivate.h>
|
|
#include <DiskDevice.h>
|
|
#include <Partition.h>
|
|
|
|
// PartitionFilterVisitor
|
|
|
|
// constructor
|
|
PartitionFilterVisitor::PartitionFilterVisitor(BDiskDeviceVisitor *visitor,
|
|
PartitionFilter *filter)
|
|
: BDiskDeviceVisitor(),
|
|
fVisitor(visitor),
|
|
fFilter(filter)
|
|
{
|
|
}
|
|
|
|
// Visit
|
|
bool
|
|
PartitionFilterVisitor::Visit(BDiskDevice *device)
|
|
{
|
|
if (fFilter->Filter(device, 0))
|
|
return fVisitor->Visit(device);
|
|
return false;
|
|
}
|
|
|
|
// Visit
|
|
bool
|
|
PartitionFilterVisitor::Visit(BPartition *partition, int32 level)
|
|
{
|
|
if (fFilter->Filter(partition, level))
|
|
return fVisitor->Visit(partition, level);
|
|
return false;
|
|
}
|
|
|
|
|
|
// #pragma mark -
|
|
|
|
// IDFinderVisitor
|
|
|
|
// constructor
|
|
IDFinderVisitor::IDFinderVisitor(int32 id)
|
|
: BDiskDeviceVisitor(),
|
|
fID(id)
|
|
{
|
|
}
|
|
|
|
// Visit
|
|
bool
|
|
IDFinderVisitor::Visit(BDiskDevice *device)
|
|
{
|
|
return (device->ID() == fID);
|
|
}
|
|
|
|
// Visit
|
|
bool
|
|
IDFinderVisitor::Visit(BPartition *partition, int32 level)
|
|
{
|
|
return (partition->ID() == fID);
|
|
}
|
|
|