xref: /aosp_15_r20/external/pdfium/fxbarcode/oned/BC_OnedCode128Writer.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 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_ONED_BC_ONEDCODE128WRITER_H_
8 #define FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
9 
10 #include <stdint.h>
11 
12 #include <vector>
13 
14 #include "core/fxcrt/fx_string.h"
15 #include "fxbarcode/BC_Library.h"
16 #include "fxbarcode/oned/BC_OneDimWriter.h"
17 
18 class CBC_OnedCode128Writer final : public CBC_OneDimWriter {
19  public:
20   explicit CBC_OnedCode128Writer(BC_TYPE type);
21   ~CBC_OnedCode128Writer() override;
22 
23   // Exposed for testing.
24   static int32_t Encode128B(const ByteString& contents,
25                             std::vector<int32_t>* patterns);
26   static int32_t Encode128C(const ByteString& contents,
27                             std::vector<int32_t>* patterns);
28 
29   // CBC_OneDimWriter
30   DataVector<uint8_t> Encode(const ByteString& contents) override;
31   bool CheckContentValidity(WideStringView contents) override;
32   WideString FilterContents(WideStringView contents) override;
33   void SetTextLocation(BC_TEXT_LOC location) override;
34 
GetType()35   BC_TYPE GetType() const { return m_codeFormat; }
36 
37  private:
38   const BC_TYPE m_codeFormat;
39 };
40 
41 #endif  // FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
42