blob: 285a567c8effc40ef7a11086d90b42b495976a87 [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_COMMON_BC_COMMONBYTEARRAY_H_
8#define FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
Raphael Kubo da Costab02aa612017-09-19 14:30:10 +020010#include <stdint.h>
11
Tom Sepez8b6186f2017-03-28 12:06:45 -070012#include <vector>
13
weilie76203d2016-08-09 13:45:03 -070014// TODO(weili): The usage of this class should be replaced by
15// std::vector<uint8_t>.
Dan Sinclair1770c022016-03-14 14:14:16 -040016class CBC_CommonByteArray {
Dan Sinclair1770c022016-03-14 14:14:16 -040017 public:
18 CBC_CommonByteArray();
weili29b8ad02016-06-14 18:20:04 -070019 explicit CBC_CommonByteArray(int32_t size);
Dan Sinclair1770c022016-03-14 14:14:16 -040020 CBC_CommonByteArray(uint8_t* byteArray, int32_t size);
21 virtual ~CBC_CommonByteArray();
weili29b8ad02016-06-14 18:20:04 -070022
weilie76203d2016-08-09 13:45:03 -070023 int32_t At(int32_t index) const;
24 int32_t Size() const;
tsepezd19e9122016-11-02 15:43:18 -070025 bool IsEmpty() const;
Dan Sinclair1770c022016-03-14 14:14:16 -040026 void Set(int32_t index, int32_t value);
Dan Sinclair1770c022016-03-14 14:14:16 -040027 void AppendByte(int32_t value);
28 void Reserve(int32_t capacity);
Lei Zhangb2a40472017-04-04 16:15:13 -070029 void Set(const uint8_t* source, int32_t offset, int32_t count);
Tom Sepez8b6186f2017-03-28 12:06:45 -070030 void Set(std::vector<uint8_t>* source, int32_t offset, int32_t count);
weili29b8ad02016-06-14 18:20:04 -070031
32 private:
33 int32_t m_size;
34 int32_t m_index;
35 uint8_t* m_bytes;
Dan Sinclair1770c022016-03-14 14:14:16 -040036};
37
Dan Sinclaire7786682017-03-29 15:18:41 -040038#endif // FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_