NeKernel dev
Loading...
Searching...
No Matches
qr::Qr< V > Struct Template Reference

#include <Qr.h>

Public Member Functions

constexpr auto side_size () const
bool module (int x, int y)
bool encode (const char *str, size_t len, Ecc ecc, int mask=-1)

Private Member Functions

bool draw (int x, int y) noexcept
 draw a new QR code.
bool encode_data (const char *data, size_t len, Ecc ecc, uint8_t *out)
void encode_ecc (uint8_t *data, Ecc ecc, uint8_t *out)
void add_data (uint8_t *data, uint8_t *patterns)
void add_patterns ()
void add_version ()
void add_format (Ecc ecc, int mask)
void reserve_patterns (uint8_t *out)
template<bool Black>
void draw_rect (int y, int x, int height, int width, uint8_t *out)
template<bool Black>
void draw_bound (int y, int x, int height, int width, uint8_t *out)
template<bool Horizontal>
int rule_1_3_score ()
int penalty_score ()
int select_mask (Ecc ecc, uint8_t *patterns)
void apply_mask (int mask, uint8_t *patterns)
uint8_t get_arr_bit (uint8_t *arr, unsigned bit) const
 internal function to retrieve bit from a bitset.
void set_arr_bit (uint8_t *arr, unsigned bit)
 internal function to set bit from a bitset.
void clr_arr_bit (uint8_t *arr, unsigned bit)
 internal function to clear bit from a bitset.

Private Attributes

uint8_t code [N_BYTES] = {}
bool status = false

Static Private Attributes

static constexpr int SIDE = 17 + V * 4
static constexpr int N_BITS = SIDE * SIDE
static constexpr int N_ALIGN = V == 1 ? 0 : V / 7 + 2
static constexpr int N_ALIGN_BITS = V > 1 ? (N_ALIGN* N_ALIGN - 3) * 25 : 0
static constexpr int N_TIMING_BITS = (SIDE - 16) * 2 - (10 * (V > 1 ? N_ALIGN - 2 : 0))
static constexpr int N_VER_BITS = V > 6 ? 36 : 0
static constexpr int N_DAT_BITS = N_BITS - (192 + N_ALIGN_BITS + N_TIMING_BITS + 31 + N_VER_BITS)
static constexpr int N_BYTES = utl::bytes_in_bits(N_BITS)
static constexpr int N_DAT_BYTES
static constexpr int N_DAT_CAPACITY

Friends

class QrDelegate

Member Function Documentation

◆ add_data()

template<int V>
void qr::Qr< V >::add_data ( uint8_t * data,
uint8_t * patterns )
private

◆ add_format()

template<int V>
void qr::Qr< V >::add_format ( Ecc ecc,
int mask )
private

◆ add_patterns()

template<int V>
void qr::Qr< V >::add_patterns ( )
private

◆ add_version()

template<int V>
void qr::Qr< V >::add_version ( )
private

◆ apply_mask()

template<int V>
void qr::Qr< V >::apply_mask ( int mask,
uint8_t * patterns )
private

◆ clr_arr_bit()

template<int V>
void qr::Qr< V >::clr_arr_bit ( uint8_t * arr,
unsigned bit )
inlineprivate

internal function to clear bit from a bitset.

◆ draw()

template<int V>
bool qr::Qr< V >::draw ( int x,
int y )
privatenoexcept

draw a new QR code.

◆ draw_bound()

template<int V>
template<bool B>
void qr::Qr< V >::draw_bound ( int y,
int x,
int height,
int width,
uint8_t * out )
private

◆ draw_rect()

template<int V>
template<bool B>
void qr::Qr< V >::draw_rect ( int y,
int x,
int height,
int width,
uint8_t * out )
private

◆ encode()

template<int V>
bool qr::Qr< V >::encode ( const char * str,
size_t len,
Ecc ecc,
int mask = -1 )

◆ encode_data()

template<int V>
bool qr::Qr< V >::encode_data ( const char * data,
size_t len,
Ecc ecc,
uint8_t * out )
private

◆ encode_ecc()

template<int V>
void qr::Qr< V >::encode_ecc ( uint8_t * data,
Ecc ecc,
uint8_t * out )
private

◆ get_arr_bit()

template<int V>
uint8_t qr::Qr< V >::get_arr_bit ( uint8_t * arr,
unsigned bit ) const
inlineprivate

internal function to retrieve bit from a bitset.

◆ module()

template<int V>
bool qr::Qr< V >::module ( int x,
int y )

◆ penalty_score()

template<int V>
int qr::Qr< V >::penalty_score ( )
private

◆ reserve_patterns()

template<int V>
void qr::Qr< V >::reserve_patterns ( uint8_t * out)
private

◆ rule_1_3_score()

template<int V>
template<bool H>
int qr::Qr< V >::rule_1_3_score ( )
private

◆ select_mask()

template<int V>
int qr::Qr< V >::select_mask ( Ecc ecc,
uint8_t * patterns )
private

◆ set_arr_bit()

template<int V>
void qr::Qr< V >::set_arr_bit ( uint8_t * arr,
unsigned bit )
inlineprivate

internal function to set bit from a bitset.

◆ side_size()

template<int V>
auto qr::Qr< V >::side_size ( ) const
inlineconstexpr

◆ QrDelegate

template<int V>
friend class QrDelegate
friend

Member Data Documentation

◆ code

template<int V>
uint8_t qr::Qr< V >::code[N_BYTES] = {}
private

◆ N_ALIGN

template<int V>
int qr::Qr< V >::N_ALIGN = V == 1 ? 0 : V / 7 + 2
staticconstexprprivate

◆ N_ALIGN_BITS

template<int V>
int qr::Qr< V >::N_ALIGN_BITS = V > 1 ? (N_ALIGN* N_ALIGN - 3) * 25 : 0
staticconstexprprivate

◆ N_BITS

template<int V>
int qr::Qr< V >::N_BITS = SIDE * SIDE
staticconstexprprivate

◆ N_BYTES

template<int V>
int qr::Qr< V >::N_BYTES = utl::bytes_in_bits(N_BITS)
staticconstexprprivate

◆ N_DAT_BITS

template<int V>
int qr::Qr< V >::N_DAT_BITS = N_BITS - (192 + N_ALIGN_BITS + N_TIMING_BITS + 31 + N_VER_BITS)
staticconstexprprivate

◆ N_DAT_BYTES

template<int V>
int qr::Qr< V >::N_DAT_BYTES
staticconstexprprivate
Initial value:
=
constexpr size_t bytes_in_bits(size_t n)
Get number of bytes required to store N bits.
Definition bit.h:117
static constexpr int N_DAT_BITS
Definition Qr.h:275

◆ N_DAT_CAPACITY

template<int V>
int qr::Qr< V >::N_DAT_CAPACITY
staticconstexprprivate
Initial value:
=

◆ N_TIMING_BITS

template<int V>
int qr::Qr< V >::N_TIMING_BITS = (SIDE - 16) * 2 - (10 * (V > 1 ? N_ALIGN - 2 : 0))
staticconstexprprivate

◆ N_VER_BITS

template<int V>
int qr::Qr< V >::N_VER_BITS = V > 6 ? 36 : 0
staticconstexprprivate

◆ SIDE

template<int V>
int qr::Qr< V >::SIDE = 17 + V * 4
staticconstexprprivate

◆ status

template<int V>
bool qr::Qr< V >::status = false
private

The documentation for this struct was generated from the following file:
  • dev/boot/BootKit/Qr.h