TreeFrogFramework  1.18
tabstractmodel.h
Go to the documentation of this file.
1 #ifndef TABSTRACTMODEL_H
2 #define TABSTRACTMODEL_H
3 
4 #include <QVariant>
5 #include <TGlobal>
6 
7 class TSqlObject;
8 class TModelObject;
9 
10 
12 {
13 public:
14  virtual ~TAbstractModel() { }
15  virtual bool create();
16  virtual bool save();
17  virtual bool update();
18  virtual bool remove();
19  virtual bool isNull() const;
20  virtual bool isNew() const;
21  virtual bool isSaved() const;
22  virtual void setProperties(const QVariantMap &properties);
23  virtual QVariantMap toVariantMap() const;
24 
25  QString variableNameToFieldName(const QString &name) const;
26  static QString fieldNameToVariableName(const QString &name);
27 
28 protected:
29  virtual TModelObject *modelData() { return nullptr; }
30  virtual const TModelObject *modelData() const { return nullptr; }
31 };
32 
33 #endif // TABSTRACTMODEL_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
virtual TModelObject * modelData()
This function is reimplemented in subclasses to return a pointer to the data stored in the model obje...
Definition: tabstractmodel.h:29
The TAbstractModel class is the abstract base class of models, providing functionality common to mode...
Definition: tabstractmodel.h:11
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:30
virtual ~TAbstractModel()
Definition: tabstractmodel.h:14
The TModelObject class provides an abstract base for model objects.
Definition: tmodelobject.h:11
The TSqlObject class is the base class of ORM objects.
Definition: tsqlobject.h:14