headers/bsd: Add sys/queue.h.
[haiku.git] / src / kits / storage / disk_device / DiskDevicePrivate.cpp
blobb2e5db8f5477058aeda2da53364edad15ec19537
1 /*
2 * Copyright 2003-2006, Haiku Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold, bonefish@users.sf.net
7 */
10 #include <DiskDevicePrivate.h>
11 #include <DiskDevice.h>
12 #include <Partition.h>
15 PartitionFilter::~PartitionFilter()
20 // #pragma mark - PartitionFilterVisitor
22 // constructor
23 PartitionFilterVisitor::PartitionFilterVisitor(BDiskDeviceVisitor *visitor,
24 PartitionFilter *filter)
25 : BDiskDeviceVisitor(),
26 fVisitor(visitor),
27 fFilter(filter)
31 // Visit
32 bool
33 PartitionFilterVisitor::Visit(BDiskDevice *device)
35 if (fFilter->Filter(device, 0))
36 return fVisitor->Visit(device);
37 return false;
40 // Visit
41 bool
42 PartitionFilterVisitor::Visit(BPartition *partition, int32 level)
44 if (fFilter->Filter(partition, level))
45 return fVisitor->Visit(partition, level);
46 return false;
50 // #pragma mark -
52 // IDFinderVisitor
54 // constructor
55 IDFinderVisitor::IDFinderVisitor(int32 id)
56 : BDiskDeviceVisitor(),
57 fID(id)
61 // Visit
62 bool
63 IDFinderVisitor::Visit(BDiskDevice *device)
65 return (device->ID() == fID);
68 // Visit
69 bool
70 IDFinderVisitor::Visit(BPartition *partition, int32 level)
72 return (partition->ID() == fID);