Support libzint >= 2.15 (#225,#222,#186))

- Update libzint support for 2.15 as new baseline version, removing support for earlier versions, avoiding '#ifdef'-hell
- Based on #186

---------

Co-authored-by: gitlost <burmartke@gmail.com>
This commit is contained in:
Jaye Evins
2025-08-16 17:00:14 -04:00
committed by GitHub
parent fa96cc5a17
commit 0e7049ed73
19 changed files with 957 additions and 162 deletions
+111 -43
View File
@@ -184,12 +184,17 @@ namespace glabels
glbarcode::Factory::registerType( "zint::ausrd", Zint::AusRD::create );
glbarcode::Factory::registerType( "zint::aztec", Zint::Aztec::create );
glbarcode::Factory::registerType( "zint::azrun", Zint::Azrun::create );
glbarcode::Factory::registerType( "zint::bc412", Zint::Bc412::create );
glbarcode::Factory::registerType( "zint::cepnet", Zint::Cepnet::create );
glbarcode::Factory::registerType( "zint::cbr", Zint::Cbr::create );
glbarcode::Factory::registerType( "zint::cblockf", Zint::Cblockf::create );
glbarcode::Factory::registerType( "zint::channel", Zint::Channel::create );
glbarcode::Factory::registerType( "zint::code1", Zint::Code1::create );
glbarcode::Factory::registerType( "zint::code11", Zint::Code11::create );
glbarcode::Factory::registerType( "zint::c16k", Zint::C16k::create );
glbarcode::Factory::registerType( "zint::c25m", Zint::C25m::create );
glbarcode::Factory::registerType( "zint::c25i", Zint::C25i::create );
glbarcode::Factory::registerType( "zint::c25ind", Zint::C25ind::create );
glbarcode::Factory::registerType( "zint::c25dl", Zint::C25dl::create );
glbarcode::Factory::registerType( "zint::code32", Zint::Code32::create );
glbarcode::Factory::registerType( "zint::code39", Zint::Code39::create );
@@ -202,10 +207,16 @@ namespace glabels
glbarcode::Factory::registerType( "zint::dmtx", Zint::Dmtx::create );
glbarcode::Factory::registerType( "zint::dpl", Zint::Dpl::create );
glbarcode::Factory::registerType( "zint::dpi", Zint::Dpi::create );
glbarcode::Factory::registerType( "zint::dotcode", Zint::Dotcode::create );
glbarcode::Factory::registerType( "zint::dpd", Zint::Dpd::create );
glbarcode::Factory::registerType( "zint::kix", Zint::Kix::create );
glbarcode::Factory::registerType( "zint::ean", Zint::Ean::create );
glbarcode::Factory::registerType( "zint::ean14", Zint::Ean14::create );
glbarcode::Factory::registerType( "zint::fim", Zint::Fim::create );
glbarcode::Factory::registerType( "zint::flat", Zint::Flat::create );
glbarcode::Factory::registerType( "zint::gmtx", Zint::Gmtx::create );
glbarcode::Factory::registerType( "zint::gs1-128", Zint::Gs1128::create );
glbarcode::Factory::registerType( "zint::hanxin", Zint::Hanxin::create );
glbarcode::Factory::registerType( "zint::rss14", Zint::Rss14::create );
glbarcode::Factory::registerType( "zint::rssltd", Zint::Rssltd::create );
glbarcode::Factory::registerType( "zint::rssexp", Zint::Rssexp::create );
@@ -218,6 +229,7 @@ namespace glabels
glbarcode::Factory::registerType( "zint::hibcqr", Zint::Hibcqr::create );
glbarcode::Factory::registerType( "zint::hibcpdf", Zint::Hibcpdf::create );
glbarcode::Factory::registerType( "zint::hibcmpdf", Zint::Hibcmpdf::create );
glbarcode::Factory::registerType( "zint::hibcblkf", Zint::Hibcblkf::create );
glbarcode::Factory::registerType( "zint::hibcaz", Zint::Hibcaz::create );
glbarcode::Factory::registerType( "zint::i25", Zint::I25::create );
glbarcode::Factory::registerType( "zint::isbn", Zint::Isbn::create );
@@ -238,13 +250,18 @@ namespace glabels
glbarcode::Factory::registerType( "zint::pharma2", Zint::Pharma2::create );
glbarcode::Factory::registerType( "zint::pzn", Zint::Pzn::create );
glbarcode::Factory::registerType( "zint::qr", Zint::Qr::create );
glbarcode::Factory::registerType( "zint::rmqr", Zint::Rmqr::create );
glbarcode::Factory::registerType( "zint::rm4", Zint::Rm4::create );
glbarcode::Factory::registerType( "zint::rm4sm", Zint::Rm4sm::create );
glbarcode::Factory::registerType( "zint::rm2dm", Zint::Rm2dm::create );
glbarcode::Factory::registerType( "zint::tele", Zint::Tele::create );
glbarcode::Factory::registerType( "zint::telex", Zint::Telex::create );
glbarcode::Factory::registerType( "zint::upc-a", Zint::UpcA::create );
glbarcode::Factory::registerType( "zint::upc-e", Zint::UpcE::create );
glbarcode::Factory::registerType( "zint::upus10", Zint::UpuS10::create );
glbarcode::Factory::registerType( "zint::usps", Zint::Usps::create );
glbarcode::Factory::registerType( "zint::pls", Zint::Pls::create );
glbarcode::Factory::registerType( "zint::vin", Zint::Vin::create );
registerStyle( "ausp", "zint", tr("Australia Post Standard"),
false, false, true, false, "12345678901234567890123", true, 23 );
@@ -261,38 +278,53 @@ namespace glabels
registerStyle( "aztec", "zint", tr("Aztec Code"),
false, false, true, false, "1234567890", true, 10 );
registerStyle( "azrun", "zint", tr("Aztec Rune"),
registerStyle( "azrun", "zint", tr("Aztec Runes"),
false, false, true, false, "255", true, 3 );
registerStyle( "bc412", "zint", tr("BC412 (SEMI TI-95)"),
true, true, true, false, "12345678", true, 8 );
registerStyle( "cepnet", "zint", tr("CEPNet (Brazilian Post)"),
false, false, true, false, "12345678", true, 8 );
registerStyle( "channel", "zint", tr("Channel Code"),
true, true, false, false, "00", true, 2 );
registerStyle( "cbr", "zint", tr("Codabar"),
true, true, true, false, "ABCDABCDAB", true, 10 );
true, true, true, true, "A00000000B", true, 10 );
registerStyle( "cblockf", "zint", tr("Codablock-F"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "code1", "zint", tr("Code One"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "code11", "zint", tr("Code 11"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "c16k", "zint", tr("Code 16K"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "c25m", "zint", tr("Code 2 of 5 Matrix"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "c25m", "zint", tr("Code 2 of 5 Standard"),
true, true, true, true, "0000000000", true, 10 );
registerStyle( "c25i", "zint", tr("Code 2 of 5 IATA"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "c25ind", "zint", tr("Code 2 of 5 Industrial"),
true, true, true, true, "0000000000", true, 10 );
registerStyle( "c25dl", "zint", tr("Code 2 of 5 Data Logic"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "code32", "zint", tr("Code 32 (Italian Pharmacode)"),
true, true, true, false, "12345678", true, 8 );
registerStyle( "code39", "zint", tr("Code 39"),
true, true, false, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "code39e", "zint", tr("Code 39 Extended"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "code49", "zint", tr("Code 49"),
false, false, true, false, "0000000000", true, 10 );
@@ -317,36 +349,54 @@ namespace glabels
registerStyle( "dpi", "zint", tr("Deutsche Post Identcode"),
true, true, true, false, "12345678901", true, 11 );
registerStyle( "kix", "zint", tr("Dutch Post KIX Code"),
registerStyle( "dotcode", "zint", tr("DotCode"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "dpd", "zint", tr("DPD Code"),
true, true, true, false, "000000000000000000000000000", true, 27 );
registerStyle( "kix", "zint", tr("Dutch Post KIX Code"),
false, false, false, false, "0000000000", true, 10 );
registerStyle( "ean", "zint", tr("EAN"),
true, true, true, false, "123456789012", false, 12 );
registerStyle( "ean14", "zint", tr("EAN-14"),
true, true, true, false, "1234567890123", false, 13 );
registerStyle( "fim", "zint", tr("FIM (Facing ID Mark)"),
false, false, false, false, "A", false, 1 );
registerStyle( "flat", "zint", tr("Flattermarken"),
false, false, false, false, "11111111", false, 8 );
registerStyle( "gmtx", "zint", tr("Grid Matrix"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "gs1-128", "zint", tr("GS1-128"),
true, true, true, false, "[01]12345678901234", false, 18 );
true, true, true, false, "[01]12345678901231", false, 18 );
registerStyle( "rss14", "zint", tr("GS1 DataBar-14"),
registerStyle( "rss14", "zint", tr("GS1 DataBar Omnidirectional"),
true, true, true, false, "1234567890123", true, 13 );
registerStyle( "rssltd", "zint", "GS1 DataBar-14 Limited",
registerStyle( "rssltd", "zint", "GS1 DataBar Limited",
true, true, true, false, "1234567890123", true, 13 );
registerStyle( "rssexp", "zint", "GS1 DataBar Extended",
true, true, true, false, "[01]12345678901234", false, 18 );
registerStyle( "rssexp", "zint", "GS1 DataBar Expanded",
true, true, true, false, "[01]12345678901231", false, 18 );
registerStyle( "rsss", "zint", tr("GS1 DataBar-14 Stacked"),
registerStyle( "rsss", "zint", tr("GS1 DataBar Stacked"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "rssso", "zint", tr("GS1 DataBar-14 Stacked Omni."),
registerStyle( "rssso", "zint", tr("GS1 DataBar Stacked Omni."),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "rssse", "zint", tr("GS1 DataBar Extended Stacked"),
false, false, true, false, "[01]12345678901234", false, 18 );
registerStyle( "rssse", "zint", tr("GS1 DataBar Expanded Stacked"),
false, false, true, false, "[01]12345678901231", false, 18 );
registerStyle( "hanxin", "zint", tr("Han Xin"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "hibc128", "zint", tr("HIBC Code 128"),
true, true, true, false, "0000000000", true, 10 );
@@ -363,14 +413,17 @@ namespace glabels
registerStyle( "hibcpdf", "zint", tr("HIBC PDF417"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "hibcmpdf", "zint", tr("HIBC Micro PDF417"),
registerStyle( "hibcmpdf", "zint", tr("HIBC MicroPDF417"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "hibcblkf", "zint", tr("HIBC Codablock-F"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "hibcaz", "zint", tr("HIBC Aztec Code"),
true, true, true, false, "0000000000", true, 10 );
false, false, true, false, "0000000000", true, 10 );
registerStyle( "i25", "zint", tr("Interleaved 2 of 5"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "isbn", "zint", tr("ISBN"),
true, true, true, false, "123456789", false, 9 );
@@ -385,67 +438,82 @@ namespace glabels
true, true, true, false, "123456", false, 6 );
registerStyle( "logm", "zint", tr("LOGMARS"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "maxi", "zint", tr("Maxicode"),
false, false, false, false, "0000000000", true, 10 );
false, false, true, false, "0000000000", true, 10 );
registerStyle( "mpdf", "zint", tr("Micro PDF417"),
registerStyle( "mpdf", "zint", tr("MicroPDF417"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "mqr", "zint", tr("Micro QR Code"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "msi", "zint", tr("MSI Plessey"),
true, true, true, false, "0000000000", true, 10 );
true, true, true, true, "0000000000", true, 10 );
registerStyle( "nve", "zint", tr("NVE-18"),
registerStyle( "nve", "zint", tr("NVE-18 (SSCC-18)"),
true, true, true, false, "12345678901234567", false, 17 );
registerStyle( "pdf", "zint", tr("PDF417"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "pdft", "zint", tr("PDF417 Truncated"),
registerStyle( "pdft", "zint", tr("PDF417 Compact"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "plan", "zint", tr("PLANET"),
false, false, true, false, "0000000000", true, 10 );
false, false, true, false, "00000000000", true, 11 );
registerStyle( "postnet", "zint", tr("PostNet"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "postnet", "zint", tr("POSTNET"),
false, false, true, false, "00000000000", true, 11 );
registerStyle( "pharma", "zint", tr("Pharmacode"),
false, false, true, false, "123456", false, 6 );
false, false, false, false, "123456", false, 6 );
registerStyle( "pharma2", "zint", tr("Pharmacode 2-track"),
false, false, true, false, "12345678", false, 8 );
false, false, false, false, "12345678", false, 8 );
registerStyle( "pzn", "zint", tr("Pharmazentral Nummer (PZN)"),
true, true, true, false, "123456", false, 6 );
registerStyle( "pzn", "zint", tr("Pharmazentralnummer (PZN)"),
true, true, true, false, "1234567", false, 7 );
registerStyle( "qr", "zint", tr("QR Code"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "rm4", "zint", tr("Royal Mail 4-State"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "rmqr", "zint", tr("rMQR (Rectangular Micro QR)"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "rm4", "zint", tr("Royal Mail 4-State Customer"),
false, false, true, false, "0000000000", true, 10 );
registerStyle( "rm4sm", "zint", tr("Royal Mail 4-State Mailmark"),
false, false, true, false, "01000000000000000AA00AA0A", true, 25 );
registerStyle( "rm2dm", "zint", tr("Royal Mail 2-D Mailmark"),
false, false, true, false, "012100123412345678AB19XY1A 0", true, 28 );
registerStyle( "tele", "zint", tr("Telepen"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "telex", "zint", tr("Telepen Numeric"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "pls", "zint", tr("UK Plessey"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "upc-a", "zint", tr("UPC-A"),
true, true, true, false, "12345678901", false, 11 );
registerStyle( "upc-e", "zint", tr("UPC-E"),
true, true, true, false, "1234567", false, 7 );
registerStyle( "usps", "zint", tr("USPS One Code"),
registerStyle( "upus10", "zint", tr("UPU S10"),
true, true, true, false, "EE876543216CA", false, 13 );
registerStyle( "usps", "zint", tr("USPS Intelligent Mail"),
false, false, true, false, "12345678901234567890", true, 20 );
registerStyle( "pls", "zint", tr("UK Plessey"),
true, true, true, false, "0000000000", true, 10 );
registerStyle( "vin", "zint", tr("VIN (Vehicle ID Number)"),
true, true, true, false, "12345678701234567", false, 27 );
#endif // HAVE_ZINT
}
+1
View File
@@ -19,6 +19,7 @@ endif ()
if (${LIBZINT_FOUND})
add_definitions (-DHAVE_ZINT=1)
add_definitions (-DHAVE_ZINT=1 -DLIBZINT_VERSION=${LIBZINT_VERSION})
set (OPTIONAL_ZINT ZINT::ZINT)
else ()
set (OPTIONAL_ZINT "")
+387 -28
View File
@@ -31,6 +31,7 @@ namespace
const double FONT_SCALE = 0.9;
const int W_PTS_DEFAULT = 144;
const int H_PTS_DEFAULT = 72;
const double TWO_DIVIDED_BY_SQRT3 = 1.15470053837925152902;
}
@@ -42,6 +43,14 @@ namespace glabels
{
//
// Base constructor
//
Base::Base() : symbology(0), option_2(0)
{
}
//
// Zint barcode data validation method
//
@@ -63,31 +72,24 @@ namespace glabels
/*
* First encode using Zint barcode library.
*/
if ( w == 0 )
{
w = W_PTS_DEFAULT;
}
if ( h == 0 )
{
h = H_PTS_DEFAULT;
}
zint_symbol* symbol = ZBarcode_Create();;
zint_symbol* symbol = ZBarcode_Create();
symbol->symbology = symbology;
symbol->input_mode = UNICODE_MODE;
symbol->scale = 0.5f; // Pixels
symbol->option_2 = option_2; // Currently just check digit
symbol->show_hrt = showText();
if ( ZBarcode_Encode( symbol, (unsigned char*)(cookedData.c_str()), 0 ) != 0 )
if ( ZBarcode_Encode( symbol, (unsigned char*)(cookedData.c_str()), 0 ) >= 5 /*ZINT_ERROR*/ )
{
qDebug() << "Zint::ZBarcode_Encode: " << QString(symbol->errtxt);
setIsDataValid( false );
return;
}
symbol->show_hrt = showText();
if ( ZBarcode_Render( symbol, (float)w, (float)h ) == 0 )
if ( ZBarcode_Buffer_Vector( symbol, 0 ) >= 5 /*ZINT_ERROR*/ )
{
qDebug() << "Zint::ZBarcode_Render: " << QString(symbol->errtxt);
qDebug() << "Zint::ZBarcode_Buffer_Vector: " << QString(symbol->errtxt);
setIsDataValid( false );
return;
}
@@ -96,32 +98,73 @@ namespace glabels
/*
* Now do the actual vectorization.
*/
zint_render *render = symbol->rendered;
zint_vector *vector = symbol->vector;
setWidth( render->width );
setHeight( render->height );
w = std::max( w, 5.0 ); // TODO: proper minimum
h = std::max( h, 5.0 ); // TODO: proper minimum
for ( zint_render_line *zline = render->lines; zline != nullptr; zline = zline->next )
if ( ZBarcode_Cap( symbol->symbology, ZINT_CAP_FIXED_RATIO ) & ZINT_CAP_FIXED_RATIO )
{
addBox( zline->x, zline->y, zline->width, zline->length );
if ( vector->width == vector->height )
{
w = h = std::min(w, h);
}
else
{
// Keep aspect ratio
if ( h < w )
{
w = h * vector->width / vector->height;
}
else
{
h = w * vector->height / vector->width;
}
}
}
for ( zint_render_ring *zring = render->rings; zring != nullptr; zring = zring->next )
double xscale = w / vector->width;
double yscale = h / vector->height;
setWidth( vector->width*xscale );
setHeight( vector->height*yscale );
for ( zint_vector_rect *zrect = vector->rectangles; zrect != nullptr; zrect = zrect->next )
{
addRing( zring->x, zring->y, zring->radius, zring->line_width );
addBox( zrect->x*xscale,
zrect->y*yscale,
zrect->width*xscale,
zrect->height*yscale );
}
for ( zint_render_hexagon *zhexagon = render->hexagons; zhexagon != nullptr; zhexagon = zhexagon->next )
for ( zint_vector_circle *zcircle = vector->circles; zcircle != nullptr; zcircle = zcircle->next )
{
addHexagon( zhexagon->x, zhexagon->y, 2.89 );
double line_width = zcircle->width*xscale;
addRing( zcircle->x*xscale,
zcircle->y*yscale,
zcircle->diameter*xscale/2,
line_width );
}
for ( zint_vector_hexagon *zhexagon = vector->hexagons; zhexagon != nullptr; zhexagon = zhexagon->next )
{
// Convert from Zint's horizontal short diameter (X) to vertical long diameter (V).
double h = TWO_DIVIDED_BY_SQRT3*zhexagon->diameter*yscale;
addHexagon( zhexagon->x*xscale, // Center x same as apex x
zhexagon->y*yscale - h/2, // Subtract radius to convert from center y to apex y
h );
}
if( showText() )
{
for ( zint_render_string *zstring = render->strings; zstring != nullptr; zstring = zstring->next )
for ( zint_vector_string *zstring = vector->strings; zstring != nullptr; zstring = zstring->next )
{
double fsize = FONT_SCALE*zstring->fsize;
addText( zstring->x, zstring->y+0.75*fsize, fsize, QString((char*)(zstring->text)).toStdString() );
auto halign = static_cast<glbarcode::HAlign>(zstring->halign); // zint values match glbarcode enum
addText( zstring->x*xscale,
zstring->y*yscale,
zstring->fsize*std::min( xscale, yscale ), // TODO: do something better here
std::string((const char*)zstring->text),
halign );
}
}
@@ -223,6 +266,22 @@ namespace glabels
symbology = BARCODE_AZRUNE;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Channel Code Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Channel::create()
{
return new Channel();
}
std::string Channel::encode( const std::string& cookedData )
{
symbology = BARCODE_CHANNEL;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -237,6 +296,26 @@ namespace glabels
std::string Cbr::encode( const std::string& cookedData )
{
symbology = BARCODE_CODABAR;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Codablock-F Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Cblockf::create()
{
return new Cblockf();
}
std::string Cblockf::encode( const std::string& cookedData )
{
symbology = BARCODE_CODABLOCKF;
return ""; // Actual encoding is done in vectorize
}
@@ -269,6 +348,10 @@ namespace glabels
std::string Code11::encode( const std::string& cookedData )
{
symbology = BARCODE_CODE11;
if (!checksum()) // Note default is 2 visible check digits
{
option_2 = 2;
}
return ""; // Actual encoding is done in vectorize
}
@@ -300,7 +383,11 @@ namespace glabels
std::string C25m::encode( const std::string& cookedData )
{
symbology = BARCODE_C25MATRIX;
symbology = BARCODE_C25MATRIX; // BARCODE_C25STANDARD
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -317,6 +404,30 @@ namespace glabels
std::string C25i::encode( const std::string& cookedData )
{
symbology = BARCODE_C25IATA;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Code 2 of 5 Industrial Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* C25ind::create()
{
return new C25ind();
}
std::string C25ind::encode( const std::string& cookedData )
{
symbology = BARCODE_C25IND;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -333,6 +444,10 @@ namespace glabels
std::string C25dl::encode( const std::string& cookedData )
{
symbology = BARCODE_C25LOGIC;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -365,6 +480,10 @@ namespace glabels
std::string Code39::encode( const std::string& cookedData )
{
symbology = BARCODE_CODE39;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -381,6 +500,10 @@ namespace glabels
std::string Code39e::encode( const std::string& cookedData )
{
symbology = BARCODE_EXCODE39;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -511,6 +634,38 @@ namespace glabels
symbology = BARCODE_DPIDENT;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// DotCode Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Dotcode::create()
{
return new Dotcode();
}
std::string Dotcode::encode( const std::string& cookedData )
{
symbology = BARCODE_DOTCODE;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// DPD Code Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Dpd::create()
{
return new Dpd();
}
std::string Dpd::encode( const std::string& cookedData )
{
symbology = BARCODE_DPD;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -543,6 +698,70 @@ namespace glabels
symbology = BARCODE_EANX;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// EAN-14 Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Ean14::create()
{
return new Ean14();
}
std::string Ean14::encode( const std::string& cookedData )
{
symbology = BARCODE_EAN14;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Facing Identification Mark Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Fim::create()
{
return new Fim();
}
std::string Fim::encode( const std::string& cookedData )
{
symbology = BARCODE_FIM;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Flattermarken Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Flat::create()
{
return new Flat();
}
std::string Flat::encode( const std::string& cookedData )
{
symbology = BARCODE_FLAT;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Han Xin Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Hanxin::create()
{
return new Hanxin();
}
std::string Hanxin::encode( const std::string& cookedData )
{
symbology = BARCODE_HANXIN;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -639,6 +858,22 @@ namespace glabels
symbology = BARCODE_HIBC_MICPDF;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// HIBC Codablock-F Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Hibcblkf::create()
{
return new Hibcblkf();
}
std::string Hibcblkf::encode( const std::string& cookedData )
{
symbology = BARCODE_HIBC_BLOCKF;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -669,6 +904,10 @@ namespace glabels
std::string I25::encode( const std::string& cookedData )
{
symbology = BARCODE_C25INTER;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -749,6 +988,10 @@ namespace glabels
std::string Logm::encode( const std::string& cookedData )
{
symbology = BARCODE_LOGMARS;
if (checksum())
{
option_2 = 1;
}
return ""; // Actual encoding is done in vectorize
}
@@ -1005,6 +1248,10 @@ namespace glabels
std::string Msi::encode( const std::string& cookedData )
{
symbology = BARCODE_MSI_PLESSEY;
if (checksum())
{
option_2 = 1; // 1 visible mod-10 check digit
}
return ""; // Actual encoding is done in vectorize
}
@@ -1071,6 +1318,38 @@ namespace glabels
symbology = BARCODE_POSTNET;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// BC412 (SEMI T1-95) Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Bc412::create()
{
return new Bc412();
}
std::string Bc412::encode( const std::string& cookedData )
{
symbology = BARCODE_BC412;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// CEPNet Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Cepnet::create()
{
return new Cepnet();
}
std::string Cepnet::encode( const std::string& cookedData )
{
symbology = BARCODE_CEPNET;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -1119,6 +1398,22 @@ namespace glabels
symbology = BARCODE_QRCODE;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// rMQR Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Rmqr::create()
{
return new Rmqr();
}
std::string Rmqr::encode( const std::string& cookedData )
{
symbology = BARCODE_RMQR;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -1135,6 +1430,38 @@ namespace glabels
symbology = BARCODE_RM4SCC;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Royal Mail 4-State Mailmark Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Rm4sm::create()
{
return new Rm4sm();
}
std::string Rm4sm::encode( const std::string& cookedData )
{
symbology = BARCODE_MAILMARK; // BARCODE_MAILMARK_4S
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Royal Mail 2-D Mailmark Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Rm2dm::create()
{
return new Rm2dm();
}
std::string Rm2dm::encode( const std::string& cookedData )
{
symbology = BARCODE_MAILMARK_2D;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -1167,6 +1494,22 @@ namespace glabels
symbology = BARCODE_UPCE;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// UPU S10 Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* UpuS10::create()
{
return new UpuS10();
}
std::string UpuS10::encode( const std::string& cookedData )
{
symbology = BARCODE_UPU_S10;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
@@ -1199,6 +1542,22 @@ namespace glabels
symbology = BARCODE_PLESSEY;
return ""; // Actual encoding is done in vectorize
}
//////////////////////////////////////////////////////
// Vehicle Identification Number Barcode
//////////////////////////////////////////////////////
glbarcode::Barcode* Vin::create()
{
return new Vin();
}
std::string Vin::encode( const std::string& cookedData )
{
symbology = BARCODE_VIN;
return ""; // Actual encoding is done in vectorize
}
}
+226 -2
View File
@@ -42,8 +42,11 @@ namespace glabels
{
protected:
int symbology;
int option_2;
Base();
bool validate( const std::string& rawData ) override;
void vectorize( const std::string& encodedData,
@@ -132,6 +135,19 @@ namespace glabels
};
/**
* Channel Barcode
*/
class Channel : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Cbr Barcode
*/
@@ -145,6 +161,19 @@ namespace glabels
};
/**
* Codeblock-F Barcode
*/
class Cblockf : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Code1 Barcode
*/
@@ -210,6 +239,19 @@ namespace glabels
};
/**
* Code 2 of 5 Industrial Barcode
*/
class C25ind : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* C25dl Barcode
*/
@@ -366,6 +408,32 @@ namespace glabels
};
/**
* DotCode Barcode
*/
class Dotcode : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* DPD Code Barcode
*/
class Dpd : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Kix Barcode
*/
@@ -392,6 +460,58 @@ namespace glabels
};
/**
* EAN-14 Barcode
*/
class Ean14 : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Facing Identification Mark Barcode
*/
class Fim : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Flattermarken Barcode
*/
class Flat : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Han Xin Barcode
*/
class Hanxin : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Hibc128 Barcode
*/
@@ -470,6 +590,19 @@ namespace glabels
};
/**
* HIBC Codablock-F Barcode
*/
class Hibcblkf : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Hibcaz Barcode
*/
@@ -821,6 +954,32 @@ namespace glabels
};
/**
* BC412 (SEMI T1-95) Barcode
*/
class Bc412 : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* CEPNet Barcode
*/
class Cepnet : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Pdf Barcode
*/
@@ -860,6 +1019,19 @@ namespace glabels
};
/**
* rMQR Barcode
*/
class Rmqr : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Rm4 Barcode
*/
@@ -873,6 +1045,32 @@ namespace glabels
};
/**
* Royal Mail 4-State Mailmark Barcode
*/
class Rm4sm : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Royal Mail 2-D Mailmark Barcode
*/
class Rm2dm : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* UpcA Barcode
*/
@@ -899,6 +1097,19 @@ namespace glabels
};
/**
* UPU S10 Barcode
*/
class UpuS10 : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
/**
* Usps Barcode
*/
@@ -925,6 +1136,19 @@ namespace glabels
};
/**
* Vehicle Identification Number Barcode
*/
class Vin : public Base
{
public:
static Barcode* create();
protected:
std::string encode( const std::string& cookedData ) override;
};
}
}
}