You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ZXDecodeHints.h 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2012 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "ZXBarcodeFormat.h"
  17. @protocol ZXResultPointCallback;
  18. @class ZXIntArray;
  19. /**
  20. * Encapsulates hints that a caller may pass to a barcode reader to help it
  21. * more quickly or accurately decode it. It is up to implementations to decide what,
  22. * if anything, to do with the information that is supplied.
  23. */
  24. @interface ZXDecodeHints : NSObject <NSCopying>
  25. + (id)hints;
  26. /**
  27. * Assume Code 39 codes employ a check digit.
  28. */
  29. @property (nonatomic, assign) BOOL assumeCode39CheckDigit;
  30. /**
  31. * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.
  32. * For example this affects FNC1 handling for Code 128 (aka GS1-128).
  33. */
  34. @property (nonatomic, assign) BOOL assumeGS1;
  35. /**
  36. * Allowed lengths of encoded data -- reject anything else.
  37. */
  38. @property (nonatomic, strong) NSArray *allowedLengths;
  39. /**
  40. * Specifies what character encoding to use when decoding, where applicable (type String)
  41. */
  42. @property (nonatomic, assign) NSStringEncoding encoding;
  43. /**
  44. * Unspecified, application-specific hint.
  45. */
  46. @property (nonatomic, strong) id other;
  47. /**
  48. * Image is a pure monochrome image of a barcode.
  49. */
  50. @property (nonatomic, assign) BOOL pureBarcode;
  51. /**
  52. * If true, return the start and end digits in a Codabar barcode instead of stripping them. They
  53. * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
  54. * to not be.
  55. */
  56. @property (nonatomic, assign) BOOL returnCodaBarStartEnd;
  57. /**
  58. * The caller needs to be notified via callback when a possible ZXResultPoint
  59. * is found.
  60. */
  61. @property (nonatomic, strong) id <ZXResultPointCallback> resultPointCallback;
  62. /**
  63. * Spend more time to try to find a barcode; optimize for accuracy, not speed.
  64. */
  65. @property (nonatomic, assign) BOOL tryHarder;
  66. /**
  67. * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.
  68. * Maps to an ZXIntArray of the allowed extension lengths, for example [2], [5], or [2, 5].
  69. * If it is optional to have an extension, do not set this hint. If this is set,
  70. * and a UPC or EAN barcode is found but an extension is not, then no result will be returned
  71. * at all.
  72. */
  73. @property (nonatomic, strong) ZXIntArray *allowedEANExtensions;
  74. /**
  75. * Image is known to be of one of a few possible formats.
  76. */
  77. - (void)addPossibleFormat:(ZXBarcodeFormat)format;
  78. - (BOOL)containsFormat:(ZXBarcodeFormat)format;
  79. - (int)numberOfPossibleFormats;
  80. - (void)removePossibleFormat:(ZXBarcodeFormat)format;
  81. @end