VGamepad PC
The Windows app for the virtual game controller.
Loading...
Searching...
No Matches
qrcodegen::QrCode Class Referencefinal

#include <qrcodegen.hpp>

Public Types

enum class  Ecc { LOW = 0 , MEDIUM , QUARTILE , HIGH }
 

Public Member Functions

 QrCode (int ver, Ecc ecl, const std::vector< std::uint8_t > &dataCodewords, int msk)
 
int getVersion () const
 
int getSize () const
 
Ecc getErrorCorrectionLevel () const
 
int getMask () const
 
bool getModule (int x, int y) const
 

Static Public Member Functions

static QrCode encodeText (const char *text, Ecc ecl)
 
static QrCode encodeBinary (const std::vector< std::uint8_t > &data, Ecc ecl)
 
static QrCode encodeSegments (const std::vector< QrSegment > &segs, Ecc ecl, int minVersion=1, int maxVersion=40, int mask=-1, bool boostEcl=true)
 

Static Public Attributes

static constexpr int MIN_VERSION = 1
 
static constexpr int MAX_VERSION = 40
 

Private Member Functions

void drawFunctionPatterns ()
 
void drawFormatBits (int msk)
 
void drawVersion ()
 
void drawFinderPattern (int x, int y)
 
void drawAlignmentPattern (int x, int y)
 
void setFunctionModule (int x, int y, bool isDark)
 
bool module (int x, int y) const
 
std::vector< std::uint8_t > addEccAndInterleave (const std::vector< std::uint8_t > &data) const
 
void drawCodewords (const std::vector< std::uint8_t > &data)
 
void applyMask (int msk)
 
long getPenaltyScore () const
 
std::vector< int > getAlignmentPatternPositions () const
 
int finderPenaltyCountPatterns (const std::array< int, 7 > &runHistory) const
 
int finderPenaltyTerminateAndCount (bool currentRunColor, int currentRunLength, std::array< int, 7 > &runHistory) const
 
void finderPenaltyAddHistory (int currentRunLength, std::array< int, 7 > &runHistory) const
 

Static Private Member Functions

static int getFormatBits (Ecc ecl)
 
static int getNumRawDataModules (int ver)
 
static int getNumDataCodewords (int ver, Ecc ecl)
 
static std::vector< std::uint8_t > reedSolomonComputeDivisor (int degree)
 
static std::vector< std::uint8_t > reedSolomonComputeRemainder (const std::vector< std::uint8_t > &data, const std::vector< std::uint8_t > &divisor)
 
static std::uint8_t reedSolomonMultiply (std::uint8_t x, std::uint8_t y)
 
static bool getBit (long x, int i)
 

Private Attributes

int version
 
int size
 
Ecc errorCorrectionLevel
 
int mask
 
std::vector< std::vector< bool > > modules
 
std::vector< std::vector< bool > > isFunction
 

Static Private Attributes

static const int PENALTY_N1
 
static const int PENALTY_N2
 
static const int PENALTY_N3
 
static const int PENALTY_N4
 
static const std::int8_t ECC_CODEWORDS_PER_BLOCK [4][41]
 
static const std::int8_t NUM_ERROR_CORRECTION_BLOCKS [4][41]
 

Member Enumeration Documentation

◆ Ecc

enum class qrcodegen::QrCode::Ecc
strong
Enumerator
LOW 
MEDIUM 
QUARTILE 
HIGH 

Constructor & Destructor Documentation

◆ QrCode()

qrcodegen::QrCode::QrCode ( int ver,
Ecc ecl,
const std::vector< std::uint8_t > & dataCodewords,
int msk )

Member Function Documentation

◆ addEccAndInterleave()

std::vector< std::uint8_t > qrcodegen::QrCode::addEccAndInterleave ( const std::vector< std::uint8_t > & data) const
private

◆ applyMask()

void qrcodegen::QrCode::applyMask ( int msk)
private

◆ drawAlignmentPattern()

void qrcodegen::QrCode::drawAlignmentPattern ( int x,
int y )
private

◆ drawCodewords()

void qrcodegen::QrCode::drawCodewords ( const std::vector< std::uint8_t > & data)
private

◆ drawFinderPattern()

void qrcodegen::QrCode::drawFinderPattern ( int x,
int y )
private

◆ drawFormatBits()

void qrcodegen::QrCode::drawFormatBits ( int msk)
private

◆ drawFunctionPatterns()

void qrcodegen::QrCode::drawFunctionPatterns ( )
private

◆ drawVersion()

void qrcodegen::QrCode::drawVersion ( )
private

◆ encodeBinary()

