blob: 90611c005dced5667af76a2f58275255a209b38e [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_ONEDCODE39WRITER_H_
8#define FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
9
10#include "fxbarcode/BC_Library.h"
11#include "fxbarcode/oned/BC_OneDimWriter.h"
12
13class CBC_OnedCode39Writer : public CBC_OneDimWriter {
14 public:
15 CBC_OnedCode39Writer();
16 ~CBC_OnedCode39Writer() override;
17
18 // CBC_OneDimWriter
19 uint8_t* EncodeWithHint(const ByteString& contents,
20 BCFORMAT format,
21 int32_t& outWidth,
22 int32_t& outHeight,
23 int32_t hints) override;
24 uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
25 bool RenderResult(const WideStringView& contents,
26 uint8_t* code,
27 int32_t codeLength) override;
28 bool CheckContentValidity(const WideStringView& contents) override;
29 WideString FilterContents(const WideStringView& contents) override;
30 WideString RenderTextContents(const WideStringView& contents) override;
31
32 virtual bool SetTextLocation(BC_TEXT_LOC loction);
33 virtual bool SetWideNarrowRatio(int8_t ratio);
34
35 bool encodedContents(const WideStringView& contents, WideString* result);
36
37 private:
38 void ToIntArray(int16_t a, int8_t* toReturn);
39 char CalcCheckSum(const ByteString& contents);
40
41 int8_t m_iWideNarrRatio;
42};
43
44#endif // FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_