1134f3f10SAxel Dörfler/*
2134f3f10SAxel Dörfler * Copyright 2003-2006, Haiku Inc.
3134f3f10SAxel Dörfler * Distributed under the terms of the MIT License.
4134f3f10SAxel Dörfler *
5134f3f10SAxel Dörfler * Authors:
6134f3f10SAxel Dörfler *		Ingo Weinhold, bonefish@users.sf.net
7134f3f10SAxel Dörfler */
8134f3f10SAxel Dörfler
9f0bc0312SIngo Weinhold
10f0bc0312SIngo Weinhold#include <DiskDevicePrivate.h>
11f0bc0312SIngo Weinhold#include <DiskDevice.h>
12f0bc0312SIngo Weinhold#include <Partition.h>
13f0bc0312SIngo Weinhold
14134f3f10SAxel Dörfler
15134f3f10SAxel DörflerPartitionFilter::~PartitionFilter()
16134f3f10SAxel Dörfler{
17134f3f10SAxel Dörfler}
18134f3f10SAxel Dörfler
19134f3f10SAxel Dörfler
20134f3f10SAxel Dörfler//	#pragma mark - PartitionFilterVisitor
21f0bc0312SIngo Weinhold
22f0bc0312SIngo Weinhold// constructor
23f0bc0312SIngo WeinholdPartitionFilterVisitor::PartitionFilterVisitor(BDiskDeviceVisitor *visitor,
24f0bc0312SIngo Weinhold											   PartitionFilter *filter)
25f0bc0312SIngo Weinhold	: BDiskDeviceVisitor(),
26f0bc0312SIngo Weinhold	  fVisitor(visitor),
27f0bc0312SIngo Weinhold	  fFilter(filter)
28f0bc0312SIngo Weinhold{
29f0bc0312SIngo Weinhold}
30f0bc0312SIngo Weinhold
31f0bc0312SIngo Weinhold// Visit
32f0bc0312SIngo Weinholdbool
33f0bc0312SIngo WeinholdPartitionFilterVisitor::Visit(BDiskDevice *device)
34f0bc0312SIngo Weinhold{
35ec2680f0SIngo Weinhold	if (fFilter->Filter(device, 0))
36ec2680f0SIngo Weinhold		return fVisitor->Visit(device);
37f0bc0312SIngo Weinhold	return false;
38f0bc0312SIngo Weinhold}
39f0bc0312SIngo Weinhold
40f0bc0312SIngo Weinhold// Visit
41f0bc0312SIngo Weinholdbool
42671a7455SIngo WeinholdPartitionFilterVisitor::Visit(BPartition *partition, int32 level)
43f0bc0312SIngo Weinhold{
44671a7455SIngo Weinhold	if (fFilter->Filter(partition, level))
45671a7455SIngo Weinhold		return fVisitor->Visit(partition, level);
46f0bc0312SIngo Weinhold	return false;
47f0bc0312SIngo Weinhold}
48f0bc0312SIngo Weinhold
49f0bc0312SIngo Weinhold
50419458bcSIngo Weinhold// #pragma mark -
51419458bcSIngo Weinhold
52f0bc0312SIngo Weinhold// IDFinderVisitor
53f0bc0312SIngo Weinhold
54f0bc0312SIngo Weinhold// constructor
55f0bc0312SIngo WeinholdIDFinderVisitor::IDFinderVisitor(int32 id)
56f0bc0312SIngo Weinhold	: BDiskDeviceVisitor(),
57f0bc0312SIngo Weinhold	  fID(id)
58f0bc0312SIngo Weinhold{
59f0bc0312SIngo Weinhold}
60f0bc0312SIngo Weinhold
61f0bc0312SIngo Weinhold// Visit
62f0bc0312SIngo Weinholdbool
63f0bc0312SIngo WeinholdIDFinderVisitor::Visit(BDiskDevice *device)
64f0bc0312SIngo Weinhold{
652942bfb5SIngo Weinhold	return (device->ID() == fID);
66f0bc0312SIngo Weinhold}
67f0bc0312SIngo Weinhold
68f0bc0312SIngo Weinhold// Visit
69f0bc0312SIngo Weinholdbool
70671a7455SIngo WeinholdIDFinderVisitor::Visit(BPartition *partition, int32 level)
71f0bc0312SIngo Weinhold{
722942bfb5SIngo Weinhold	return (partition->ID() == fID);
73f0bc0312SIngo Weinhold}
74f0bc0312SIngo Weinhold
75