2017-01-31 16:08:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QMetaType>
|
|
|
|
|
|
|
|
class QTextStream;
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
//==================================================================================================
|
|
|
|
//==================================================================================================
|
2020-06-19 07:53:59 +02:00
|
|
|
class Tristate
|
2017-01-31 16:08:04 +01:00
|
|
|
{
|
|
|
|
public:
|
2020-06-19 07:53:59 +02:00
|
|
|
enum class State
|
|
|
|
{
|
|
|
|
False,
|
|
|
|
PartiallyTrue,
|
|
|
|
True
|
|
|
|
};
|
2017-01-31 16:08:04 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Tristate();
|
|
|
|
|
2020-06-19 07:53:59 +02:00
|
|
|
void operator=( const State& state );
|
|
|
|
|
|
|
|
bool operator==( const Tristate& other ) const;
|
|
|
|
bool operator==( State state ) const;
|
|
|
|
bool operator!=( const Tristate& other ) const;
|
2017-01-31 16:08:04 +01:00
|
|
|
|
2020-06-19 07:53:59 +02:00
|
|
|
State state() const;
|
|
|
|
|
|
|
|
bool isTrue() const;
|
|
|
|
bool isPartiallyTrue() const;
|
|
|
|
bool isFalse() const;
|
2017-01-31 16:08:04 +01:00
|
|
|
|
|
|
|
QString text() const;
|
2020-06-19 07:53:59 +02:00
|
|
|
void setFromText( const QString& valueText );
|
2017-01-31 16:08:04 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
State m_state;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace caf
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// Overload of QTextStream for caf::Triplet
|
|
|
|
//==================================================================================================
|
2020-06-19 07:53:59 +02:00
|
|
|
QTextStream& operator>>( QTextStream& str, caf::Tristate& triplet );
|
|
|
|
QTextStream& operator<<( QTextStream& str, const caf::Tristate& triplet );
|
2017-01-31 16:08:04 +01:00
|
|
|
|
2020-06-19 07:53:59 +02:00
|
|
|
Q_DECLARE_METATYPE( caf::Tristate );
|