Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fxbarcode / src / include / BC_HighLevelEncoder.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _BC_HIGHLEVALENCODER_H_\r
8 #define _BC_HIGHLEVALENCODER_H_\r
9 class CBC_SymbolShapeHint;\r
10 class CBC_HighLevelEncoder;\r
11 #define  ASCII_ENCODATION     0\r
12 #define  C40_ENCODATION       1\r
13 #define  TEXT_ENCODATION      2\r
14 #define  X12_ENCODATION       3\r
15 #define  EDIFACT_ENCODATION   4\r
16 #define  BASE256_ENCODATION   5\r
17 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint\r
18 {\r
19 public:\r
20     CBC_HighLevelEncoder();\r
21     virtual ~CBC_HighLevelEncoder();\r
22     CFX_ByteArray& getBytesForMessage(CFX_WideString msg);\r
23     static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, FX_INT32 &e);\r
24     static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_INT32 &e);\r
25     static FX_INT32 lookAheadTest(CFX_WideString msg, FX_INT32 startpos, FX_INT32 currentMode);\r
26     static FX_BOOL isDigit(FX_WCHAR ch);\r
27     static FX_BOOL isExtendedASCII(FX_WCHAR ch);\r
28     static FX_INT32 determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos);\r
29     static void illegalCharacter(FX_WCHAR c, FX_INT32 &e);\r
30 \r
31 public:\r
32     static FX_WCHAR LATCH_TO_C40;\r
33     static FX_WCHAR LATCH_TO_BASE256;\r
34     static FX_WCHAR UPPER_SHIFT;\r
35     static FX_WCHAR LATCH_TO_ANSIX12;\r
36     static FX_WCHAR LATCH_TO_TEXT;\r
37     static FX_WCHAR LATCH_TO_EDIFACT;\r
38     static FX_WCHAR C40_UNLATCH;\r
39     static FX_WCHAR X12_UNLATCH;\r
40 private:\r
41     static FX_WCHAR PAD;\r
42     static FX_WCHAR MACRO_05;\r
43     static FX_WCHAR MACRO_06;\r
44     static const wchar_t* MACRO_05_HEADER;\r
45     static const wchar_t* MACRO_06_HEADER;\r
46     static const wchar_t MACRO_TRAILER;\r
47     CFX_ByteArray m_bytearray;\r
48 private:\r
49     static FX_WCHAR randomize253State(FX_WCHAR ch, FX_INT32 codewordPosition);\r
50     static FX_INT32 findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intCharCounts, FX_INT32 min, CFX_ByteArray &mins);\r
51     static FX_INT32 getMinimumCount(CFX_ByteArray &mins);\r
52     static FX_BOOL isNativeC40(FX_WCHAR ch);\r
53     static FX_BOOL isNativeText(FX_WCHAR ch);\r
54     static FX_BOOL isNativeX12(FX_WCHAR ch);\r
55     static FX_BOOL isX12TermSep(FX_WCHAR ch);\r
56     static FX_BOOL isNativeEDIFACT(FX_WCHAR ch);\r
57     static FX_BOOL isSpecialB256(FX_WCHAR ch);\r
58 \r
59 };\r
60 #endif\r