Removed as many exceptions as possible from the C++ product readers
[zxing.git] / cpp / core / src / zxing / oned / UPCEANReader.h
index 5ce7ab0..9076681 100644 (file)
  * 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 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
-                       
-                       virtual 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 patternType);        //throws ReaderException 
-                       
-                       virtual 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();
                };