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_ONEDCODE39WRITER_H_ 8 #define FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_ 9 10 #include <stddef.h> 11 12 #include "fxbarcode/BC_Library.h" 13 #include "fxbarcode/oned/BC_OneDimWriter.h" 14 15 class CBC_OnedCode39Writer final : public CBC_OneDimWriter { 16 public: 17 CBC_OnedCode39Writer(); 18 ~CBC_OnedCode39Writer() override; 19 20 // CBC_OneDimWriter 21 DataVector<uint8_t> Encode(const ByteString& contents) override; 22 bool RenderResult(WideStringView contents, 23 pdfium::span<const uint8_t> code) override; 24 bool CheckContentValidity(WideStringView contents) override; 25 WideString FilterContents(WideStringView contents) override; 26 void SetTextLocation(BC_TEXT_LOC location) override; 27 bool SetWideNarrowRatio(int8_t ratio) override; 28 29 WideString RenderTextContents(WideStringView contents); 30 bool encodedContents(WideStringView contents, WideString* result); 31 32 private: 33 static constexpr size_t kArraySize = 9; 34 35 void ToIntArray(int16_t value, uint8_t array[kArraySize]) const; 36 37 int8_t m_iWideNarrRatio = 3; 38 }; 39 40 #endif // FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_ 41