cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | List of all members
cc_tools_qt::property::field::CommonBase< TDerived > Class Template Reference

#include "cc_tools_qt/property/field.h"

Detailed Description

template<typename TDerived>
class cc_tools_qt::property::field::CommonBase< TDerived >

Intermediate helper class to define properties describing one.

Template Parameters
TDerivedActual derived class
Inheritance diagram for cc_tools_qt::property::field::CommonBase< TDerived >:
cc_tools_qt::property::field::Common

Public Member Functions

 CommonBase ()=default
 Default constructor.
 
 CommonBase (CommonBase &&)=default
 Move constructor.
 
 CommonBase (const CommonBase &)=default
 Copy constructor.
 
 CommonBase (const QVariant &props)
 Construct from QVariant that contains QVariantMap.
 
 CommonBase (const QVariantMap &props)
 Construct from QVariantMap.
 
 ~CommonBase () noexcept=default
 Destructor.
 
void getFrom (const QVariantMap &props)
 Read the properties values from the provided map.
 
TDerived & hidden (bool value=true)
 Set whether the field is hidden.
 
TDerived & 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.
 
TDerived & name (const char *value)
 Set name value.
 
TDerived & name (const QString &value)
 Set name value.
 
CommonBaseoperator= (CommonBase &&)=default
 Move assignment.
 
CommonBaseoperator= (const CommonBase &)=default
 Copy assignment.
 
TDerived & readOnly (bool value=true)
 Set whether the field cannot be modified.
 
TDerived & 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.
 

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

◆ 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()

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::hidden ( bool  value = true)

Set whether the field is hidden.

Returns
reference to derived class

◆ hiddenWhenReadOnly()

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::hiddenWhenReadOnly ( bool  value = true)

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

Returns
reference to derived class

◆ name() [1/2]

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::name ( const char *  value)

Set name value.

Returns
reference to derived class

◆ name() [2/2]

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::name ( const QString &  value)

Set name value.

Returns
reference to derived class

◆ readOnly()

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::readOnly ( bool  value = true)

Set whether the field cannot be modified.

Returns
reference to derived class

◆ serialisedHidden()

template<typename TDerived >
TDerived & cc_tools_qt::property::field::CommonBase< TDerived >::serialisedHidden ( bool  value = true)

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: