[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kpmcore/copy-device] src/core: Copy constructor for PartitionTable.
From: Teo Mrnjavac <teo () kde ! org>
Date: 2016-09-07 15:37:54
Message-ID: E1bhevC-0002IQ-KY () code ! kde ! org
[Download RAW message or body]
Git commit 882886c1d41c470ea1761d15420cf66102adcc99 by Teo Mrnjavac.
Committed on 07/09/2016 at 15:36.
Pushed by mrnjavac into branch 'copy-device'.
Copy constructor for PartitionTable.
M +25 -7 src/core/partitiontable.cpp
M +2 -1 src/core/partitiontable.h
http://commits.kde.org/kpmcore/882886c1d41c470ea1761d15420cf66102adcc99
diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp
index 680f5bb..df68773 100644
--- a/src/core/partitiontable.cpp
+++ b/src/core/partitiontable.cpp
@@ -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()
{
diff --git a/src/core/partitiontable.h b/src/core/partitiontable.h
index d76cbdc..929fd8e 100644
--- a/src/core/partitiontable.h
+++ b/src/core/partitiontable.h
@@ -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:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic