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.

ZXResult.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #import "ZXResultMetadataType.h"
  18. @class ZXByteArray;
  19. /**
  20. * Encapsulates the result of decoding a barcode within an image.
  21. */
  22. @interface ZXResult : NSObject
  23. /**
  24. * @return raw text encoded by the barcode
  25. */
  26. @property (nonatomic, copy, readonly) NSString *text;
  27. /**
  28. * @return raw bytes encoded by the barcode, if applicable, otherwise nil
  29. */
  30. @property (nonatomic, strong, readonly) ZXByteArray *rawBytes;
  31. /**
  32. * @return points related to the barcode in the image. These are typically points
  33. * identifying finder patterns or the corners of the barcode. The exact meaning is
  34. * specific to the type of barcode that was decoded.
  35. */
  36. @property (nonatomic, strong, readonly) NSMutableArray *resultPoints;
  37. /**
  38. * @return ZXBarcodeFormat representing the format of the barcode that was decoded
  39. */
  40. @property (nonatomic, assign, readonly) ZXBarcodeFormat barcodeFormat;
  41. /**
  42. * @return NSDictionary mapping ZXResultMetadataType keys to values. May be
  43. * nil. This contains optional metadata about what was detected about the barcode,
  44. * like orientation.
  45. */
  46. @property (nonatomic, strong, readonly) NSMutableDictionary *resultMetadata;
  47. @property (nonatomic, assign, readonly) long timestamp;
  48. - (id)initWithText:(NSString *)text rawBytes:(ZXByteArray *)rawBytes resultPoints:(NSArray *)resultPoints format:(ZXBarcodeFormat)format;
  49. - (id)initWithText:(NSString *)text rawBytes:(ZXByteArray *)rawBytes resultPoints:(NSArray *)resultPoints format:(ZXBarcodeFormat)format timestamp:(long)timestamp;
  50. + (id)resultWithText:(NSString *)text rawBytes:(ZXByteArray *)rawBytes resultPoints:(NSArray *)resultPoints format:(ZXBarcodeFormat)format;
  51. + (id)resultWithText:(NSString *)text rawBytes:(ZXByteArray *)rawBytes resultPoints:(NSArray *)resultPoints format:(ZXBarcodeFormat)format timestamp:(long)timestamp;
  52. - (void)putMetadata:(ZXResultMetadataType)type value:(id)value;
  53. - (void)putAllMetadata:(NSMutableDictionary *)metadata;
  54. - (void)addResultPoints:(NSArray *)newPoints;
  55. @end