mirror of
https://github.com/status-im/qzxing.git
synced 2025-02-16 12:58:31 +00:00
commit
98318bc6a2
@ -209,6 +209,7 @@ SOURCES += $$PWD/CameraImageWrapper.cpp \
|
||||
$$PWD/zxing/zxing/WriterException.cpp \
|
||||
$$PWD/zxing/zxing/aztec/AztecReader.cpp \
|
||||
$$PWD/zxing/zxing/aztec/AztecDetectorResult.cpp \
|
||||
$$PWD/zxing/zxing/common/Counted.cpp \
|
||||
$$PWD/zxing/zxing/common/StringUtils.cpp \
|
||||
$$PWD/zxing/zxing/common/Str.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:
|
||||
unsigned int count_;
|
||||
public:
|
||||
Counted() :
|
||||
count_(0) {
|
||||
}
|
||||
virtual ~Counted() {
|
||||
}
|
||||
Counted *retain() {
|
||||
count_++;
|
||||
return this;
|
||||
}
|
||||
void release() {
|
||||
count_--;
|
||||
if (count_ == 0) {
|
||||
count_ = 0xDEADF001;
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
Counted();
|
||||
|
||||
virtual ~Counted();
|
||||
|
||||
Counted *retain();
|
||||
|
||||
void release();
|
||||
|
||||
/* return the current count for denugging purposes or similar */
|
||||
int count() const {
|
||||
return count_;
|
||||
}
|
||||
int count() const;
|
||||
};
|
||||
|
||||
/* counting reference to reference-counted objects */
|
||||
|
Loading…
x
Reference in New Issue
Block a user