cc_tools_qt
Common Environment for Protocol Analysis.
|
#include "cc_tools_qt/property/field.h"
Class to contain all the properties relevant to comms::field::EnumValue fields.
Public Types | |
using | ElemsList = QList< ElemType > |
List of properties describing enum value. | |
using | ElemType = QPair< QString, long long > |
The enum value is described as string containing name and the actual numeric value. | |
Public Member Functions | |
EnumValue () | |
Default constructor. | |
EnumValue (const EnumValue &) | |
Copy constructor. | |
EnumValue (const QVariant &props) | |
Construct from QVariant containing QVariantMap. | |
EnumValue (const QVariantMap &props) | |
Construct from QVariantMap. | |
EnumValue (EnumValue &&) | |
Move constructor. | |
~EnumValue () noexcept | |
Destructor. | |
EnumValue & | add (const QString &elemName) |
Add value description. | |
EnumValue & | add (const QString &elemName, long long value) |
Add value description. | |
QVariantMap | asMap () const |
Retrieve all properties as map. | |
EnumValue & | hidden (bool value=true) |
Set whether the field is hidden. | |
EnumValue & | hiddenWhenReadOnly (bool value=true) |
Set whether the field must be hidden when cannot be modified. | |
bool | isHidden () const |
Check the field is hidden. | |
bool | isHiddenWhenReadOnly () const |
Check the field is hidden when readOnly. | |
bool | isReadOnly () const |
Check whether the field cannot be modified. | |
bool | isSerialisedHidden () const |
Check the serialisation part is hidden. | |
const QString & | name () const |
Get name of the field. | |
EnumValue & | name (const char *value) |
Set name value. | |
EnumValue & | name (const QString &value) |
Set name value. | |
EnumValue & | operator= (const EnumValue &) |
Copy assignement. | |
EnumValue & | operator= (EnumValue &&) |
Move assignment. | |
EnumValue & | readOnly (bool value=true) |
Set whether the field cannot be modified. | |
EnumValue & | serialisedHidden (bool value=true) |
Set whether the serialised part is hidden. | |
void | setName (const char *value) |
Update the name value. | |
void | setName (const QString &value) |
Update the name value. | |
void | setTo (QVariantMap &props) const |
Copy all the properties value into provided properties map. | |
const ElemsList & | values () const |
Get access to all the values information. | |
Static Protected Member Functions | |
template<typename TValueType > | |
static TValueType | getElemFrom (const QVariantMap &props, const QString &name, const TValueType &defaultVal=TValueType()) |
read element value from the map | |
template<typename U > | |
static void | setElemTo (U &&val, const QString &name, QVariantMap &props) |
set element value to the map | |
EnumValue & cc_tools_qt::property::field::EnumValue::add | ( | const QString & | elemName | ) |
Add value description.
The assigned numeric value is the last inserted one incremented by 1. This function is convenient to use when describing enum with sequential values.
[in] | elemName | Name of the value. |
EnumValue & cc_tools_qt::property::field::EnumValue::add | ( | const QString & | elemName, |
long long | value | ||
) |
Add value description.
[in] | elemName | Name of the value. |
[in] | value | Numeric value |
|
staticprotectedinherited |
read element value from the map
[in] | props | Properties map |
[in] | name | Property name |
[in] | defaultVal | Value to return if not found in map |
|
inherited |
Set whether the field is hidden.
|
inherited |
Set whether the field must be hidden when cannot be modified.
|
inherited |
Set name value.
|
inherited |
Set name value.
|
inherited |
Set whether the field cannot be modified.
|
inherited |
Set whether the serialised part is hidden.
|
staticprotectedinherited |
set element value to the map
[in] | val | Value to set |
[in] | name | Name of the property |
[in,out] | props | Map to update |