Incorporated glbarcode library into source tree.

This commit is contained in:
Jim Evins
2017-04-09 19:14:13 -04:00
parent 76bd5a0c6b
commit b17cea7ace
47 changed files with 6290 additions and 0 deletions
+98
View File
@@ -0,0 +1,98 @@
/* BarcodePostnet.h
*
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
*
* This file is part of glbarcode++.
*
* glbarcode++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* glbarcode++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with glbarcode++. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef glbarcode_BarcodePostnet_h
#define glbarcode_BarcodePostnet_h
#include "Barcode1dBase.h"
namespace glbarcode
{
/**
* @class BarcodePostnet BarcodePostnet.h glbarcode/BarcodePostnet.h
*
* *POSTNET* barcode (All USPS sizes: ZIP, ZIP+4, ZIP+4+DC).
*
* @image html sample-postnet.svg "Sample USPS POSTNET Barcode"
*
*
* ### Input Data Format ###
*
* The *POSTNET* specification defines 10 characters, consisting solely
* of decimal digits (0-9). The BarcodePostnet validator and encoder will
* ignore spaces and dashes (-). The validator will only accept input
* data with 5 digits (ZIP), 9 digits (ZIP+4) or 11 digits (ZIP+4+DC).
*
*
* ### Checksum Property ###
*
* The *checksum* property is ignored. A mandatory check digit will
* always be automatically generated and appended to the input data
* prior to encoding.
*
*
* ### Show Text Property ###
*
* The *Show Text* property is ignored.
*
*
* ### References ###
*
* - http://en.wikipedia.org/wiki/POSTNET
*
*/
class BarcodePostnet : public Barcode1dBase
{
public:
/**
* Static Postnet barcode creation method
*
* Used by glbarcode::BarcodeFactory
*/
static Barcode* create( void );
protected:
/**
* Validate number of digits
*/
virtual bool validateDigits( int nDigits );
private:
bool validate( const std::string& rawData );
std::string encode( const std::string& cookedData );
void vectorize( const std::string& codedData,
const std::string& displayText,
const std::string& cookedData,
double& w,
double& h );
};
}
#endif // glbarcode_BarcodePostnet_h