blob: 2303af44b0c4f7b8559a32bb89cf6740d1789a27 [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_UTILS_H_
8#define FXBARCODE_UTILS_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
Dan Sinclair951b1112017-10-02 10:38:55 -040010#include <ctype.h>
11
Tom Sepez8b6186f2017-03-28 12:06:45 -070012#include <vector>
13
Dan Sinclairbcd1e702017-08-31 13:19:18 -040014#include "core/fxcrt/fx_string.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040015
Ryan Harrison275e2602017-09-18 14:23:18 -040016bool BC_FX_ByteString_Replace(ByteString& dst,
tsepezd19e9122016-11-02 15:43:18 -070017 uint32_t first,
18 uint32_t last,
19 int32_t count,
Dan Sinclair812e96c2017-03-13 16:43:37 -040020 char c);
Ryan Harrison275e2602017-09-18 14:23:18 -040021void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c);
22void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba);
Dan Sinclair1770c022016-03-14 14:14:16 -040023
Dan Sinclair9c392c82017-09-28 08:51:48 -040024#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
Dan Sinclair1770c022016-03-14 14:14:16 -040025#include <limits>
Dan Sinclair951b1112017-10-02 10:38:55 -040026#elif _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_LINUX_
Dan Sinclair9c392c82017-09-28 08:51:48 -040027#include <limits.h>
Dan Sinclair951b1112017-10-02 10:38:55 -040028#endif
Dan Sinclair2e4075d2017-09-26 16:08:45 -040029
Dan Sinclair1770c022016-03-14 14:14:16 -040030enum 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 Sinclair951b1112017-10-02 10:38:55 -040044
Dan Sinclair1770c022016-03-14 14:14:16 -040045#define BCExceptionNO 0
Dan Sinclair1770c022016-03-14 14:14:16 -040046#define BCExceptionIllegalArgument 16
Dan Sinclair1770c022016-03-14 14:14:16 -040047#define BCExceptionDegreeIsNegative 31
Dan Sinclair1770c022016-03-14 14:14:16 -040048#define BCExceptionAIsZero 37
Dan Sinclair1770c022016-03-14 14:14:16 -040049#define BCExceptionValueMustBeEither0or1 50
Dan Sinclair1770c022016-03-14 14:14:16 -040050#define BCExceptionBadIndexException 52
Dan Sinclair1770c022016-03-14 14:14:16 -040051#define BCExceptionNoSuchVersion 58
Dan Sinclair1770c022016-03-14 14:14:16 -040052#define BCExceptionUnsupportedMode 64
53#define BCExceptionInvalidateCharacter 65
Dan Sinclair1770c022016-03-14 14:14:16 -040054#define BCExceptionInvalidateMaskPattern 68
55#define BCExceptionNullPointer 69
56#define BCExceptionBadMask 70
Dan Sinclair1770c022016-03-14 14:14:16 -040057#define BCExceptionInvalidateImageData 73
58#define BCExceptionHeight_8BeZero 74
59#define BCExceptionCharacterNotThisMode 75
Dan Sinclair1770c022016-03-14 14:14:16 -040060#define BCExceptionInvalidateData 77
Dan Sinclair1770c022016-03-14 14:14:16 -040061#define BCExceptionCharactersOutsideISO88591Encoding 87
62#define BCExceptionIllegalDataCodewords 88
Dan Sinclair1770c022016-03-14 14:14:16 -040063#define BCExceptionIllegalStateUnexpectedCase 90
Dan Sinclair1770c022016-03-14 14:14:16 -040064#define BCExceptionIllegalStateMessageLengthInvalid 92
65#define BCExceptionIllegalArgumentNotGigits 93
66#define BCExceptionIllegalStateIllegalMode 94
Dan Sinclair1770c022016-03-14 14:14:16 -040067#define BCExceptionNonEncodableCharacterDetected 96
Lei Zhangb2a40472017-04-04 16:15:13 -070068#define BCExceptionGeneric 107
Dan Sinclair1770c022016-03-14 14:14:16 -040069
Dan Sinclaire7786682017-03-29 15:18:41 -040070#endif // FXBARCODE_UTILS_H_