• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
8 #define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
9 
10 #include "core/fxcrt/unowned_ptr.h"
11 #include "core/fxcrt/widestring.h"
12 
13 class CBC_SymbolInfo;
14 
15 class CBC_EncoderContext {
16  public:
17   CBC_EncoderContext(const WideString& msg,
18                      const WideString& ecLevel,
19                      int32_t& e);
20   ~CBC_EncoderContext();
21 
22   void setAllowRectangular(bool allow);
23   void setSkipAtEnd(int32_t count);
24   wchar_t getCurrentChar();
25   wchar_t getCurrent();
26   void writeCodewords(const WideString& codewords);
27   void writeCodeword(wchar_t codeword);
28   size_t getCodewordCount();
29   void signalEncoderChange(int32_t encoding);
30   void resetEncoderSignal();
31   bool hasMoreCharacters();
32   size_t getRemainingCharacters();
33   void updateSymbolInfo(int32_t& e);
34   void updateSymbolInfo(int32_t len, int32_t& e);
35   void resetSymbolInfo();
36 
37   WideString m_msg;
38   WideString m_codewords;
39   size_t m_pos;
40   int32_t m_newEncoding;
41   UnownedPtr<CBC_SymbolInfo> m_symbolInfo;
42 
43  private:
44   size_t getTotalMessageCharCount();
45 
46   bool m_allowRectangular;  // Force square when false.
47   size_t m_skipAtEnd;
48 };
49 
50 #endif  // FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
51