New field referens in class VDataTool.

--HG--
branch : feature
This commit is contained in:
dismine 2013-09-29 15:21:17 +03:00
parent 66cecc3f3d
commit b46d1968ba
2 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@
VDataTool &VDataTool::operator =(const VDataTool &tool){
data = tool.getData();
_referens = tool.referens();
return *this;
}

View File

@ -24,16 +24,21 @@
#include "container/vcontainer.h"
//We need QObject class because we use qobject_cast.
class VDataTool : public QObject{
Q_OBJECT
public:
explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data){}
explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(0){}
virtual ~VDataTool(){}
VDataTool& operator= (const VDataTool &tool);
VContainer getData() const { return data; }
void setData(const VContainer *value);
qint64 referens() const {return _referens;}
void incrementReferens(){++_referens;}
void decrementReferens(){--_referens;}
protected:
VContainer data;
qint64 _referens;
};
#endif // VDATATOOL_H