OLD | NEW |
| (Empty) |
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 // Original code is licensed as follows: | |
7 /* | |
8 * Copyright 2013 ZXing authors | |
9 * | |
10 * Licensed under the Apache License, Version 2.0 (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 | |
13 * | |
14 * http://www.apache.org/licenses/LICENSE-2.0 | |
15 * | |
16 * Unless required by applicable law or agreed to in writing, software | |
17 * distributed under the License is distributed on an "AS IS" BASIS, | |
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
19 * See the License for the specific language governing permissions and | |
20 * limitations under the License. | |
21 */ | |
22 | |
23 #include "barcode.h" | |
24 #include "include/BC_PDF417Codeword.h" | |
25 FX_INT32 CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; | |
26 CBC_Codeword::CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_I
NT32 cvalue) | |
27 { | |
28 m_startX = startX; | |
29 m_endX = endX; | |
30 m_bucket = bucket; | |
31 m_value = cvalue; | |
32 m_rowNumber = BARCODE_ROW_UNKNOWN; | |
33 } | |
34 CBC_Codeword::~CBC_Codeword() | |
35 { | |
36 } | |
37 FX_BOOL CBC_Codeword::hasValidRowNumber() | |
38 { | |
39 return isValidRowNumber(m_rowNumber); | |
40 } | |
41 FX_BOOL CBC_Codeword::isValidRowNumber(FX_INT32 rowNumber) | |
42 { | |
43 return m_rowNumber != BARCODE_ROW_UNKNOWN && m_bucket == (m_rowNumber % 3) *
3; | |
44 } | |
45 void CBC_Codeword::setRowNumberAsRowIndicatorColumn() | |
46 { | |
47 m_rowNumber = (m_value / 30) * 3 + m_bucket / 3; | |
48 } | |
49 FX_INT32 CBC_Codeword::getWidth() | |
50 { | |
51 return m_endX - m_startX; | |
52 } | |
53 FX_INT32 CBC_Codeword::getStartX() | |
54 { | |
55 return m_startX; | |
56 } | |
57 FX_INT32 CBC_Codeword::getEndX() | |
58 { | |
59 return m_endX; | |
60 } | |
61 FX_INT32 CBC_Codeword::getBucket() | |
62 { | |
63 return m_bucket; | |
64 } | |
65 FX_INT32 CBC_Codeword::getValue() | |
66 { | |
67 return m_value; | |
68 } | |
69 FX_INT32 CBC_Codeword::getRowNumber() | |
70 { | |
71 return m_rowNumber; | |
72 } | |
73 void CBC_Codeword::setRowNumber(FX_INT32 rowNumber) | |
74 { | |
75 m_rowNumber = rowNumber; | |
76 } | |
77 CFX_ByteString CBC_Codeword::toString() | |
78 { | |
79 return m_rowNumber + (FX_CHAR)'|' + m_value; | |
80 } | |
OLD | NEW |