/* SPDX-FileCopyrightText: 2008-2010 Volker Lanz SPDX-FileCopyrightText: 2008 Laurent Montel SPDX-FileCopyrightText: 2015 Chris Campbell SPDX-FileCopyrightText: 2016 Teo Mrnjavac SPDX-FileCopyrightText: 2016-2017 Andrius Štikonas SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef KPMCORE_PARTITIONROLE_H #define KPMCORE_PARTITIONROLE_H #include "util/libpartitionmanagerexport.h" #include #include /** A Partition's role. Each Partition has a PartitionRole: It can be primary, extended, logical or represent unallocated space on the Device. @author Volker Lanz */ class LIBKPMCORE_EXPORT PartitionRole { public: /** A Partition's role: What kind of Partition is it? */ enum Role { None = 0, /**< None at all */ Primary = 1, /**< Primary */ Extended = 2, /**< Extended */ Logical = 4, /**< Logical inside an extended */ Unallocated = 8, /**< No real Partition, just unallocated space */ Luks = 16, /**< Encrypted partition with LUKS key management */ Lvm_Lv = 32, /**< Logical Volume of LVM */ Any = 255 /**< In case we're looking for a Partition with a PartitionRole, any will do */ }; Q_DECLARE_FLAGS(Roles, Role) public: explicit PartitionRole(Roles r) : m_Roles(r) {} /**< Creates a new PartitionRole object */ Roles roles() const { return m_Roles; /**< @return the roles as bitfield */ } bool has(Role r) const { return roles() & r; /**< @param r the role to check @return true if the role is set */ } bool operator==(const PartitionRole& other) const { return m_Roles == other.m_Roles; /**< @param other object to compare with @return true if the same */ } bool operator!=(const PartitionRole& other) const { return !operator==(other); /**< @param other object to compare with @return true if not the same */ } QString toString(const QStringList& languages = {}) const; private: Roles m_Roles; }; Q_DECLARE_OPERATORS_FOR_FLAGS(PartitionRole::Roles) #endif