QBarcode
Loading...
Searching...
No Matches
qbar::Payload Class Reference

Store data of a Barcode. More...

Inheritance diagram for qbar::Payload:

Public Member Functions

 Payload (const Payload &other)
 
Payloadoperator= (const Payload &other)
 
 Payload (Payload &&other) noexcept
 
Payloadoperator= (Payload &&) noexcept
 
bool isValid () const
 Allow to verify if a payload is valid.
 
PayloadType getType () const
 Get payload type.
 
QByteArray getData () const
 Retrieve encoded data as bytes array.
 
QString getString () const
 Retrieve encoded data as string.
 
BarError getLastError () const
 Retrieve last error.
 
void clear ()
 Clear payload content.
 

Detailed Description

Store data of a Barcode.

This class allow to share common properties/methods accross all kinds of payload types.
This is this class that is responsible to properly encode datas.

Member Function Documentation

◆ isValid()

bool qbar::Payload::isValid ( ) const

Allow to verify if a payload is valid.

A payload is considered valid if:

  • It contains data
  • Encoding operation succeed.
Returns
Returns true if valid.

◆ getType()

PayloadType qbar::Payload::getType ( ) const

Get payload type.

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

Returns
Returns type of the payload.

◆ getData()

QByteArray qbar::Payload::getData ( ) const

Retrieve encoded data as bytes array.

Returns
Returns bytes array data.
See also
getString()

◆ getString()

QString qbar::Payload::getString ( ) const

Retrieve encoded data as string.

Returns
Returns UTF-8 string data.
See also
getData()

◆ getLastError()

BarError qbar::Payload::getLastError ( ) const

Retrieve last error.

Can be useful if after setting a payload, it becomes invalid, this method allow to retrieve the associated error.

Returns
Returns latest error.

◆ clear()

void qbar::Payload::clear ( )

Clear payload content.

Payload data content will be cleared, latest error will be preserved.

See also
getData(), getLastError()

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