2003-02-08 23:32:51 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
// 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)
|
|
|
|
|
{
|
2004-11-01 15:56:47 +00:00
|
|
|
if (fFilter->Filter(device, 0))
|
|
|
|
|
return fVisitor->Visit(device);
|
2003-02-08 23:32:51 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Visit
|
|
|
|
|
bool
|
2003-07-08 18:26:15 +00:00
|
|
|
PartitionFilterVisitor::Visit(BPartition *partition, int32 level)
|
2003-02-08 23:32:51 +00:00
|
|
|
{
|
2003-07-08 18:26:15 +00:00
|
|
|
if (fFilter->Filter(partition, level))
|
|
|
|
|
return fVisitor->Visit(partition, level);
|
2003-02-08 23:32:51 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-11-01 17:02:12 +00:00
|
|
|
// #pragma mark -
|
|
|
|
|
|
2003-02-08 23:32:51 +00:00
|
|
|
// IDFinderVisitor
|
|
|
|
|
|
|
|
|
|
// constructor
|
|
|
|
|
IDFinderVisitor::IDFinderVisitor(int32 id)
|
|
|
|
|
: BDiskDeviceVisitor(),
|
|
|
|
|
fID(id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Visit
|
|
|
|
|
bool
|
|
|
|
|
IDFinderVisitor::Visit(BDiskDevice *device)
|
|
|
|
|
{
|
2003-07-08 23:31:22 +00:00
|
|
|
return (device->ID() == fID);
|
2003-02-08 23:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Visit
|
|
|
|
|
bool
|
2003-07-08 18:26:15 +00:00
|
|
|
IDFinderVisitor::Visit(BPartition *partition, int32 level)
|
2003-02-08 23:32:51 +00:00
|
|
|
{
|
2003-07-08 23:31:22 +00:00
|
|
|
return (partition->ID() == fID);
|
2003-02-08 23:32:51 +00:00
|
|
|
}
|
|
|
|
|
|