New field referens in class VDataTool.
--HG-- branch : feature
This commit is contained in:
parent
66cecc3f3d
commit
b46d1968ba
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
VDataTool &VDataTool::operator =(const VDataTool &tool){
|
VDataTool &VDataTool::operator =(const VDataTool &tool){
|
||||||
data = tool.getData();
|
data = tool.getData();
|
||||||
|
_referens = tool.referens();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,21 @@
|
||||||
|
|
||||||
#include "container/vcontainer.h"
|
#include "container/vcontainer.h"
|
||||||
|
|
||||||
|
//We need QObject class because we use qobject_cast.
|
||||||
class VDataTool : public QObject{
|
class VDataTool : public QObject{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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(){}
|
virtual ~VDataTool(){}
|
||||||
VDataTool& operator= (const VDataTool &tool);
|
VDataTool& operator= (const VDataTool &tool);
|
||||||
VContainer getData() const { return data; }
|
VContainer getData() const { return data; }
|
||||||
void setData(const VContainer *value);
|
void setData(const VContainer *value);
|
||||||
|
qint64 referens() const {return _referens;}
|
||||||
|
void incrementReferens(){++_referens;}
|
||||||
|
void decrementReferens(){--_referens;}
|
||||||
protected:
|
protected:
|
||||||
VContainer data;
|
VContainer data;
|
||||||
|
qint64 _referens;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VDATATOOL_H
|
#endif // VDATATOOL_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user