• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DATAMATRIX_BC_C40ENCODER_H_
8 #define FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
9 
10 #include "core/fxcrt/widestring.h"
11 #include "fxbarcode/datamatrix/BC_Encoder.h"
12 
13 class CBC_C40Encoder : public CBC_Encoder {
14  public:
15   CBC_C40Encoder();
16   ~CBC_C40Encoder() override;
17 
18   // CBC_Encoder
19   int32_t getEncodingMode() override;
20   void Encode(CBC_EncoderContext& context, int32_t& e) override;
21 
22   static void writeNextTriplet(CBC_EncoderContext& context, WideString& buffer);
23 
24   virtual void handleEOD(CBC_EncoderContext& context,
25                          WideString& buffer,
26                          int32_t& e);
27   virtual int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e);
28 
29  private:
30   // Moves back by 1 position in |context| and adjusts |buffer| accordingly
31   // using |lastCharSize|. Returns the length of the current character in
32   // |context| after adjusting the position. If the character cannot be encoded,
33   // return -1.
34   int32_t BacktrackOneCharacter(CBC_EncoderContext* context,
35                                 WideString* buffer,
36                                 int32_t lastCharSize);
37 };
38 
39 #endif  // FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
40