blob: 3edb65a72a019863831afa8a23b2f5fb1847e800 [file] [log] [blame]
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -07001// 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_ONEDCODE128WRITER_H_
8#define FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
9
10#include <vector>
11
12#include "core/fxcrt/fx_string.h"
13#include "core/fxcrt/fx_system.h"
14#include "fxbarcode/oned/BC_OneDimWriter.h"
15
16class CBC_OnedCode128Writer : public CBC_OneDimWriter {
17 public:
18 explicit CBC_OnedCode128Writer(BC_TYPE type);
19 ~CBC_OnedCode128Writer() override;
20
21 // Exposed for testing.
22 static int32_t Encode128B(const ByteString& contents,
23 std::vector<int32_t>* patterns);
24 static int32_t Encode128C(const ByteString& contents,
25 std::vector<int32_t>* patterns);
26
27 // CBC_OneDimWriter
28 uint8_t* EncodeWithHint(const ByteString& contents,
29 BCFORMAT format,
30 int32_t& outWidth,
31 int32_t& outHeight,
32 int32_t hints) override;
33 uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
34 bool CheckContentValidity(const WideStringView& contents) override;
35 WideString FilterContents(const WideStringView& contents) override;
36
37 bool SetTextLocation(BC_TEXT_LOC location);
38
39 BC_TYPE GetType() const { return m_codeFormat; }
40
41 private:
42 const BC_TYPE m_codeFormat;
43};
44
45#endif // FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_