xref: /aosp_15_r20/external/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.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_QRCODE_BC_QRCODERBITVECTOR_H_
8 #define FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 
13 #include "core/fxcrt/data_vector.h"
14 #include "third_party/base/containers/span.h"
15 
16 class CBC_QRCoderBitVector {
17  public:
18   CBC_QRCoderBitVector();
19   ~CBC_QRCoderBitVector();
20 
21   pdfium::span<const uint8_t> GetArray() const;
22   int32_t At(size_t index) const;
23   size_t Size() const;
24   size_t sizeInBytes() const;
25 
26   void AppendBit(int32_t bit);
27   void AppendBits(int32_t value, int32_t numBits);
28   void AppendBitVector(const CBC_QRCoderBitVector* bits);
29   bool XOR(const CBC_QRCoderBitVector* other);
30 
31  private:
32   void AppendByte(int8_t value);
33 
34   size_t m_sizeInBits = 0;
35   DataVector<uint8_t> m_array;
36 };
37 
38 #endif  // FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
39