Modified the visitor implementation a bit. The Visit() with the BPartition* argument now also gets the level of the partition in the hierarchy.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3900 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2003-07-08 18:26:15 +00:00
parent c54d68a84e
commit 671a745561
10 changed files with 134 additions and 90 deletions
+4 -4
View File
@@ -25,8 +25,6 @@ public:
virtual status_t GetPath(BPath *path) const;
virtual BPartition *VisitEachDescendent(BDiskDeviceVisitor *visitor);
bool IsModified() const;
status_t PrepareModifications();
status_t CommitModifications(bool synchronously = true,
@@ -38,8 +36,10 @@ private:
friend class BDiskDeviceList;
friend class BDiskDeviceRoster;
status_t SetTo(partition_id id, size_t neededSize = 0);
status_t SetTo(user_disk_device_data *data);
status_t _SetTo(partition_id id, size_t neededSize = 0);
status_t _SetTo(user_disk_device_data *data);
virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
user_disk_device_data *fDeviceData;
};
+3 -3
View File
@@ -16,7 +16,7 @@ namespace BPrivate {
// PartitionFilter
class PartitionFilter {
public:
virtual bool Filter(BPartition *partition) = 0;
virtual bool Filter(BPartition *partition, int32 level) = 0;
};
// PartitionFilterVisitor
@@ -26,7 +26,7 @@ public:
PartitionFilter *filter);
virtual bool Visit(BDiskDevice *device);
virtual bool Visit(BPartition *partition);
virtual bool Visit(BPartition *partition, int32 level);
private:
BDiskDeviceVisitor *fVisitor;
@@ -39,7 +39,7 @@ public:
IDFinderVisitor(partition_id id);
virtual bool Visit(BDiskDevice *device);
virtual bool Visit(BPartition *partition);
virtual bool Visit(BPartition *partition, int32 level);
private:
partition_id fID;
+3 -1
View File
@@ -6,6 +6,8 @@
#ifndef _DISK_DEVICE_VISITOR_H
#define _DISK_DEVICE_VISITOR_H
#include <SupportDefs.h>
class BDiskDevice;
class BPartition;
@@ -17,7 +19,7 @@ public:
// return true to abort iteration
virtual bool Visit(BDiskDevice *device);
virtual bool Visit(BPartition *partition);
virtual bool Visit(BPartition *partition, int32 level);
};
#endif _DISK_DEVICE_VISITOR_H
+9 -4
View File
@@ -64,7 +64,7 @@ public:
status_t GetPartitioningInfo(BPartitioningInfo *info) const;
BPartition *VisitEachChild(BDiskDeviceVisitor *visitor);
virtual BPartition *VisitEachDescendent(BDiskDeviceVisitor *visitor);
virtual BPartition *VisitEachDescendant(BDiskDeviceVisitor *visitor);
// Self Modification
@@ -113,9 +113,14 @@ private:
BPartition(const Partition &);
virtual ~BPartition();
status_t SetTo(BDiskDevice *device, BPartition *parent,
user_partition_data *data);
void Unset();
status_t _SetTo(BDiskDevice *device, BPartition *parent,
user_partition_data *data);
void _Unset();
int32 _Level() const;
virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
BPartition *_VisitEachDescendant(BDiskDeviceVisitor *visitor,
int32 level = -1);
friend class BDiskDevice;