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_ONED_BC_ONEDUPCAWRITER_H_
8 #define FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "fxbarcode/oned/BC_OnedEANWriter.h"
15 
16 class CBC_OnedEAN13Writer;
17 class CFX_DIBitmap;
18 class CFX_Matrix;
19 class CFX_RenderDevice;
20 
21 class CBC_OnedUPCAWriter final : public CBC_OneDimEANWriter {
22  public:
23   CBC_OnedUPCAWriter();
24   ~CBC_OnedUPCAWriter() override;
25 
26   // CBC_OneDimEANWriter:
27   uint8_t* EncodeWithHint(const ByteString& contents,
28                           BCFORMAT format,
29                           int32_t& outWidth,
30                           int32_t& outHeight,
31                           int32_t hints) override;
32   uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
33   bool CheckContentValidity(WideStringView contents) override;
34   WideString FilterContents(WideStringView contents) override;
35   void InitEANWriter() override;
36   int32_t CalcChecksum(const ByteString& contents) override;
37 
38  private:
39   bool ShowChars(WideStringView contents,
40                  CFX_RenderDevice* device,
41                  const CFX_Matrix* matrix,
42                  int32_t barWidth,
43                  int32_t multiple) override;
44 
45   std::unique_ptr<CBC_OnedEAN13Writer> m_subWriter;
46 };
47 
48 #endif  // FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
49