batch refactoring by subclassing a number of classes from Counted to be used with Ref

This commit is contained in:
favoritas37 2015-06-19 01:17:54 +03:00
parent f59fa74ace
commit ef67ff79ef
5 changed files with 15 additions and 8 deletions

View File

@ -21,11 +21,12 @@
*/ */
#include <zxing/ReaderException.h> #include <zxing/ReaderException.h>
#include <zxing/common/Counted.h>
namespace zxing { namespace zxing {
namespace qrcode { namespace qrcode {
class ErrorCorrectionLevel { class ErrorCorrectionLevel : public Counted {
private: private:
int ordinal_; int ordinal_;
int bits_; int bits_;

View File

@ -23,11 +23,13 @@
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
#include <zxing/qrcode/Version.h> #include <zxing/qrcode/Version.h>
#include <zxing/common/Counted.h>
namespace zxing { namespace zxing {
namespace qrcode { namespace qrcode {
class Mode { class Mode : public Counted
{
private: private:
int characterCountBitsForVersions0To9_; int characterCountBitsForVersions0To9_;
int characterCountBitsForVersions10To26_; int characterCountBitsForVersions10To26_;
@ -53,9 +55,11 @@ public:
static Mode& forBits(int bits); static Mode& forBits(int bits);
int getCharacterCountBits(Version *version); int getCharacterCountBits(Version *version);
int getBits() { return bits_; } int getBits() const { return bits_; }
bool operator==(const Mode& other); bool operator==(const Mode& other);
std::string getName() const { return name_; }
}; };
} }
} }

View File

@ -3,11 +3,12 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <zxing/common/Counted.h>
namespace zxing { namespace zxing {
namespace qrcode { namespace qrcode {
class ByteMatrix class ByteMatrix : public Counted
{ {
private: private:
std::vector< std::vector<char> > bytes_; std::vector< std::vector<char> > bytes_;

View File

@ -42,7 +42,7 @@ Ref<Version> QRCode::getVersion() const
return version_ptr_; return version_ptr_;
} }
const int QRCode::getMaskPattern() const int QRCode::getMaskPattern() const
{ {
return maskPattern_; return maskPattern_;
} }

View File

@ -5,15 +5,15 @@
#include <zxing/qrcode/Version.h> #include <zxing/qrcode/Version.h>
#include <zxing/qrcode/ErrorCorrectionLevel.h> #include <zxing/qrcode/ErrorCorrectionLevel.h>
#include "ByteMatrix.h" #include "ByteMatrix.h"
#include <zxing/common/Counted.h>
#include <string> #include <string>
namespace zxing { namespace zxing {
namespace qrcode { namespace qrcode {
class QRCode class QRCode : public Counted
{ {
private: private:
static const int NUM_MASK_PATTERNS = 8;
Ref<Mode> mode_ptr_; Ref<Mode> mode_ptr_;
Ref<ErrorCorrectionLevel> ecLevel_ptr_; Ref<ErrorCorrectionLevel> ecLevel_ptr_;
@ -22,13 +22,14 @@ private:
Ref<ByteMatrix> matrix_ptr_; Ref<ByteMatrix> matrix_ptr_;
public: public:
static const int NUM_MASK_PATTERNS = 8;
QRCode(); QRCode();
~QRCode(); ~QRCode();
Ref<Mode> getMode() const; Ref<Mode> getMode() const;
Ref<ErrorCorrectionLevel> getECLevel() const; Ref<ErrorCorrectionLevel> getECLevel() const;
Ref<Version> getVersion() const; Ref<Version> getVersion() const;
const int getMaskPattern() const; int getMaskPattern() const;
Ref<ByteMatrix> getMatrix() const; Ref<ByteMatrix> getMatrix() const;
const std::string toString(); const std::string toString();
void setMode(Ref<Mode> value); void setMode(Ref<Mode> value);