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

const 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]

virtual const TModelObject* TAbstractModel::modelData ( ) const
inlineprotectedvirtual

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

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

Sets the properties.

◆ toCborMap()

QCborMap TAbstractModel::toCborMap ( ) const
virtual

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

◆ toJsonObject()

QJsonObject TAbstractModel::toJsonObject ( ) const
virtual

Converts the model to a QJsonObject.

◆ toVariantMap()

QVariantMap TAbstractModel::toVariantMap ( ) 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: