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_ONEDCODE39WRITER_H_ 8 #define FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_ 9 10 #include "fxbarcode/BC_Library.h" 11 #include "fxbarcode/oned/BC_OneDimWriter.h" 12 13 class CBC_OnedCode39Writer final : 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(WideStringView contents, 26 uint8_t* code, 27 int32_t codeLength) override; 28 bool CheckContentValidity(WideStringView contents) override; 29 WideString FilterContents(WideStringView contents) override; 30 bool SetTextLocation(BC_TEXT_LOC location) override; 31 bool SetWideNarrowRatio(int8_t ratio) override; 32 33 WideString RenderTextContents(WideStringView contents); 34 bool encodedContents(WideStringView contents, WideString* result); 35 36 private: 37 void ToIntArray(int16_t a, int8_t* toReturn); 38 char CalcCheckSum(const ByteString& contents); 39 40 int8_t m_iWideNarrRatio = 3; 41 }; 42 43 #endif // FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_ 44