Add a function to convert QStringList of flag names to flags.

CCBUG: 400331
parent 8139d5c2
......@@ -269,6 +269,20 @@ QStringList PartitionTable::flagNames(Flags flags)
return rval;
}
/** @param list QStringList of the flags' names
@returns flags corresponding to names
*/
PartitionTable::Flags PartitionTable::flagsFromList(const QStringList list)
{
Flags flags;
for (const auto &flag : flagList())
if (list.contains(flagName(flag)))
flags.setFlag(flag);
return flags;
}
bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent, qint64& start, qint64& end)
{
if (d.type() == Device::Type::Disk_Device) {
......
......@@ -184,6 +184,7 @@ public:
static const QList<Flag> flagList();
static QString flagName(Flag f);
static QStringList flagNames(Flags f);
static PartitionTable::Flags flagsFromList(const QStringList list);
static bool getUnallocatedRange(const Device& device, PartitionNode& parent, qint64& start, qint64& end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment