1 // Copyright 2018 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_CBC_EANCODE_H_
8 #define FXBARCODE_CBC_EANCODE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "fxbarcode/cbc_onecode.h"
14 #include "fxbarcode/utils.h"
15 
16 class CBC_OneDimEANWriter;
17 
18 class CBC_EANCode : public CBC_OneCode {
19  public:
20   explicit CBC_EANCode(std::unique_ptr<CBC_OneDimEANWriter> pWriter);
21   ~CBC_EANCode() override;
22 
23   virtual BCFORMAT GetFormat() const = 0;
24   virtual size_t GetMaxLength() const = 0;
25 
26   // CBC_EANCode:
27   bool Encode(WideStringView contents) override;
28   bool RenderDevice(CFX_RenderDevice* device,
29                     const CFX_Matrix* matrix) override;
30 
31  protected:
32   CBC_OneDimEANWriter* GetOneDimEANWriter();
33   WideString Preprocess(WideStringView contents);
34 
35   WideString m_renderContents;
36 };
37 
38 #endif  // FXBARCODE_CBC_EANCODE_H_
39