QBarcode
Loading...
Searching...
No Matches
qbar::Barcode Class Referenceabstract

Represent a barcode entity. More...

Inheritance diagram for qbar::Barcode:

Public Member Functions

 Barcode (Barcode &&other) noexcept
 
Barcodeoperator= (Barcode &&) noexcept
 
bool isValid () const
 Allow to verify if a barcode is valid.
 
BarType getType () const
 Get barcode type.
 
const PayloadgetPayload () const
 Get payload data of barcode.
 
QSize getSize () const
 Get matrix size.
 
const MatrixDatagetMatrixData () const
 Get matrix data of a barcode.
 
virtual QSizeF getRatio () const =0
 Retrieve ratio of a barcode.
 
template<typename T >
const T * getPayloadAs () const
 Allow to directly cast payload to expected type.
 

Detailed Description

Represent a barcode entity.

This class allow to share common properties/methods accross all kinds of barcodes types.
A barcode entity is considered as immutable, to set it, it will be necessary to generate a new Barcode via their create() method.
Barcode only store data, it known nothing of the rendering process. Once a barcode entity is created, it can be renderer via Renderer derived classes.

Member Function Documentation

◆ isValid()

bool qbar::Barcode::isValid ( ) const

Allow to verify if a barcode is valid.

A barcode is considered valid if:

  • Current type is known and supported
  • A matrix is properly set.
Returns
Returns true if valid.

◆ getType()

BarType qbar::Barcode::getType ( ) const

Get barcode type.

Useful to properly cast a Barcode instance to its "real" type.

Returns
Returns type of the barcode.

◆ getPayload()

const Payload * qbar::Barcode::getPayload ( ) const

Get payload data of barcode.

Returns
Returns pointer to payload data.
Can be NULL if barcode is invalid.
See also
isValid()

◆ getSize()

QSize qbar::Barcode::getSize ( ) const

Get matrix size.

Returns
Returns matrix size in number of modules.

◆ getMatrixData()

const MatrixData & qbar::Barcode::getMatrixData ( ) const

Get matrix data of a barcode.

Matrix data can be useful if directly managing "raw" datas, mainly used for Renderer derived classes.

Returns
Returns constant reference to matrix of barcode.

◆ getRatio()

virtual QSizeF qbar::Barcode::getRatio ( ) const
pure virtual

Retrieve ratio of a barcode.

Allow to manage different format of barcode, to know if they are taller of wider.

Returns
Returns associated ratio.

Implemented in qbar::QrCode.

◆ getPayloadAs()

template<typename T >
const T * qbar::Barcode::getPayloadAs ( ) const
inline

Allow to directly cast payload to expected type.

Returns
Returns casted payload pointer.
Can be NULL if barcode is invalid or if casting cannot be done.

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