TreeFrogFramework  1.29
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TAbstractModel Class Reference

#include <tabstractmodel.h>

Public Member Functions

virtual ~TAbstractModel ()
virtual bool create ()
virtual bool save ()
virtual bool update ()
virtual bool remove ()
virtual bool isNull () const
virtual bool isNew () const
virtual bool isSaved () const
virtual void setProperties (const QVariantMap &properties)
virtual QVariantMap toVariantMap () const
virtual QJsonObject toJsonObject () const
virtual QCborMap toCborMap () const
QString variableNameToFieldName (const QString &name) const

Static Public Member Functions

static QString fieldNameToVariableName (const QString &name)

Protected Member Functions

virtual TModelObjectmodelData ()
virtual const TModelObjectmodelData () const

Detailed Description

The TAbstractModel class is the abstract base class of models, providing functionality common to models.

Constructor & Destructor Documentation

◆ ~TAbstractModel()

virtual TAbstractModel::~TAbstractModel ( )

Member Function Documentation

◆ create()

bool TAbstractModel::create ( )

Creates the model as a new data to the data storage.

◆ fieldNameToVariableName()

QString TAbstractModel::fieldNameToVariableName ( const QString &  name)

◆ isNew()

bool TAbstractModel::isNew ( ) const

Returns true if this model is new, not created; otherwise returns false.

◆ isNull()

bool TAbstractModel::isNull ( ) const

Returns true if this model is null; otherwise returns false.

◆ isSaved()

bool TAbstractModel::isSaved ( ) const

Returns true if this model is not saved; otherwise returns false.

◆ modelData() [1/2]

const TModelObject * TAbstractModel::modelData ( )

This function is reimplemented in subclasses to return a pointer to the data stored in the model object.

◆ modelData() [2/2]

virtual const TModelObject* TAbstractModel::modelData ( ) const

◆ remove()

bool TAbstractModel::remove ( )

Removes the model from the data storage.

◆ save()

bool TAbstractModel::save ( )

Saves the model to the data storage.

If the model exists in the data storage, calls update(); otherwise calls create().

◆ setProperties()

void TAbstractModel::setProperties ( const QVariantMap &  properties)

Sets the properties.

◆ toCborMap()

QCborMap TAbstractModel::toCborMap ( ) const

Converts all the properies to CBOR using QCborValue::fromVariant() and returns the map composed of those elements.

◆ toJsonObject()

QJsonObject TAbstractModel::toJsonObject ( ) const

Converts the model to a QJsonObject.

◆ toVariantMap()

QVariantMap TAbstractModel::toVariantMap ( ) const

Returns a map with all properties of this text format.

◆ update()

bool TAbstractModel::update ( )

Updates the model to the data storage.

◆ variableNameToFieldName()

QString TAbstractModel::variableNameToFieldName ( const QString &  name) const

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