static QrCode qrcodegen::QrCode::encodeBinary ( const std::vector< std::uint8_t > & data,
Ecc ecl )
static

◆ encodeSegments()

static QrCode qrcodegen::QrCode::encodeSegments ( const std::vector< QrSegment > & segs,
Ecc ecl,
int minVersion = 1,
int maxVersion = 40,
int mask = -1,
bool boostEcl = true )
static

◆ encodeText()

static QrCode qrcodegen::QrCode::encodeText ( const char * text,
Ecc ecl )
static

◆ finderPenaltyAddHistory()

void qrcodegen::QrCode::finderPenaltyAddHistory ( int currentRunLength,
std::array< int, 7 > & runHistory ) const
private

◆ finderPenaltyCountPatterns()

int qrcodegen::QrCode::finderPenaltyCountPatterns ( const std::array< int, 7 > & runHistory) const
private

◆ finderPenaltyTerminateAndCount()

int qrcodegen::QrCode::finderPenaltyTerminateAndCount ( bool currentRunColor,
int currentRunLength,
std::array< int, 7 > & runHistory ) const
private

◆ getAlignmentPatternPositions()

std::vector< int > qrcodegen::QrCode::getAlignmentPatternPositions ( ) const
private

◆ getBit()

static bool qrcodegen::QrCode::getBit ( long x,
int i )
staticprivate

◆ getErrorCorrectionLevel()

Ecc qrcodegen::QrCode::getErrorCorrectionLevel ( ) const

◆ getFormatBits()

static int qrcodegen::QrCode::getFormatBits ( Ecc ecl)
staticprivate

◆ getMask()

int qrcodegen::QrCode::getMask ( ) const

◆ getModule()

bool qrcodegen::QrCode::getModule ( int x,
int y ) const

◆ getNumDataCodewords()

static int qrcodegen::QrCode::getNumDataCodewords ( int ver,
Ecc ecl )
staticprivate

◆ getNumRawDataModules()

static int qrcodegen::QrCode::getNumRawDataModules ( int ver)
staticprivate

◆ getPenaltyScore()

long qrcodegen::QrCode::getPenaltyScore ( ) const
private

◆ getSize()

int qrcodegen::QrCode::getSize ( ) const

◆ getVersion()

int qrcodegen::QrCode::getVersion ( ) const

◆ module()

bool qrcodegen::QrCode::module ( int x,
int y ) const
private

◆ reedSolomonComputeDivisor()

static std::vector< std::uint8_t > qrcodegen::QrCode::reedSolomonComputeDivisor ( int degree)
staticprivate

◆ reedSolomonComputeRemainder()

static std::vector< std::uint8_t > qrcodegen::QrCode::reedSolomonComputeRemainder ( const std::vector< std::uint8_t > & data,
const std::vector< std::uint8_t > & divisor )
staticprivate

◆ reedSolomonMultiply()

static std::uint8_t qrcodegen::QrCode::reedSolomonMultiply ( std::uint8_t x,
std::uint8_t y )
staticprivate

◆ setFunctionModule()

void qrcodegen::QrCode::setFunctionModule ( int x,
int y,
bool isDark )
private

Member Data Documentation

◆ ECC_CODEWORDS_PER_BLOCK

const std::int8_t qrcodegen::QrCode::ECC_CODEWORDS_PER_BLOCK[4][41]
staticprivate

◆ errorCorrectionLevel

Ecc qrcodegen::QrCode::errorCorrectionLevel
private

◆ isFunction

std::vector<std::vector<bool> > qrcodegen::QrCode::isFunction
private

◆ mask

int qrcodegen::QrCode::mask
private

◆ MAX_VERSION

int qrcodegen::QrCode::MAX_VERSION = 40
staticconstexpr

◆ MIN_VERSION

int qrcodegen::QrCode::MIN_VERSION = 1
staticconstexpr

◆ modules

std::vector<std::vector<bool> > qrcodegen::QrCode::modules
private

◆ NUM_ERROR_CORRECTION_BLOCKS

const std::int8_t qrcodegen::QrCode::NUM_ERROR_CORRECTION_BLOCKS[4][41]
staticprivate

◆ PENALTY_N1

const int qrcodegen::QrCode::PENALTY_N1
staticprivate

◆ PENALTY_N2

const int qrcodegen::QrCode::PENALTY_N2
staticprivate

◆ PENALTY_N3

const int qrcodegen::QrCode::PENALTY_N3
staticprivate

◆ PENALTY_N4

const int qrcodegen::QrCode::PENALTY_N4
staticprivate

◆ size

int qrcodegen::QrCode::size
private

◆ version

int qrcodegen::QrCode::version
private

The documentation for this class was generated from the following file: