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_UTILS_H_ |
| 8 | #define FXBARCODE_UTILS_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
Dan Sinclair | 951b111 | 2017-10-02 10:38:55 -0400 | [diff] [blame] | 10 | #include <ctype.h> |
| 11 | |
Tom Sepez | 8b6186f | 2017-03-28 12:06:45 -0700 | [diff] [blame] | 12 | #include <vector> |
| 13 | |
Dan Sinclair | bcd1e70 | 2017-08-31 13:19:18 -0400 | [diff] [blame] | 14 | #include "core/fxcrt/fx_string.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 15 | |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 16 | bool BC_FX_ByteString_Replace(ByteString& dst, |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 17 | uint32_t first, |
| 18 | uint32_t last, |
| 19 | int32_t count, |
Dan Sinclair | 812e96c | 2017-03-13 16:43:37 -0400 | [diff] [blame] | 20 | char c); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 21 | void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c); |
| 22 | void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 23 | |
Dan Sinclair | 9c392c8 | 2017-09-28 08:51:48 -0400 | [diff] [blame] | 24 | #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 25 | #include <limits> |
Dan Sinclair | 951b111 | 2017-10-02 10:38:55 -0400 | [diff] [blame] | 26 | #elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ |
Dan Sinclair | 9c392c8 | 2017-09-28 08:51:48 -0400 | [diff] [blame] | 27 | #include <limits.h> |
Dan Sinclair | 951b111 | 2017-10-02 10:38:55 -0400 | [diff] [blame] | 28 | #endif |
Dan Sinclair | 2e4075d | 2017-09-26 16:08:45 -0400 | [diff] [blame] | 29 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 30 | enum BCFORMAT { |
| 31 | BCFORMAT_UNSPECIFY = -1, |
| 32 | BCFORMAT_CODABAR, |
| 33 | BCFORMAT_CODE_39, |
| 34 | BCFORMAT_CODE_128, |
| 35 | BCFORMAT_CODE_128B, |
| 36 | BCFORMAT_CODE_128C, |
| 37 | BCFORMAT_EAN_8, |
| 38 | BCFORMAT_UPC_A, |
| 39 | BCFORMAT_EAN_13, |
| 40 | BCFORMAT_PDF_417, |
| 41 | BCFORMAT_DATAMATRIX, |
| 42 | BCFORMAT_QR_CODE |
| 43 | }; |
Dan Sinclair | 951b111 | 2017-10-02 10:38:55 -0400 | [diff] [blame] | 44 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 45 | #define BCExceptionNO 0 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 46 | #define BCExceptionIllegalArgument 16 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 47 | #define BCExceptionDegreeIsNegative 31 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 48 | #define BCExceptionAIsZero 37 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 49 | #define BCExceptionValueMustBeEither0or1 50 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 50 | #define BCExceptionBadIndexException 52 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 51 | #define BCExceptionNoSuchVersion 58 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 52 | #define BCExceptionUnsupportedMode 64 |
| 53 | #define BCExceptionInvalidateCharacter 65 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 54 | #define BCExceptionInvalidateMaskPattern 68 |
| 55 | #define BCExceptionNullPointer 69 |
| 56 | #define BCExceptionBadMask 70 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 57 | #define BCExceptionInvalidateImageData 73 |
| 58 | #define BCExceptionHeight_8BeZero 74 |
| 59 | #define BCExceptionCharacterNotThisMode 75 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 60 | #define BCExceptionInvalidateData 77 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 61 | #define BCExceptionCharactersOutsideISO88591Encoding 87 |
| 62 | #define BCExceptionIllegalDataCodewords 88 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 63 | #define BCExceptionIllegalStateUnexpectedCase 90 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 64 | #define BCExceptionIllegalStateMessageLengthInvalid 92 |
| 65 | #define BCExceptionIllegalArgumentNotGigits 93 |
| 66 | #define BCExceptionIllegalStateIllegalMode 94 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 67 | #define BCExceptionNonEncodableCharacterDetected 96 |
Lei Zhang | b2a4047 | 2017-04-04 16:15:13 -0700 | [diff] [blame] | 68 | #define BCExceptionGeneric 107 |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 69 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 70 | #endif // FXBARCODE_UTILS_H_ |