File indexing completed on 2024-04-28 05:45:46
0001 /* 0002 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2016 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk> 0005 0006 SPDX-License-Identifier: GPL-3.0-or-later 0007 */ 0008 0009 #ifndef KPMCORE_PARTITIONNODE_H 0010 #define KPMCORE_PARTITIONNODE_H 0011 0012 #include "util/libpartitionmanagerexport.h" 0013 0014 #include <QObject> 0015 #include <QList> 0016 #include <QtGlobal> 0017 0018 class Partition; 0019 class PartitionRole; 0020 0021 /** A node in the tree of partitions. 0022 0023 The root in this tree is the PartitionTable. The primaries are the child nodes; extended partitions again 0024 have child nodes. 0025 0026 @see Device, PartitionTable, Partition 0027 @author Volker Lanz <vl@fidra.de> 0028 */ 0029 class LIBKPMCORE_EXPORT PartitionNode : public QObject 0030 { 0031 public: 0032 typedef QList<Partition*> Partitions; 0033 0034 protected: 0035 PartitionNode() {} 0036 ~PartitionNode() override {} 0037 0038 public: 0039 virtual bool insert(Partition* partNew); 0040 0041 virtual Partition* predecessor(Partition& p); 0042 virtual const Partition* predecessor(const Partition& p) const; 0043 0044 virtual Partition* successor(Partition& p); 0045 virtual const Partition* successor(const Partition& p) const; 0046 0047 virtual bool remove(Partition* p); 0048 virtual Partition* findPartitionBySector(qint64 s, const PartitionRole& role); 0049 virtual const Partition* findPartitionBySector(qint64 s, const PartitionRole& role) const; 0050 virtual void reparent(Partition& p); 0051 0052 virtual Partitions& children() = 0; 0053 virtual PartitionNode* parent() = 0; 0054 virtual bool isRoot() const = 0; 0055 virtual const PartitionNode* parent() const = 0; 0056 virtual const Partitions& children() const = 0; 0057 virtual void append(Partition* p) = 0; 0058 virtual qint32 highestMountedChild() const; 0059 virtual bool isChildMounted() const; 0060 0061 protected: 0062 virtual void clearChildren(); 0063 }; 0064 0065 #endif