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_ONEDUPCEANREADER_H_ 8#define _BC_ONEDUPCEANREADER_H_ 9class CBC_OneDReader; 10class CBC_CommonBitArray; 11class CBC_OneDimReader; 12class CBC_OneDimReader : public CBC_OneDReader { 13 private: 14 const static int32_t MAX_AVG_VARIANCE; 15 const static int32_t MAX_INDIVIDUAL_VARIANCE; 16 17 FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString& s, int32_t& e); 18 19 public: 20 const static int32_t START_END_PATTERN[3]; 21 const static int32_t MIDDLE_PATTERN[5]; 22 const static int32_t L_PATTERNS[10][4]; 23 const static int32_t L_AND_G_PATTERNS[20][4]; 24 CBC_OneDimReader(); 25 virtual ~CBC_OneDimReader(); 26 CFX_ByteString DecodeRow(int32_t rowNumber, 27 CBC_CommonBitArray* row, 28 int32_t hints, 29 int32_t& e); 30 CFX_ByteString DecodeRow(int32_t rowNumber, 31 CBC_CommonBitArray* row, 32 CFX_Int32Array* startGuardRange, 33 int32_t hints, 34 int32_t& e); 35 36 protected: 37 CFX_Int32Array* FindStartGuardPattern(CBC_CommonBitArray* row, int32_t& e); 38 virtual FX_BOOL CheckChecksum(CFX_ByteString& s, int32_t& e); 39 CFX_Int32Array* FindGuardPattern(CBC_CommonBitArray* row, 40 int32_t rowOffset, 41 FX_BOOL whiteFirst, 42 CFX_Int32Array* pattern, 43 int32_t& e); 44 int32_t DecodeDigit(CBC_CommonBitArray* row, 45 CFX_Int32Array* counters, 46 int32_t rowOffset, 47 const int32_t* patterns, 48 int32_t patternLength, 49 int32_t& e); 50 virtual int32_t DecodeMiddle(CBC_CommonBitArray* row, 51 CFX_Int32Array* startRange, 52 CFX_ByteString& resultResult, 53 int32_t& e) { 54 return 0; 55 } 56 virtual CFX_Int32Array* DecodeEnd(CBC_CommonBitArray* row, 57 int32_t endStart, 58 int32_t& e); 59}; 60#endif 61