formatting cleanup before trying to make the last failing C++ qr blackbox test pass

git-svn-id: https://zxing.googlecode.com/svn/trunk@1964 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2011-10-13 15:20:25 +00:00
parent 9558d83d71
commit beeef242b2
5 changed files with 329 additions and 321 deletions

View file

@ -1,3 +1,4 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
/* /*
* BitMatrix.cpp * BitMatrix.cpp
* zxing * zxing
@ -24,9 +25,15 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
namespace zxing { using std::numeric_limits;
using namespace std; using std::ostream;
using std::ostringstream;
using zxing::BitMatrix;
using zxing::BitArray;
using zxing::Ref;
namespace {
unsigned int logDigits(unsigned digits) { unsigned int logDigits(unsigned digits) {
unsigned log = 0; unsigned log = 0;
unsigned val = 1; unsigned val = 1;
@ -41,7 +48,7 @@ const unsigned int bitsPerWord = numeric_limits<unsigned int>::digits;
const unsigned int logBits = logDigits(bitsPerWord); const unsigned int logBits = logDigits(bitsPerWord);
const unsigned int bitsMask = (1 << logBits) - 1; const unsigned int bitsMask = (1 << logBits) - 1;
static size_t wordsForSize(size_t width, size_t height) { size_t wordsForSize(size_t width, size_t height) {
size_t bits = width * height; size_t bits = width * height;
int arraySize = bits >> logBits; int arraySize = bits >> logBits;
if (bits - (arraySize << logBits) != 0) { if (bits - (arraySize << logBits) != 0) {
@ -49,6 +56,7 @@ static size_t wordsForSize(size_t width, size_t height) {
} }
return arraySize; return arraySize;
} }
}
BitMatrix::BitMatrix(size_t dimension) : BitMatrix::BitMatrix(size_t dimension) :
width_(dimension), height_(dimension), words_(0), bits_(NULL) { width_(dimension), height_(dimension), words_(0), bits_(NULL) {
@ -160,6 +168,7 @@ unsigned int* BitMatrix::getBits() const {
return bits_; return bits_;
} }
namespace zxing {
ostream& operator<<(ostream &out, const BitMatrix &bm) { ostream& operator<<(ostream &out, const BitMatrix &bm) {
for (size_t y = 0; y < bm.height_; y++) { for (size_t y = 0; y < bm.height_; y++) {
for (size_t x = 0; x < bm.width_; x++) { for (size_t x = 0; x < bm.width_; x++) {
@ -169,10 +178,10 @@ ostream& operator<<(ostream &out, const BitMatrix &bm) {
} }
return out; return out;
} }
}
const char* BitMatrix::description() { const char* BitMatrix::description() {
ostringstream out; ostringstream out;
out << *this; out << *this;
return out.str().c_str(); return out.str().c_str();
} }
}

View file

@ -1,3 +1,4 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __BIT_MATRIX_H__ #ifndef __BIT_MATRIX_H__
#define __BIT_MATRIX_H__ #define __BIT_MATRIX_H__

View file

@ -1,3 +1,4 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
/* /*
* QRCodeReader.cpp * QRCodeReader.cpp
* zxing * zxing

View file

@ -1,3 +1,4 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __QR_CODE_READER_H__ #ifndef __QR_CODE_READER_H__
#define __QR_CODE_READER_H__ #define __QR_CODE_READER_H__

View file

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
* /*
* DecodedBitStreamParser.cpp * DecodedBitStreamParser.cpp
* zxing * zxing
* *
@ -35,15 +35,14 @@
#define ICONV_CONST /**/ #define ICONV_CONST /**/
#endif #endif
using namespace zxing;
namespace zxing {
namespace qrcode {
using namespace std; using namespace std;
using namespace zxing;
using namespace zxing::qrcode;
const char DecodedBitStreamParser::ALPHANUMERIC_CHARS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', const char DecodedBitStreamParser::ALPHANUMERIC_CHARS[] =
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':' 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':'
}; };
@ -358,6 +357,3 @@ namespace zxing {
} while (mode != &Mode::TERMINATOR); } while (mode != &Mode::TERMINATOR);
return result; return result;
} }
}
}