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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. @class ZXBitMatrix, ZXIntArray, ZXQRCodeECB, ZXQRCodeECBlocks, ZXQRCodeErrorCorrectionLevel;
  17. /**
  18. * See ISO 18004:2006 Annex D
  19. */
  20. @interface ZXQRCodeVersion : NSObject
  21. @property (nonatomic, assign, readonly) int versionNumber;
  22. @property (nonatomic, strong, readonly) ZXIntArray *alignmentPatternCenters;
  23. @property (nonatomic, strong, readonly) NSArray *ecBlocks;
  24. @property (nonatomic, assign, readonly) int totalCodewords;
  25. @property (nonatomic, assign, readonly) int dimensionForVersion;
  26. - (ZXQRCodeECBlocks *)ecBlocksForLevel:(ZXQRCodeErrorCorrectionLevel *)ecLevel;
  27. + (ZXQRCodeVersion *)provisionalVersionForDimension:(int)dimension;
  28. + (ZXQRCodeVersion *)versionForNumber:(int)versionNumber;
  29. + (ZXQRCodeVersion *)decodeVersionInformation:(int)versionBits;
  30. - (ZXBitMatrix *)buildFunctionPattern;
  31. @end
  32. /**
  33. * Encapsulates a set of error-correction blocks in one symbol version. Most versions will
  34. * use blocks of differing sizes within one version, so, this encapsulates the parameters for
  35. * each set of blocks. It also holds the number of error-correction codewords per block since it
  36. * will be the same across all blocks within one version.
  37. */
  38. @interface ZXQRCodeECBlocks : NSObject
  39. @property (nonatomic, assign, readonly) int ecCodewordsPerBlock;
  40. @property (nonatomic, assign, readonly) int numBlocks;
  41. @property (nonatomic, assign, readonly) int totalECCodewords;
  42. @property (nonatomic, strong, readonly) NSArray *ecBlocks;
  43. - (id)initWithEcCodewordsPerBlock:(int)ecCodewordsPerBlock ecBlocks:(ZXQRCodeECB *)ecBlocks;
  44. - (id)initWithEcCodewordsPerBlock:(int)ecCodewordsPerBlock ecBlocks1:(ZXQRCodeECB *)ecBlocks1 ecBlocks2:(ZXQRCodeECB *)ecBlocks2;
  45. + (ZXQRCodeECBlocks *)ecBlocksWithEcCodewordsPerBlock:(int)ecCodewordsPerBlock ecBlocks:(ZXQRCodeECB *)ecBlocks;
  46. + (ZXQRCodeECBlocks *)ecBlocksWithEcCodewordsPerBlock:(int)ecCodewordsPerBlock ecBlocks1:(ZXQRCodeECB *)ecBlocks1 ecBlocks2:(ZXQRCodeECB *)ecBlocks2;
  47. @end
  48. /**
  49. * Encapsualtes the parameters for one error-correction block in one symbol version.
  50. * This includes the number of data codewords, and the number of times a block with these
  51. * parameters is used consecutively in the QR code version's format.
  52. */
  53. @interface ZXQRCodeECB : NSObject
  54. @property (nonatomic, assign, readonly) int count;
  55. @property (nonatomic, assign, readonly) int dataCodewords;
  56. - (id)initWithCount:(int)count dataCodewords:(int)dataCodewords;
  57. + (ZXQRCodeECB *)ecbWithCount:(int)count dataCodewords:(int)dataCodewords;
  58. @end