• 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_ONED_BC_ONEDCODABARWRITER_H_
8 #define FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
9 
10 #include "core/fxcrt/fx_string.h"
11 #include "core/fxcrt/fx_system.h"
12 #include "fxbarcode/BC_Library.h"
13 #include "fxbarcode/oned/BC_OneDimWriter.h"
14 
15 class CBC_OnedCodaBarWriter final : public CBC_OneDimWriter {
16  public:
17   CBC_OnedCodaBarWriter();
18   ~CBC_OnedCodaBarWriter() override;
19 
20   // CBC_OneDimWriter
21   uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
22   uint8_t* EncodeWithHint(const ByteString& contents,
23                           BCFORMAT format,
24                           int32_t& outWidth,
25                           int32_t& outHeight,
26                           int32_t hints) override;
27   bool RenderResult(WideStringView contents,
28                     uint8_t* code,
29                     int32_t codeLength) override;
30   bool CheckContentValidity(WideStringView contents) override;
31   WideString FilterContents(WideStringView contents) override;
32   void SetDataLength(int32_t length) override;
33   bool SetTextLocation(BC_TEXT_LOC location) override;
34   bool SetWideNarrowRatio(int8_t ratio) override;
35   bool SetStartChar(char start) override;
36   bool SetEndChar(char end) override;
37 
38   virtual bool FindChar(wchar_t ch, bool isContent);
39 
40   WideString encodedContents(WideStringView contents);
41 
42  private:
43   char m_chStart = 'A';
44   char m_chEnd = 'B';
45   int8_t m_iWideNarrRatio = 2;
46 };
47 
48 #endif  // FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
49