GreyscaleRotatedLuminanceSource: implemented getMatrix()
[zxing.git] / cpp / core / src / zxing / oned / UPCEANReader.h
index 8f825c2..9076681 100644 (file)
@@ -1,8 +1,10 @@
+#ifndef __UPC_EAN_READER_H__
+#define __UPC_EAN_READER_H__
+
 /*
  *  UPCEANReader.h
  *  ZXing
  *
- *  Created by Lukasz Warchol on 10-01-21.
  *  Copyright 2010 ZXing authors All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * limitations under the License.
  */
 
-#pragma once
-
 #include <zxing/oned/OneDReader.h>
 #include <zxing/common/BitArray.h>
 #include <zxing/Result.h>
+
 typedef enum UPC_EAN_PATTERNS {
        UPC_EAN_PATTERNS_L_PATTERNS = 0,
        UPC_EAN_PATTERNS_L_AND_G_PATTERNS
 } UPC_EAN_PATTERNS;
+
 namespace zxing {
        namespace oned {
                class UPCEANReader : public OneDReader {
-                       
+
                private:
-                       static const int MAX_AVG_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
+                       static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
                        static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
-                       
-                       static int* findStartGuardPattern(Ref<BitArray> row);                                                                                                                                   //throws ReaderException
-                       
-                       int* decodeEnd(Ref<BitArray> row, int endStart);                                                                                                                                                //throws ReaderException
-                       
-                       static bool checkStandardUPCEANChecksum(std::string s);                                                                                                                                 //throws ReaderException 
+
+                       static int* findStartGuardPattern(Ref<BitArray> row);
+
+                       virtual int* decodeEnd(Ref<BitArray> row, int endStart);
+
+                       static bool checkStandardUPCEANChecksum(std::string s);
                protected:
-                       static int* findGuardPattern(Ref<BitArray> row, int rowOffset, bool whiteFirst, const int pattern[], int patternLen);   //throws ReaderException 
-                       
+                       static int* findGuardPattern(Ref<BitArray> row, int rowOffset, bool whiteFirst,
+                           const int pattern[], int patternLen);
+
                        virtual const int getMIDDLE_PATTERN_LEN();
                        virtual const int* getMIDDLE_PATTERN();
-                       
+
                public:
                        UPCEANReader();
-                       
-                       virtual int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString) = 0;                        //throws ReaderException
-                       
+
+      // Returns < 0 on failure, >= 0 on success.
+                       virtual int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen,
+                           std::string& resultString) = 0;
+
                        Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
+
+                       // TODO(dswitkin): Should this be virtual so that UPCAReader can override it?
                        Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row, int startGuardRange[]);
-                       
-                       static int decodeDigit(Ref<BitArray> row, int counters[], int countersLen, int rowOffset, UPC_EAN_PATTERNS paternType); //throws ReaderException 
-                       
-                       bool checkChecksum(std::string s);                                                                                                                                                                              //throws ReaderException
-                       
+
+      // Returns < 0 on failure, >= 0 on success.
+                       static int decodeDigit(Ref<BitArray> row, int counters[], int countersLen, int rowOffset,
+                           UPC_EAN_PATTERNS patternType);
+
+                       virtual bool checkChecksum(std::string s);
+
                        virtual BarcodeFormat getBarcodeFormat() = 0;
                        virtual ~UPCEANReader();
                };
        }
-}
\ No newline at end of file
+}
+
+#endif