cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Protected Member Functions | List of all members
cc_tools_qt::property::field::EnumValue Class Reference

#include "cc_tools_qt/property/field.h"

Detailed Description

Class to contain all the properties relevant to comms::field::EnumValue fields.

Inheritance diagram for cc_tools_qt::property::field::EnumValue:
cc_tools_qt::property::field::CommonBase< EnumValue > cc_tools_qt::property::field::Common

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.
 
EnumValueadd (const QString &elemName)
 Add value description.
 
EnumValueadd (const QString &elemName, long long value)
 Add value description.
 
QVariantMap asMap () const
 Retrieve all properties as map.
 
EnumValuehidden (bool value=true)
 Set whether the field is hidden.
 
EnumValuehiddenWhenReadOnly (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.
 
EnumValuename (const char *value)
 Set name value.
 
EnumValuename (const QString &value)
 Set name value.
 
EnumValueoperator= (const EnumValue &)
 Copy assignement.
 
EnumValueoperator= (EnumValue &&)
 Move assignment.
 
EnumValuereadOnly (bool value=true)
 Set whether the field cannot be modified.
 
EnumValueserialisedHidden (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 ElemsListvalues () 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
 

Member Function Documentation

◆ add() [1/2]

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.

Parameters
[in]elemNameName of the value.

◆ add() [2/2]

EnumValue & cc_tools_qt::property::field::EnumValue::add ( const QString &  elemName,
long long  value 
)

Add value description.

Parameters
[in]elemNameName of the value.
[in]valueNumeric value

◆ getElemFrom()

template<typename TValueType >
static TValueType cc_tools_qt::property::field::Common::getElemFrom ( const QVariantMap &  props,
const QString &  name,
const TValueType &  defaultVal = TValueType() 
)
staticprotectedinherited

read element value from the map

Parameters
[in]propsProperties map
[in]nameProperty name
[in]defaultValValue to return if not found in map
Returns
Value of found property in the map

◆ hidden()

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::hidden ( bool  value = true)
inherited

Set whether the field is hidden.

Returns
reference to derived class

◆ hiddenWhenReadOnly()

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::hiddenWhenReadOnly ( bool  value = true)
inherited

Set whether the field must be hidden when cannot be modified.

Returns
reference to derived class

◆ name() [1/2]

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::name ( const char *  value)
inherited

Set name value.

Returns
reference to derived class

◆ name() [2/2]

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::name ( const QString &  value)
inherited

Set name value.

Returns
reference to derived class

◆ readOnly()

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::readOnly ( bool  value = true)
inherited

Set whether the field cannot be modified.

Returns
reference to derived class

◆ serialisedHidden()

EnumValue & cc_tools_qt::property::field::CommonBase< EnumValue >::serialisedHidden ( bool  value = true)
inherited

Set whether the serialised part is hidden.

Returns
reference to derived class

◆ setElemTo()

template<typename U >
static void cc_tools_qt::property::field::Common::setElemTo ( U &&  val,
const QString &  name,
QVariantMap &  props 
)
staticprotectedinherited

set element value to the map

Parameters
[in]valValue to set
[in]nameName of the property
[in,out]propsMap to update

The documentation for this class was generated from the following file: