Crash protection. part I
This commit is contained in:
40
bcvalue.h
40
bcvalue.h
@@ -31,6 +31,7 @@
|
||||
#ifndef BCVALUE_H
|
||||
#define BCVALUE_H
|
||||
|
||||
#include "qnamespace.h"
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
@@ -68,6 +69,9 @@ public:
|
||||
Text,
|
||||
Number,
|
||||
Float,
|
||||
Byte,
|
||||
Word,
|
||||
Quad,
|
||||
Percent,
|
||||
KWh,
|
||||
Watt,
|
||||
@@ -83,9 +87,10 @@ public:
|
||||
};
|
||||
Q_ENUM(TypeID)
|
||||
|
||||
BCValueType();
|
||||
BCValueType( TypeID ID_, QString unitLabel_="", optDouble factor_=std::nullopt, optDouble min_=std::nullopt, optDouble max_= std::nullopt );
|
||||
|
||||
TypeID ID;
|
||||
TypeID ID{TypeID::Invalid};
|
||||
QString unitLabel;
|
||||
optDouble factor;
|
||||
optDouble min;
|
||||
@@ -93,26 +98,28 @@ public:
|
||||
|
||||
};
|
||||
|
||||
using BCValueTypeCRef = std::optional<std::reference_wrapper<const BCValueType>>;
|
||||
|
||||
|
||||
class BCValue
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
BCValue() = default;
|
||||
BCValue( BCDevice::ID deviceID, BC::ID targetID );
|
||||
BCValue();
|
||||
BCValue( const BCValueType& valueType_, BCDevice::ID deviceID_, BC::ID targetID_ );
|
||||
|
||||
void setLongValue( uint8_t value);
|
||||
uint8_t getLongValue();
|
||||
BCValueTypeCRef valueType;
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
int rowInModel{-1};
|
||||
QString label;
|
||||
QVariant value;
|
||||
QVariant defaultValue;
|
||||
bool inSync{false};
|
||||
bool readOnly{false};
|
||||
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
BCValueType::TypeID typeID{BCValueType::TypeID::Invalid};;
|
||||
int rowInModel{-1};
|
||||
QString label;
|
||||
QVariant value;
|
||||
QVariant defaultValue;
|
||||
bool inSync{false};
|
||||
bool readOnly{false};
|
||||
// void reset()
|
||||
|
||||
};
|
||||
// Damit QVariant dieses Struct transportieren kann:
|
||||
@@ -124,12 +131,7 @@ struct BCValueParams
|
||||
QString ID;
|
||||
QString Label;
|
||||
QString Default;
|
||||
QString Current;
|
||||
QString Enabled;
|
||||
QString UnitType;
|
||||
QString Min;
|
||||
QString Max;
|
||||
QString Factor;
|
||||
};
|
||||
|
||||
// abbreviations:
|
||||
|
||||
Reference in New Issue
Block a user