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_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 16 class CBC_OnedCode128Writer final : 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(WideStringView contents) override; 35 WideString FilterContents(WideStringView contents) override; 36 bool SetTextLocation(BC_TEXT_LOC location) override; 37 GetType()38 BC_TYPE GetType() const { return m_codeFormat; } 39 40 private: 41 const BC_TYPE m_codeFormat; 42 }; 43 44 #endif // FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_ 45