Fleshed out GNU Barcode EAN barcodes.
This commit is contained in:
@@ -79,10 +79,28 @@ namespace glabels
|
||||
//
|
||||
registerBackend( "gnu-barcode", "GNU Barcode" );
|
||||
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean", GnuBarcode::Ean::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean", GnuBarcode::Ean::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-8", GnuBarcode::Ean8::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-8+2", GnuBarcode::Ean8_2::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-8+5", GnuBarcode::Ean8_5::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-13", GnuBarcode::Ean13::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-13+2", GnuBarcode::Ean13_2::create );
|
||||
glbarcode::Factory::registerType( "gnu-barcode::ean-13+5", GnuBarcode::Ean13_5::create );
|
||||
|
||||
registerStyle( "ean", "gnu-barcode", tr("EAN (any)"),
|
||||
true, true, true, false, "000000000000 00000", false, 17 );
|
||||
registerStyle( "ean-8", "gnu-barcode", tr("EAN-8"),
|
||||
true, true, true, false, "0000000", false, 7 );
|
||||
registerStyle( "ean-8+2", "gnu-barcode", tr("EAN-8+2"),
|
||||
true, true, true, false, "0000000 00", false, 9 );
|
||||
registerStyle( "ean-8+5", "gnu-barcode", tr("EAN-8+5"),
|
||||
true, true, true, false, "0000000 00000", false, 12 );
|
||||
registerStyle( "ean-13", "gnu-barcode", tr("EAN-13"),
|
||||
true, true, true, false, "000000000000", false, 12 );
|
||||
registerStyle( "ean-13+2", "gnu-barcode", tr("EAN-13+2"),
|
||||
true, true, true, false, "000000000000 00", false, 14 );
|
||||
registerStyle( "ean-13+5", "gnu-barcode", tr("EAN-13+5"),
|
||||
true, true, true, false, "000000000000 00000", false, 17 );
|
||||
#endif // HAVE_GNU_BARCODE
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
@@ -344,7 +344,6 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean::create()
|
||||
{
|
||||
return new Ean();
|
||||
@@ -368,6 +367,121 @@ namespace glabels
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean8::create()
|
||||
{
|
||||
return new Ean8();
|
||||
}
|
||||
|
||||
|
||||
bool Ean8::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLengthValid( rawData, 7, 8 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean8::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean8_2::create()
|
||||
{
|
||||
return new Ean8_2();
|
||||
}
|
||||
|
||||
|
||||
bool Ean8_2::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLength1Valid( rawData, 7, 8 ) && isNumericLength2Valid( rawData, 2, 2 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean8_2::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean8_5::create()
|
||||
{
|
||||
return new Ean8_5();
|
||||
}
|
||||
|
||||
|
||||
bool Ean8_5::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLength1Valid( rawData, 7, 8 ) && isNumericLength2Valid( rawData, 5, 5 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean8_5::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean13::create()
|
||||
{
|
||||
return new Ean13();
|
||||
}
|
||||
|
||||
|
||||
bool Ean13::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLengthValid( rawData, 12, 13 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean13::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean13_2::create()
|
||||
{
|
||||
return new Ean13_2();
|
||||
}
|
||||
|
||||
|
||||
bool Ean13_2::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLength1Valid( rawData, 12, 13 ) && isNumericLength2Valid( rawData, 2, 2 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean13_2::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
glbarcode::Barcode* Ean13_5::create()
|
||||
{
|
||||
return new Ean13_5();
|
||||
}
|
||||
|
||||
|
||||
bool Ean13_5::validate( const std::string& rawData )
|
||||
{
|
||||
return isNumericLength1Valid( rawData, 12, 13 ) && isNumericLength2Valid( rawData, 5, 5 );
|
||||
}
|
||||
|
||||
|
||||
std::string Ean13_5::encode( const std::string& cookedData )
|
||||
{
|
||||
flags = BARCODE_EAN;
|
||||
return ""; // Actual encoding is done in vectorize
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,90 @@ namespace glabels
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8 Barcode
|
||||
*/
|
||||
class Ean8 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+2 Barcode
|
||||
*/
|
||||
class Ean8_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+5 Barcode
|
||||
*/
|
||||
class Ean8_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13 Barcode
|
||||
*/
|
||||
class Ean13 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+2 Barcode
|
||||
*/
|
||||
class Ean13_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+5 Barcode
|
||||
*/
|
||||
class Ean13_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -779,12 +779,37 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="84"/>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="90"/>
|
||||
<source>EAN (any)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="92"/>
|
||||
<source>EAN-8</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="94"/>
|
||||
<source>EAN-8+2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="96"/>
|
||||
<source>EAN-8+5</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="100"/>
|
||||
<source>EAN-13+2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="102"/>
|
||||
<source>EAN-13+5</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="114"/>
|
||||
<source>IEC18004 (QRCode)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -805,6 +830,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="52"/>
|
||||
<location filename="../glabels/BarcodeBackends.cpp" line="98"/>
|
||||
<source>EAN-13</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user