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 XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_ 8 #define XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "core/fxcrt/fx_system.h" 12 #include "xfa/fxbarcode/oned/BC_OneDimWriter.h" 13 14 class CBC_OnedCode128Writer : public CBC_OneDimWriter { 15 public: 16 CBC_OnedCode128Writer(); 17 explicit CBC_OnedCode128Writer(BC_TYPE type); 18 ~CBC_OnedCode128Writer() override; 19 20 // CBC_OneDimWriter 21 uint8_t* Encode(const CFX_ByteString& contents, 22 BCFORMAT format, 23 int32_t& outWidth, 24 int32_t& outHeight, 25 int32_t hints, 26 int32_t& e) override; 27 uint8_t* Encode(const CFX_ByteString& contents, 28 BCFORMAT format, 29 int32_t& outWidth, 30 int32_t& outHeight, 31 int32_t& e) override; 32 uint8_t* Encode(const CFX_ByteString& contents, 33 int32_t& outLength, 34 int32_t& e) override; 35 36 bool CheckContentValidity(const CFX_WideStringC& contents) override; 37 CFX_WideString FilterContents(const CFX_WideStringC& contents) override; 38 39 bool SetTextLocation(BC_TEXT_LOC location); 40 41 BC_TYPE GetType(); 42 43 private: 44 bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length); 45 int32_t Encode128B(const CFX_ByteString& contents, 46 CFX_ArrayTemplate<const int32_t*>* patterns); 47 int32_t Encode128C(const CFX_ByteString& contents, 48 CFX_ArrayTemplate<const int32_t*>* patterns); 49 50 BC_TYPE m_codeFormat; 51 }; 52 53 #endif // XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_ 54