mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[users] Introduce class-scoped aliases for true and false for the bools
This is somewhat experimental and weird; the idea is that bool arguments are a lot easier to understand if there are proper names attached, rather than "true" and "false".
This commit is contained in:
parent
ceeab7087c
commit
b20c80a28c
1 changed files with 7 additions and 1 deletions
|
@ -40,11 +40,17 @@ const NamedEnumTable< HostNameAction >& hostNameActionNames();
|
|||
class GroupDescription
|
||||
{
|
||||
public:
|
||||
// TODO: still too-weakly typed, add a macro to define strongly-typed bools
|
||||
class MustExist : public std::true_type {};
|
||||
class CreateIfNeeded : public std::false_type {};
|
||||
class SystemGroup : public std::true_type {};
|
||||
class UserGroup : public std::false_type {};
|
||||
|
||||
///@brief An invalid, empty group
|
||||
GroupDescription() {}
|
||||
|
||||
///@brief A group with full details
|
||||
GroupDescription( const QString& name, bool mustExistAlready = false, bool isSystem = false )
|
||||
GroupDescription( const QString& name, bool mustExistAlready = CreateIfNeeded{}, bool isSystem = UserGroup{} )
|
||||
: m_name( name )
|
||||
, m_isValid( !name.isEmpty() )
|
||||
, m_mustAlreadyExist( mustExistAlready )
|
||||
|
|
Loading…
Add table
Reference in a new issue