#include </home/evins/glbarcode/glbarcode/Barcode2dBase.hpp>


Public Member Functions | |
| ~Barcode2dBase () override | |
| Barcode & | build (const std::string &data, double w=0, double h=0) override |
Public Member Functions inherited from glbarcode::Barcode | |
| virtual | ~Barcode () |
| Barcode (const Barcode &)=delete | |
| void | operator= (const Barcode &)=delete |
| Barcode & | setShowText (bool value) |
| bool | showText () const |
| Barcode & | setChecksum (bool value) |
| bool | checksum () const |
| void | render (Renderer &renderer) |
| bool | isEmpty () const |
| bool | isDataValid () const |
| double | width () const |
| double | height () const |
Protected Member Functions | |
| Barcode2dBase () | |
| virtual bool | validate (const std::string &rawData)=0 |
| virtual std::string | preprocess (const std::string &rawData) |
| virtual bool | encode (const std::string &cookedData, Matrix< bool > &encodedData)=0 |
| virtual void | vectorize (const Matrix< bool > &encodedData, double &w, double &h) |
Protected Member Functions inherited from glbarcode::Barcode | |
| Barcode () | |
| void | clear () |
| void | addLine (double x, double y, double w, double h) |
| void | addBox (double x, double y, double w, double h) |
| void | addText (double x, double y, double size, const std::string &text, HAlign halign=H_ALIGN_CENTER) |
| void | addRing (double x, double y, double r, double w) |
| void | addHexagon (double x, double y, double h) |
| void | setIsEmpty (bool value) |
| void | setIsDataValid (bool value) |
| void | setWidth (double w) |
| void | setHeight (double h) |
The Barcode2dBase class is the base class for all 2D barcode implementations. This class provides a common framework for the implementation of 2D barcodes. Creating 2D barcode types (or symbologies) would be typically accomplished by implementing this class rather than directly implementing the Barcode class.
|
protected |
Default constructor.
|
override |
Destructor.
|
overridevirtual |
Build 2D barcode from data.
Implements glbarcode::Barcode::build(). Calls the validate(), preprocess(), encode(), and vectorize() virtual methods, as shown:
| [in] | data | Data to encode in barcode |
| [in] | w | Requested width of barcode (0 = auto size) |
| [in] | h | Requested height of barcode (0 = auto size) |
Implements glbarcode::Barcode.
|
protectedpure virtual |
Encode barcode data
Required virtual method to encode data such that it can be later vectorized.
| [in] | cookedData | Data to encode |
| [out] | encodedData | Encoded data in the form of a matrix |
|
protectedvirtual |
Preprocess barcode data.
Optional virtual method to perform any transformation of the data needed before encoding. (E.g. encoding an extended alphabet into a simpler one).
| [in] | rawData | Data to preprocess |
|
protectedpure virtual |
Validate barcode data.
Required virtual method to test if data is valid for encoding with barcode type.
| [in] | rawData | Data to validate |
|
protectedvirtual |
Vectorize encoded data
Optional virtual method to convert encoded data into a list of drawing primitives which can later be rendered.
| [in] | encodedData | Data to vectorize |
| [in,out] | w | Requested width of barcode (0 = auto size), vectorize will overwrite with actual width |
| [in,out] | h | Requested height of barcode (0 = auto size), vectorize will overwrite with actual width |