1 // Copyright 2014 PDFium Authors. All rights reserved.
\r
2 // Use of this source code is governed by a BSD-style license that can be
\r
3 // found in the LICENSE file.
\r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
\r
8 #include "include/BC_PDF417Common.h"
\r
9 #include "include/BC_PDF417BarcodeValue.h"
\r
10 CBC_BarcodeValue::CBC_BarcodeValue()
\r
13 CBC_BarcodeValue::~CBC_BarcodeValue()
\r
16 void CBC_BarcodeValue::setValue(FX_INT32 value)
\r
18 FX_INT32 confidence = 0;
\r
19 for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) {
\r
20 if (m_keys.GetAt(i) == value) {
\r
21 confidence = m_values.GetAt(i);
\r
22 m_values.SetAt(i, confidence + 1);
\r
28 m_values.Add(confidence);
\r
30 CFX_Int32Array* CBC_BarcodeValue::getValue()
\r
32 FX_INT32 maxConfidence = -1;
\r
33 CFX_Int32Array* result = FX_NEW CFX_Int32Array;
\r
34 for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) {
\r
35 if (m_values.GetAt(i) > maxConfidence) {
\r
36 maxConfidence = m_values.GetAt(i);
\r
37 result->RemoveAll();
\r
38 result->Add(m_keys.GetAt(i));
\r
39 } else if (m_values.GetAt(i) == maxConfidence) {
\r
40 result->Add(m_keys.GetAt(i));
\r
45 FX_INT32 CBC_BarcodeValue::getConfidence(FX_INT32 value)
\r
47 for (FX_INT32 i = 0; i < m_keys.GetSize(); i++)
\r
48 if (m_keys.GetAt(i) == value) {
\r
49 return m_values.GetAt(i);
\r