Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 1 | // 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 Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 7 | #ifndef FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_ |
| 8 | #define FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
Raphael Kubo da Costa | b02aa61 | 2017-09-19 14:30:10 +0200 | [diff] [blame] | 10 | #include <stdint.h> |
| 11 | |
Tom Sepez | 8b6186f | 2017-03-28 12:06:45 -0700 | [diff] [blame] | 12 | #include <vector> |
| 13 | |
weili | e76203d | 2016-08-09 13:45:03 -0700 | [diff] [blame] | 14 | // TODO(weili): The usage of this class should be replaced by |
| 15 | // std::vector<uint8_t>. |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 16 | class CBC_CommonByteArray { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 17 | public: |
| 18 | CBC_CommonByteArray(); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 19 | explicit CBC_CommonByteArray(int32_t size); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 20 | CBC_CommonByteArray(uint8_t* byteArray, int32_t size); |
| 21 | virtual ~CBC_CommonByteArray(); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 22 | |
weili | e76203d | 2016-08-09 13:45:03 -0700 | [diff] [blame] | 23 | int32_t At(int32_t index) const; |
| 24 | int32_t Size() const; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 25 | bool IsEmpty() const; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 26 | void Set(int32_t index, int32_t value); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 27 | void AppendByte(int32_t value); |
| 28 | void Reserve(int32_t capacity); |
Lei Zhang | b2a4047 | 2017-04-04 16:15:13 -0700 | [diff] [blame] | 29 | void Set(const uint8_t* source, int32_t offset, int32_t count); |
Tom Sepez | 8b6186f | 2017-03-28 12:06:45 -0700 | [diff] [blame] | 30 | void Set(std::vector<uint8_t>* source, int32_t offset, int32_t count); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | int32_t m_size; |
| 34 | int32_t m_index; |
| 35 | uint8_t* m_bytes; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 36 | }; |
| 37 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 38 | #endif // FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_ |