import { BCGBarcode1D, draw, BCGDataInput } from 'barcode-bakery-common'; /** * Constructor. * * @param char start */ declare class BCGcode128 extends BCGBarcode1D { private static readonly KEYA_FNC3; private static readonly KEYA_FNC2; private static readonly KEYA_SHIFT; private static readonly KEYA_CODEC; private static readonly KEYA_CODEB; private static readonly KEYA_FNC4; private static readonly KEYA_FNC1; private static readonly KEYB_FNC3; private static readonly KEYB_FNC2; private static readonly KEYB_SHIFT; private static readonly KEYB_CODEC; private static readonly KEYB_FNC4; private static readonly KEYB_CODEA; private static readonly KEYB_FNC1; private static readonly KEYC_CODEB; private static readonly KEYC_CODEA; private static readonly KEYC_FNC1; private static readonly KEY_STARTA; private static readonly KEY_STARTB; private static readonly KEY_STARTC; private static readonly KEY_STOP; /** * The keys for the table A. */ protected keysA: string; /** * The keys for the table B. */ protected keysB: string; /** * The keys for the table C. */ protected keysC: string; private startingText; /** * The encoded data. */ protected data: string[] | null; /** * Data for handling the checksum. */ protected indcheck: number[] | null; /** * The last table used. */ protected lastTable: string | null; /** * Indicates if we are in tilde mode. */ protected tilde: boolean; private readonly shift; private readonly latch; private readonly fnc; private METHOD; constructor(start?: string | null); /** * Specifies the start code. Can be 'A', 'B', 'C', or NULL * - Table A: Capitals + ASCII 0-31 + punct * - Table B: Capitals + LowerCase + punct * - Table C: Numbers * * If NULL is specified, the table selection is automatically made. * The default is NULL. * * @param table The table. */ setStart(table: string | null): void; /** * Gets the tilde. * * @return True if enabled. */ getTilde(): boolean; /** * Accepts tilde to be process as a special character. * If true, you can do this: * - ~~ : to make ONE tilde * - ~Fx : to insert FCNx. x is equal from 1 to 4. * * @param accept Accept the tilde as special character. */ setTilde(accept: boolean): void; /** * Parses the text before displaying it. * * @param text The input. */ parse(text: BCGDataInput | BCGDataInput[] | string): void; private invokeSetParse; /** * Draws the barcode. * * @param image The surface. */ draw(image: draw.Surface): void; /** * Returns the maximal size of a barcode. * [0]->width * [1]->height * * @param width The width. * @param height The height. * @return An array, [0] being the width, [1] being the height. */ getDimension(width: number, height: number): [number, number]; /** * Validates the input. */ protected validate(): void; /** * Overloaded method to calculate checksum. */ protected calculateChecksum(): void; /** * Overloaded method to display the checksum. * * @return The checksum value. */ protected processChecksum(): string | null; /** * Specifies the startingText table if none has been specified earlier. * * @param mode The mode. * @param text The input. */ private setStartFromText; /** * Extracts the ~ value from the text at the pos. * If the tilde is not ~~, ~F1, ~F2, ~F3, ~F4; an error is raised. * * @param text The text. * @param pos The position. * @return Extracted tilde value. */ private extractTilde; /** * Gets the "dotted" sequence for the text based on the currentMode. * There is also a check if we use the special tilde ~ * * @param text The text. * @param currentMode The current mode. * @return The sequence. */ private getSequenceParsed; /** * Parses the text and returns the appropriate sequence for the Table A. * * @param text The text. * @param currentMode The current mode. * @return The sequence. */ private setParseA; /** * Parses the text and returns the appropriate sequence for the Table B. * * @param text The text. * @param currentMode The current mode. * @return The sequence. */ setParseB(text: string, currentMode: string | null): { value: string; currentMode: string; }; /** * Parses the text and returns the appropriate sequence for the Table C. * * @param text The text. * @param currentMode The current mode. * @return The sequence. */ setParseC(text: string, currentMode: string | null): { value: string; currentMode: string; }; /** * Depending on the text, it will return the correct * sequence to encode the text. * * @param text The text. * @param startingText The starting text. * @return The sequence. */ private getSequence; /** * Depending on the sequence seq given (returned from getSequence()), * this method will return the code stream in an array. Each char will be a * string of bit based on the Code 128. * * Each letter from the sequence represents bits. * * 0 to 2 are latches * A to B are Shift + Letter * . is a char in the current encoding * * @param text The text. * @param seq The sequence. * @return The stream. */ private createBinaryStream; /** * Encodes characters, base on its encoding and sequence * * @param data The data. * @param encoding The encoding. * @param seq The sequence. * @param text The text. * @param i The position. * @param counter The counter. * @param indcheck The checksum counter. */ private encodeChar; /** * Saves data into the classes. * * This method will save data, calculate real column number * (if -1 was selected), the real error level (if -1 was * selected)... It will add Padding to the end and generate * the error codes. * * @param data The data. */ private setData; } declare namespace BCGcode128 { enum Code { /** * Auto selection. */ Auto = 0, /** * Table A. */ A = 1, /** * Table B. */ B = 2, /** * Table C. */ C = 3 } } export { BCGcode128 };