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 7 #ifndef FXBARCODE_UTILS_H_ 8 #define FXBARCODE_UTILS_H_ 9 10 #include <ctype.h> 11 12 #include <vector> 13 14 #include "core/fxcrt/fx_string.h" 15 16 bool BC_FX_ByteString_Replace(ByteString& dst, 17 uint32_t first, 18 uint32_t last, 19 int32_t count, 20 char c); 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); 23 24 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ 25 #include <limits> 26 #elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_ 27 #include <limits.h> 28 #endif 29 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 }; 44 45 #define BCExceptionNO 0 46 #define BCExceptionIllegalArgument 16 47 #define BCExceptionDegreeIsNegative 31 48 #define BCExceptionAIsZero 37 49 #define BCExceptionValueMustBeEither0or1 50 50 #define BCExceptionBadIndexException 52 51 #define BCExceptionNoSuchVersion 58 52 #define BCExceptionUnsupportedMode 64 53 #define BCExceptionInvalidateCharacter 65 54 #define BCExceptionInvalidateMaskPattern 68 55 #define BCExceptionNullPointer 69 56 #define BCExceptionBadMask 70 57 #define BCExceptionInvalidateImageData 73 58 #define BCExceptionHeight_8BeZero 74 59 #define BCExceptionCharacterNotThisMode 75 60 #define BCExceptionInvalidateData 77 61 #define BCExceptionCharactersOutsideISO88591Encoding 87 62 #define BCExceptionIllegalDataCodewords 88 63 #define BCExceptionIllegalStateUnexpectedCase 90 64 #define BCExceptionIllegalStateMessageLengthInvalid 92 65 #define BCExceptionIllegalArgumentNotGigits 93 66 #define BCExceptionIllegalStateIllegalMode 94 67 #define BCExceptionNonEncodableCharacterDetected 96 68 #define BCExceptionGeneric 107 69 70 #endif // FXBARCODE_UTILS_H_ 71