OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2013 ZXing authors | 8 * Copyright 2013 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
11 * you may not use this file except in compliance with the License. | 11 * you may not use this file except in compliance with the License. |
12 * You may obtain a copy of the License at | 12 * You may obtain a copy of the License at |
13 * | 13 * |
14 * http://www.apache.org/licenses/LICENSE-2.0 | 14 * http://www.apache.org/licenses/LICENSE-2.0 |
15 * | 15 * |
16 * Unless required by applicable law or agreed to in writing, software | 16 * Unless required by applicable law or agreed to in writing, software |
17 * distributed under the License is distributed on an "AS IS" BASIS, | 17 * distributed under the License is distributed on an "AS IS" BASIS, |
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
19 * See the License for the specific language governing permissions and | 19 * See the License for the specific language governing permissions and |
20 * limitations under the License. | 20 * limitations under the License. |
21 */ | 21 */ |
22 | 22 |
23 #include "../barcode.h" | 23 #include "../barcode.h" |
24 #include "BC_PDF417Codeword.h" | 24 #include "BC_PDF417Codeword.h" |
25 FX_INT32 CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; | 25 int32_t CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; |
26 CBC_Codeword::CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_I
NT32 cvalue) | 26 CBC_Codeword::CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t
cvalue) |
27 { | 27 { |
28 m_startX = startX; | 28 m_startX = startX; |
29 m_endX = endX; | 29 m_endX = endX; |
30 m_bucket = bucket; | 30 m_bucket = bucket; |
31 m_value = cvalue; | 31 m_value = cvalue; |
32 m_rowNumber = BARCODE_ROW_UNKNOWN; | 32 m_rowNumber = BARCODE_ROW_UNKNOWN; |
33 } | 33 } |
34 CBC_Codeword::~CBC_Codeword() | 34 CBC_Codeword::~CBC_Codeword() |
35 { | 35 { |
36 } | 36 } |
37 FX_BOOL CBC_Codeword::hasValidRowNumber() | 37 FX_BOOL CBC_Codeword::hasValidRowNumber() |
38 { | 38 { |
39 return isValidRowNumber(m_rowNumber); | 39 return isValidRowNumber(m_rowNumber); |
40 } | 40 } |
41 FX_BOOL CBC_Codeword::isValidRowNumber(FX_INT32 rowNumber) | 41 FX_BOOL CBC_Codeword::isValidRowNumber(int32_t rowNumber) |
42 { | 42 { |
43 return m_rowNumber != BARCODE_ROW_UNKNOWN && m_bucket == (m_rowNumber % 3) *
3; | 43 return m_rowNumber != BARCODE_ROW_UNKNOWN && m_bucket == (m_rowNumber % 3) *
3; |
44 } | 44 } |
45 void CBC_Codeword::setRowNumberAsRowIndicatorColumn() | 45 void CBC_Codeword::setRowNumberAsRowIndicatorColumn() |
46 { | 46 { |
47 m_rowNumber = (m_value / 30) * 3 + m_bucket / 3; | 47 m_rowNumber = (m_value / 30) * 3 + m_bucket / 3; |
48 } | 48 } |
49 FX_INT32 CBC_Codeword::getWidth() | 49 int32_t CBC_Codeword::getWidth() |
50 { | 50 { |
51 return m_endX - m_startX; | 51 return m_endX - m_startX; |
52 } | 52 } |
53 FX_INT32 CBC_Codeword::getStartX() | 53 int32_t CBC_Codeword::getStartX() |
54 { | 54 { |
55 return m_startX; | 55 return m_startX; |
56 } | 56 } |
57 FX_INT32 CBC_Codeword::getEndX() | 57 int32_t CBC_Codeword::getEndX() |
58 { | 58 { |
59 return m_endX; | 59 return m_endX; |
60 } | 60 } |
61 FX_INT32 CBC_Codeword::getBucket() | 61 int32_t CBC_Codeword::getBucket() |
62 { | 62 { |
63 return m_bucket; | 63 return m_bucket; |
64 } | 64 } |
65 FX_INT32 CBC_Codeword::getValue() | 65 int32_t CBC_Codeword::getValue() |
66 { | 66 { |
67 return m_value; | 67 return m_value; |
68 } | 68 } |
69 FX_INT32 CBC_Codeword::getRowNumber() | 69 int32_t CBC_Codeword::getRowNumber() |
70 { | 70 { |
71 return m_rowNumber; | 71 return m_rowNumber; |
72 } | 72 } |
73 void CBC_Codeword::setRowNumber(FX_INT32 rowNumber) | 73 void CBC_Codeword::setRowNumber(int32_t rowNumber) |
74 { | 74 { |
75 m_rowNumber = rowNumber; | 75 m_rowNumber = rowNumber; |
76 } | 76 } |
77 CFX_ByteString CBC_Codeword::toString() | 77 CFX_ByteString CBC_Codeword::toString() |
78 { | 78 { |
79 return m_rowNumber + (FX_CHAR)'|' + m_value; | 79 return m_rowNumber + (FX_CHAR)'|' + m_value; |
80 } | 80 } |
OLD | NEW |