blob: a0f29fee1ff6d286ec4910669d7ded11422bc93d [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
Tom Sepez3627b502020-04-16 19:36:20 +000015#include "core/fxcrt/fx_memory_wrappers.h"
16
Dan Sinclair1770c022016-03-14 14:14:16 -040017class CBC_QRCoderBitVector {
Dan Sinclair1770c022016-03-14 14:14:16 -040018 public:
19 CBC_QRCoderBitVector();
Lei Zhangb2a40472017-04-04 16:15:13 -070020 ~CBC_QRCoderBitVector();
21
22 const uint8_t* GetArray() const;
Lei Zhangcb8a4dd2018-11-28 01:25:52 +000023 int32_t At(size_t index) const;
Lei Zhangb2a40472017-04-04 16:15:13 -070024 size_t Size() const;
25 size_t sizeInBytes() const;
26
27 void AppendBit(int32_t bit);
28 void AppendBits(int32_t value, int32_t numBits);
Lei Zhangcb8a4dd2018-11-28 01:25:52 +000029 void AppendBitVector(const CBC_QRCoderBitVector* bits);
Lei Zhangb2a40472017-04-04 16:15:13 -070030 bool XOR(const CBC_QRCoderBitVector* other);
31
32 private:
33 void AppendByte(int8_t value);
34
35 size_t m_sizeInBits = 0;
Tom Sepez3627b502020-04-16 19:36:20 +000036 std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_array;
Dan Sinclair1770c022016-03-14 14:14:16 -040037};
38
Dan Sinclaire7786682017-03-29 15:18:41 -040039#endif // FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_