mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 04:44:36 +03:00
Add TriStateBool constructor taking a boolean
And move the constructor taking an int to private.
This commit is contained in:
parent
eebb2186c7
commit
ed62854af7
1 changed files with 7 additions and 2 deletions
|
@ -38,9 +38,9 @@ public:
|
|||
|
||||
constexpr TriStateBool() = default;
|
||||
constexpr TriStateBool(const TriStateBool &other) = default;
|
||||
explicit constexpr TriStateBool(int value)
|
||||
: m_value(value < 0 ? -1 : (value > 0 ? 1 : 0))
|
||||
explicit constexpr TriStateBool(const bool boolean)
|
||||
{
|
||||
*this = boolean ? True : False;
|
||||
}
|
||||
|
||||
explicit constexpr operator int() const
|
||||
|
@ -56,6 +56,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
explicit constexpr TriStateBool(const int value)
|
||||
: m_value((value < 0) ? -1 : ((value > 0) ? 1 : 0))
|
||||
{
|
||||
}
|
||||
|
||||
signed char m_value = -1; // Undefined by default
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue