mirror of
https://github.com/zxing/zxing.git
synced 2025-01-27 11:01:00 -08:00
port r1921 java changes to C++
git-svn-id: https://zxing.googlecode.com/svn/trunk@1961 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
c7e2f62050
commit
ccf08aabe8
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Mode.cpp
|
||||
* zxing
|
||||
|
@ -24,19 +25,23 @@
|
|||
#include <zxing/qrcode/Version.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace zxing {
|
||||
namespace qrcode {
|
||||
using namespace std;
|
||||
using zxing::qrcode::Mode;
|
||||
using std::ostringstream;
|
||||
|
||||
Mode Mode::TERMINATOR(0, 0, 0);
|
||||
Mode Mode::NUMERIC(10, 12, 14);
|
||||
Mode Mode::ALPHANUMERIC(9, 11, 13);
|
||||
Mode Mode::BYTE(8, 16, 16);
|
||||
Mode Mode::KANJI(8, 10, 12);
|
||||
Mode Mode::TERMINATOR(0, 0, 0, 0x00, "TERMINATOR");
|
||||
Mode Mode::NUMERIC(10, 12, 14, 0x01, "NUMERIC");
|
||||
Mode Mode::ALPHANUMERIC(9, 11, 13, 0x02, "ALPHANUMERIC");
|
||||
Mode Mode::STRUCTURED_APPEND(0, 0, 0, 0x03, "STRUCTURED_APPEND");
|
||||
Mode Mode::BYTE(8, 16, 16, 0x04, "BYTE");
|
||||
Mode Mode::ECI(0, 0, 0, 0x07, "ECI");
|
||||
Mode Mode::KANJI(8, 10, 12, 0x08, "KANJI");
|
||||
Mode Mode::FNC1_FIRST_POSITION(0, 0, 0, 0x05, "FNC1_FIRST_POSITION");
|
||||
Mode Mode::FNC1_SECOND_POSITION(0, 0, 0, 0x09, "FNC1_SECOND_POSITION");
|
||||
Mode Mode::HANZI(8, 10, 12, 0x0D, "HANZI");
|
||||
|
||||
Mode::Mode(int cbv0_9, int cbv10_26, int cbv27) :
|
||||
Mode::Mode(int cbv0_9, int cbv10_26, int cbv27, int bits, char const* name) :
|
||||
characterCountBitsForVersions0To9_(cbv0_9), characterCountBitsForVersions10To26_(cbv10_26),
|
||||
characterCountBitsForVersions27AndHigher_(cbv27) {
|
||||
characterCountBitsForVersions27AndHigher_(cbv27), bits_(bits), name_(name) {
|
||||
}
|
||||
|
||||
Mode& Mode::forBits(int bits) {
|
||||
|
@ -68,6 +73,3 @@ int Mode::getCharacterCountBits(Version *version) {
|
|||
return characterCountBitsForVersions27AndHigher_;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __MODE_H__
|
||||
#define __MODE_H__
|
||||
|
||||
|
@ -31,15 +32,22 @@ private:
|
|||
int characterCountBitsForVersions0To9_;
|
||||
int characterCountBitsForVersions10To26_;
|
||||
int characterCountBitsForVersions27AndHigher_;
|
||||
int bits_;
|
||||
std::string name_;
|
||||
|
||||
Mode(int cbv0_9, int cbv10_26, int cbv27);
|
||||
Mode(int cbv0_9, int cbv10_26, int cbv27, int bits, char const* name);
|
||||
|
||||
public:
|
||||
static Mode TERMINATOR;
|
||||
static Mode NUMERIC;
|
||||
static Mode ALPHANUMERIC;
|
||||
static Mode STRUCTURED_APPEND;
|
||||
static Mode BYTE;
|
||||
static Mode ECI;
|
||||
static Mode KANJI;
|
||||
static Mode FNC1_FIRST_POSITION;
|
||||
static Mode FNC1_SECOND_POSITION;
|
||||
static Mode HANZI;
|
||||
|
||||
static Mode& forBits(int bits);
|
||||
int getCharacterCountBits(Version *version);
|
||||
|
|
Loading…
Reference in a new issue