FactDev  0.1
imodel.h
1 #ifndef IMODEL_H
2 #define IMODEL_H
3 #include <QVariantHash>
4 
8 namespace Models {
13 class IModel
14 {
15 public:
19  virtual ~IModel() {}
20 
24  virtual void commit() = 0;
30  virtual void hydrat(int id) = 0;
34  virtual void remove() = 0;
35 
40  virtual QVariantHash getDataMap() = 0;
46  int getId() const { return _id; }
51  void setId(int id) { _id = id; }
52 
57  bool isToRemoved() const
58  {
59  return _toRemoved;
60  }
61 
66  void setToRemoved(bool toRemoved)
67  {
68  _toRemoved = toRemoved;
69  }
70 
71 protected:
72  int _id;
73  bool _toRemoved;
74 };
75 }
76 #endif // IModel_H
int _id
Element identify.
Definition: imodel.h:72
void setId(int id)
IModel::setId Replace the current identify by id
Definition: imodel.h:51
virtual void commit()=0
IModel::commit Update or insert data into the database.
The IModel class.
Definition: imodel.h:13
bool _toRemoved
Flag to know if the object must be removed.
Definition: imodel.h:73
virtual QVariantHash getDataMap()=0
getDataMap Get all data of model with a HashMap key/value
virtual void hydrat(int id)=0
IModel::hydrat Get data of the element which is specified by the identify id from the database...
void setToRemoved(bool toRemoved)
setToRemoved Change the flag for removed object
Definition: imodel.h:66
bool isToRemoved() const
toRemoved return if object must be removed.
Definition: imodel.h:57
virtual ~IModel()
~IModel Remove an instance of IModel
Definition: imodel.h:19
int getId() const
IModel::getId Return the identify of the element of the database.
Definition: imodel.h:46