blob: 9b8af810c2b23d7e82dfdbf815470ebbab0f1e35 [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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
Dan Sinclaire7786682017-03-29 15:18:41 -04007#ifndef FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
8#define FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
Lei Zhangb2a40472017-04-04 16:15:13 -070010#include <stddef.h>
Dan Sinclair1770c022016-03-14 14:14:16 -040011#include <stdint.h>
12
Lei Zhangb2a40472017-04-04 16:15:13 -070013#include <vector>
14
Dan Sinclair1770c022016-03-14 14:14:16 -040015class CBC_QRCoderBitVector {
Dan Sinclair1770c022016-03-14 14:14:16 -040016 public:
17 CBC_QRCoderBitVector();
Lei Zhangb2a40472017-04-04 16:15:13 -070018 ~CBC_QRCoderBitVector();
19
20 const uint8_t* GetArray() const;
Lei Zhangcb8a4dd2018-11-28 01:25:52 +000021 int32_t At(size_t index) const;
Lei Zhangb2a40472017-04-04 16:15:13 -070022 size_t Size() const;
23 size_t sizeInBytes() const;
24
25 void AppendBit(int32_t bit);
26 void AppendBits(int32_t value, int32_t numBits);
Lei Zhangcb8a4dd2018-11-28 01:25:52 +000027 void AppendBitVector(const CBC_QRCoderBitVector* bits);
Lei Zhangb2a40472017-04-04 16:15:13 -070028 bool XOR(const CBC_QRCoderBitVector* other);
29
30 private:
31 void AppendByte(int8_t value);
32
33 size_t m_sizeInBits = 0;
34 std::vector<uint8_t> m_array;
Dan Sinclair1770c022016-03-14 14:14:16 -040035};
36
Dan Sinclaire7786682017-03-29 15:18:41 -040037#endif // FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_