TreeFrogFramework  2.8
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 QStringList &properties=QStringList()) const
 
virtual void setProperties (const QJsonDocument &properties)
 
virtual QJsonObject toJsonObject (const QStringList &properties=QStringList()) const
 
virtual QCborMap toCborMap (const QStringList &properties=QStringList()) 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 ( )
inlinevirtual

Member Function Documentation

◆ create()

bool TAbstractModel::create ( )
virtual

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

◆ fieldNameToVariableName()

QString TAbstractModel::fieldNameToVariableName ( const QString &  name)
static

◆ isNew()

bool TAbstractModel::isNew ( ) const
virtual

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

◆ isNull()

bool TAbstractModel::isNull ( ) const
virtual

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

◆ isSaved()

bool TAbstractModel::isSaved ( ) const
virtual

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

◆ modelData() [1/2]

TModelObject * TAbstractModel::modelData ( )
inlineprotectedvirtual

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

◆ modelData() [2/2]

const TModelObject * TAbstractModel::modelData ( ) const
inlineprotectedvirtual

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

◆ remove()

bool TAbstractModel::remove ( )
virtual

Removes the model from the data storage.

◆ save()

bool TAbstractModel::save ( )
virtual

Saves the model to the data storage.

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

◆ setProperties() [1/2]

void TAbstractModel::setProperties ( const QJsonDocument &  properties)
virtual

Sets the properties.

◆ setProperties() [2/2]

void TAbstractModel::setProperties ( const QVariantMap &  properties)
virtual

Sets the properties.

◆ toCborMap()

QCborMap TAbstractModel::toCborMap ( const QStringList &  properties = QStringList()) const
virtual

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

◆ toJsonObject()

QJsonObject TAbstractModel::toJsonObject ( const QStringList &  properties = QStringList()) const
virtual

Converts the model to a QJsonObject.

◆ toVariantMap()

QVariantMap TAbstractModel::toVariantMap ( const QStringList &  properties = QStringList()) const
virtual

Returns a map with all properties of this text format.

◆ update()

bool TAbstractModel::update ( )
virtual

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: