xref: /aosp_15_r20/external/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
8 #define FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/data_vector.h"
13 #include "core/fxcrt/widestring.h"
14 
15 class CBC_DefaultPlacement final {
16  public:
17   CBC_DefaultPlacement(WideString codewords, int32_t numcols, int32_t numrows);
18   ~CBC_DefaultPlacement();
19 
20   bool GetBit(int32_t col, int32_t row) const;
21 
22  private:
23   void Init();
24   void SetModule(int32_t row, int32_t col, int32_t pos, int32_t bit);
25   void SetUtah(int32_t row, int32_t col, int32_t pos);
26   void SetCorner1(int32_t pos);
27   void SetCorner2(int32_t pos);
28   void SetCorner3(int32_t pos);
29   void SetCorner4(int32_t pos);
30 
31   void SetBit(int32_t col, int32_t row, bool bit);
32   bool HasBit(int32_t col, int32_t row) const;
33 
34   const WideString m_codewords;
35   const int32_t m_numrows;
36   const int32_t m_numcols;
37   DataVector<uint8_t> m_bits;
38 };
39 
40 #endif  // FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
41