| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #pragma once
- #ifndef _EANBARCODE_H_
- #define _EANBARCODE_H_
- //////////////////////////////////////////////////
- // //
- // http://www.barcodeisland.com/ean13.phtml //
- // //
- //////////////////////////////////////////////////
- #define MAX_BARCODE_LENGTH 13
- // binary representation of numbers in EAN
- extern char* szEANs [10];
- class CEANBarCode
- {
- protected:
- // data
- // the code
- char m_szCode[MAX_BARCODE_LENGTH+1];
- protected:
- // methods
- // Check the validity of a the code
- bool CheckCode(void);
- // Get a Number in the code by its position
- int GetAt(int Position);
- // Gets the binary string representing the left part of the code when even parity
- CString GetLeftEven(int Digit);
- // Gets the binary string representing the right part of the code
- CString GetRight(int Digit);
- // Gets the binary string representing the left part of the code when odd parity
- CString GetLeftOdd(int Digit);
- public:
- // Accessors
- void SetCode(CString Code);
- CString GetCode();
- public:
- // operations
- // Draws the code using the specified DC and the rectangle
- void Draw(CPaintDC &dc);
- public:
- CEANBarCode(void);
- ~CEANBarCode(void);
- private:
- // reverse a String
- void ReverseString(CString &str);
- };
- #endif
|