• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The PDFium Authors
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_CBC_CODEBASE_H_
8 #define FXBARCODE_CBC_CODEBASE_H_
9 
10 #include <stdint.h>
11 
12 #include <memory>
13 
14 #include "core/fxcrt/widestring.h"
15 #include "core/fxge/dib/fx_dib.h"
16 #include "fxbarcode/BC_Library.h"
17 
18 class CBC_Writer;
19 class CFX_Matrix;
20 class CFX_RenderDevice;
21 
22 class CBC_CodeBase {
23  public:
24   explicit CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter);
25   virtual ~CBC_CodeBase();
26 
27   virtual BC_TYPE GetType() = 0;
28   virtual bool Encode(WideStringView contents) = 0;
29   virtual bool RenderDevice(CFX_RenderDevice* device,
30                             const CFX_Matrix& matrix) = 0;
31 
32   void SetTextLocation(BC_TEXT_LOC location);
33   bool SetWideNarrowRatio(int8_t ratio);
34   bool SetStartChar(char start);
35   bool SetEndChar(char end);
36   bool SetErrorCorrectionLevel(int32_t level);
37   void SetCharEncoding(BC_CHAR_ENCODING encoding);
38   bool SetModuleHeight(int32_t moduleHeight);
39   bool SetModuleWidth(int32_t moduleWidth);
40   void SetHeight(int32_t height);
41   void SetWidth(int32_t width);
42 
43  protected:
44   std::unique_ptr<CBC_Writer> m_pBCWriter;
45 };
46 
47 #endif  // FXBARCODE_CBC_CODEBASE_H_
48