[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
@ -40,11 +40,17 @@ const NamedEnumTable< HostNameAction >& hostNameActionNames();
|
|||||||
class GroupDescription
|
class GroupDescription
|
||||||
{
|
{
|
||||||
public:
|
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
|
///@brief An invalid, empty group
|
||||||
GroupDescription() {}
|
GroupDescription() {}
|
||||||
|
|
||||||
///@brief A group with full details
|
///@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_name( name )
|
||||||
, m_isValid( !name.isEmpty() )
|
, m_isValid( !name.isEmpty() )
|
||||||
, m_mustAlreadyExist( mustExistAlready )
|
, m_mustAlreadyExist( mustExistAlready )
|
||||||
|
Loading…
Reference in New Issue
Block a user