Copy constructor for PartitionTable.

This commit is contained in:
Teo Mrnjavac 2016-09-07 17:36:53 +02:00
parent 25b8cc0a42
commit 882886c1d4
2 changed files with 27 additions and 8 deletions

View File

@ -39,16 +39,34 @@
/** Creates a new PartitionTable object with type MSDOS
@param type name of the PartitionTable type (e.g. "msdos" or "gpt")
*/
PartitionTable::PartitionTable(TableType type, qint64 firstUsable, qint64 lastUsable) :
PartitionNode(),
m_Children(),
m_MaxPrimaries(maxPrimariesForTableType(type)),
m_Type(type),
m_FirstUsable(firstUsable),
m_LastUsable(lastUsable)
PartitionTable::PartitionTable(TableType type, qint64 firstUsable, qint64 lastUsable)
: PartitionNode()
, m_Children()
, m_MaxPrimaries(maxPrimariesForTableType(type))
, m_Type(type)
, m_FirstUsable(firstUsable)
, m_LastUsable(lastUsable)
{
}
/** Copy constructor for PartitionTable.
* @param other the other PartitionTable.
*/
PartitionTable::PartitionTable(const PartitionTable& other)
: PartitionNode()
, m_Children()
, m_MaxPrimaries(other.m_MaxPrimaries)
, m_Type(other.m_Type)
, m_FirstUsable(other.m_FirstUsable)
, m_LastUsable(other.m_LastUsable)
{
for (Partitions::const_iterator it = other.m_Children.constBegin();
it != other.m_Children.constEnd(); ++it)
{
m_Children.append(new Partition(**it));
}
}
/** Destroys a PartitionTable object, destroying all children */
PartitionTable::~PartitionTable()
{

View File

@ -44,7 +44,7 @@ class QTextStream;
*/
class LIBKPMCORE_EXPORT PartitionTable : public PartitionNode
{
Q_DISABLE_COPY(PartitionTable)
PartitionTable &operator=(const PartitionTable &) = delete;
friend class CoreBackend;
friend LIBKPMCORE_EXPORT QTextStream& operator<<(QTextStream& stream, const PartitionTable& ptable);
@ -96,6 +96,7 @@ public:
public:
PartitionTable(TableType type, qint64 firstUsable, qint64 lastUsable);
PartitionTable(const PartitionTable& other);
~PartitionTable();
public: