mirror of
https://github.com/status-im/qzxing.git
synced 2025-02-21 07:08:28 +00:00
commit
98318bc6a2
@ -209,6 +209,7 @@ SOURCES += $$PWD/CameraImageWrapper.cpp \
|
|||||||
$$PWD/zxing/zxing/WriterException.cpp \
|
$$PWD/zxing/zxing/WriterException.cpp \
|
||||||
$$PWD/zxing/zxing/aztec/AztecReader.cpp \
|
$$PWD/zxing/zxing/aztec/AztecReader.cpp \
|
||||||
$$PWD/zxing/zxing/aztec/AztecDetectorResult.cpp \
|
$$PWD/zxing/zxing/aztec/AztecDetectorResult.cpp \
|
||||||
|
$$PWD/zxing/zxing/common/Counted.cpp \
|
||||||
$$PWD/zxing/zxing/common/StringUtils.cpp \
|
$$PWD/zxing/zxing/common/StringUtils.cpp \
|
||||||
$$PWD/zxing/zxing/common/Str.cpp \
|
$$PWD/zxing/zxing/common/Str.cpp \
|
||||||
$$PWD/zxing/zxing/common/PerspectiveTransform.cpp \
|
$$PWD/zxing/zxing/common/PerspectiveTransform.cpp \
|
||||||
|
36
src/zxing/zxing/common/Counted.cpp
Normal file
36
src/zxing/zxing/common/Counted.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "Counted.h"
|
||||||
|
|
||||||
|
namespace zxing {
|
||||||
|
|
||||||
|
Counted::Counted() :
|
||||||
|
count_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Counted::~Counted()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Counted *Counted::retain()
|
||||||
|
{
|
||||||
|
count_++;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Counted::release()
|
||||||
|
{
|
||||||
|
count_--;
|
||||||
|
if (count_ == 0) {
|
||||||
|
count_ = 0xDEADF001;
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Counted::count() const
|
||||||
|
{
|
||||||
|
return count_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -27,28 +27,16 @@ class Counted {
|
|||||||
private:
|
private:
|
||||||
unsigned int count_;
|
unsigned int count_;
|
||||||
public:
|
public:
|
||||||
Counted() :
|
Counted();
|
||||||
count_(0) {
|
|
||||||
}
|
|
||||||
virtual ~Counted() {
|
|
||||||
}
|
|
||||||
Counted *retain() {
|
|
||||||
count_++;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
void release() {
|
|
||||||
count_--;
|
|
||||||
if (count_ == 0) {
|
|
||||||
count_ = 0xDEADF001;
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
virtual ~Counted();
|
||||||
|
|
||||||
|
Counted *retain();
|
||||||
|
|
||||||
|
void release();
|
||||||
|
|
||||||
/* return the current count for denugging purposes or similar */
|
/* return the current count for denugging purposes or similar */
|
||||||
int count() const {
|
int count() const;
|
||||||
return count_;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* counting reference to reference-counted objects */
|
/* counting reference to reference-counted objects */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user