TreeFrogFramework  2.8
tabstractmodel.h
Go to the documentation of this file.
1 #pragma once
2 #include <QVariant>
3 #include <QtCore>
4 #include <TGlobal>
5 
6 class TModelObject;
7 
8 
10 public:
11  virtual ~TAbstractModel() { }
12  virtual bool create();
13  virtual bool save();
14  virtual bool update();
15  virtual bool remove();
16  virtual bool isNull() const;
17  virtual bool isNew() const;
18  virtual bool isSaved() const;
19  virtual void setProperties(const QVariantMap &properties);
20  virtual QVariantMap toVariantMap(const QStringList &properties = QStringList()) const;
21  virtual void setProperties(const QJsonDocument &properties);
22  virtual QJsonObject toJsonObject(const QStringList &properties = QStringList()) const;
23 #if QT_VERSION >= 0x050c00 // 5.12.0
24  virtual QCborMap toCborMap(const QStringList &properties = QStringList()) const;
25 #endif
26 
27  QString variableNameToFieldName(const QString &name) const;
28  static QString fieldNameToVariableName(const QString &name);
29 
30 protected:
31  virtual TModelObject *modelData() { return nullptr; }
32  virtual const TModelObject *modelData() const { return nullptr; }
33 };
34 
The TAbstractModel class is the abstract base class of models, providing functionality common to mode...
Definition: tabstractmodel.h:9
virtual const TModelObject * modelData() const
This function is reimplemented in subclasses to return a pointer to the data stored in the model obje...
Definition: tabstractmodel.h:32
virtual ~TAbstractModel()
Definition: tabstractmodel.h:11
virtual TModelObject * modelData()
This function is reimplemented in subclasses to return a pointer to the data stored in the model obje...
Definition: tabstractmodel.h:31
The TModelObject class provides an abstract base for model objects.
Definition: tmodelobject.h:9
#define T_CORE_EXPORT
Definition: tdeclexport.h:28