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_ONEDEAN8WRITER_H_ 8 #define FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ 9 10 #include <stdint.h> 11 12 #include "core/fxcrt/fx_string.h" 13 #include "fxbarcode/BC_Library.h" 14 #include "fxbarcode/oned/BC_OnedEANWriter.h" 15 16 class CFX_Matrix; 17 class CFX_RenderDevice; 18 19 class CBC_OnedEAN8Writer final : public CBC_OneDimEANWriter { 20 public: 21 CBC_OnedEAN8Writer(); 22 ~CBC_OnedEAN8Writer() override; 23 24 // CBC_OneDimEANWriter: 25 DataVector<uint8_t> Encode(const ByteString& contents) override; 26 bool CheckContentValidity(WideStringView contents) override; 27 WideString FilterContents(WideStringView contents) override; 28 void SetDataLength(int32_t length) override; 29 void SetTextLocation(BC_TEXT_LOC location) override; 30 int32_t CalcChecksum(const ByteString& contents) override; 31 32 private: 33 bool ShowChars(WideStringView contents, 34 CFX_RenderDevice* device, 35 const CFX_Matrix& matrix, 36 int32_t barWidth) override; 37 38 static constexpr int32_t kDefaultCodeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; 39 int32_t m_codeWidth = kDefaultCodeWidth; 40 }; 41 42 #endif // FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ 43