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 _BC_EDTECTIONRESULT_H_
8 #define _BC_EDTECTIONRESULT_H_
9 class CBC_BarcodeMetadata;
10 class CBC_BoundingBox;
11 class CBC_Codeword;
12 class CBC_DetectionResultColumn;
13 class CBC_DetectionResult {
14  public:
15   CBC_DetectionResult(CBC_BarcodeMetadata* barcodeMetadata,
16                       CBC_BoundingBox* boundingBox);
17   virtual ~CBC_DetectionResult();
18   CFX_PtrArray& getDetectionResultColumns();
19   void setBoundingBox(CBC_BoundingBox* boundingBox);
20   CBC_BoundingBox* getBoundingBox();
21   void setDetectionResultColumn(
22       int32_t barcodeColumn,
23       CBC_DetectionResultColumn* detectionResultColumn);
24   CBC_DetectionResultColumn* getDetectionResultColumn(int32_t barcodeColumn);
25   CFX_ByteString toString();
26 
27   int32_t getBarcodeColumnCount();
28   int32_t getBarcodeRowCount();
29   int32_t getBarcodeECLevel();
30 
31  private:
32   static int32_t ADJUST_ROW_NUMBER_SKIP;
33   CBC_BarcodeMetadata* m_barcodeMetadata;
34   CFX_PtrArray m_detectionResultColumns;
35   CBC_BoundingBox* m_boundingBox;
36   int32_t m_barcodeColumnCount;
37 
38  private:
39   void adjustIndicatorColumnRowNumbers(
40       CBC_DetectionResultColumn* detectionResultColumn);
41   int32_t adjustRowNumbers();
42   int32_t adjustRowNumbersByRow();
43   int32_t adjustRowNumbersFromBothRI();
44   int32_t adjustRowNumbersFromRRI();
45   int32_t adjustRowNumbersFromLRI();
46   static int32_t adjustRowNumberIfValid(int32_t rowIndicatorRowNumber,
47                                         int32_t invalidRowCounts,
48                                         CBC_Codeword* codeword);
49   void adjustRowNumbers(int32_t barcodeColumn,
50                         int32_t codewordsRow,
51                         CFX_PtrArray* codewords);
52   static FX_BOOL adjustRowNumber(CBC_Codeword* codeword,
53                                  CBC_Codeword* otherCodeword);
54 };
55 #endif
56