Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ZXQRCodeEncoder.h 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 ZXBitArray, ZXByteArray, ZXEncodeHints, ZXQRCode, ZXQRCodeErrorCorrectionLevel, ZXQRCodeMode, ZXQRCodeVersion;
  17. extern const NSStringEncoding ZX_DEFAULT_BYTE_MODE_ENCODING;
  18. @interface ZXQRCodeEncoder : NSObject
  19. /**
  20. * Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen
  21. * internally by chooseMode:. On success, store the result in "qrCode".
  22. *
  23. * We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for
  24. * "getECLevel" since our primary use is to show QR code on desktop screens. We don't need very
  25. * strong error correction for this purpose.
  26. *
  27. * Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode()
  28. * with which clients can specify the encoding mode. For now, we don't need the functionality.
  29. */
  30. + (ZXQRCode *)encode:(NSString *)content ecLevel:(ZXQRCodeErrorCorrectionLevel *)ecLevel error:(NSError **)error;
  31. + (ZXQRCode *)encode:(NSString *)content ecLevel:(ZXQRCodeErrorCorrectionLevel *)ecLevel hints:(ZXEncodeHints *)hints error:(NSError **)error;
  32. /**
  33. * Return the code point of the table used in alphanumeric mode or
  34. * -1 if there is no corresponding code in the table.
  35. */
  36. + (int)alphanumericCode:(int)code;
  37. /**
  38. * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).
  39. */
  40. + (BOOL)terminateBits:(int)numDataBytes bits:(ZXBitArray *)bits error:(NSError **)error;
  41. /**
  42. * Get number of data bytes and number of error correction bytes for block id "blockID". Store
  43. * the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of
  44. * JISX0510:2004 (p.30)
  45. */
  46. + (BOOL)numDataBytesAndNumECBytesForBlockID:(int)numTotalBytes numDataBytes:(int)numDataBytes numRSBlocks:(int)numRSBlocks blockID:(int)blockID numDataBytesInBlock:(int[])numDataBytesInBlock numECBytesInBlock:(int[])numECBytesInBlock error:(NSError **)error;
  47. /**
  48. * Interleave "bits" with corresponding error correction bytes. On success, store the result in
  49. * "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.
  50. */
  51. + (ZXBitArray *)interleaveWithECBytes:(ZXBitArray *)bits numTotalBytes:(int)numTotalBytes numDataBytes:(int)numDataBytes numRSBlocks:(int)numRSBlocks error:(NSError **)error;
  52. + (ZXByteArray *)generateECBytes:(ZXByteArray *)dataBytes numEcBytesInBlock:(int)numEcBytesInBlock;
  53. /**
  54. * Append mode info. On success, store the result in "bits".
  55. */
  56. + (void)appendModeInfo:(ZXQRCodeMode *)mode bits:(ZXBitArray *)bits;
  57. /**
  58. * Append length info. On success, store the result in "bits".
  59. */
  60. + (BOOL)appendLengthInfo:(int)numLetters version:(ZXQRCodeVersion *)version mode:(ZXQRCodeMode *)mode bits:(ZXBitArray *)bits error:(NSError **)error;
  61. /**
  62. * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
  63. */
  64. + (BOOL)appendBytes:(NSString *)content mode:(ZXQRCodeMode *)mode bits:(ZXBitArray *)bits encoding:(NSStringEncoding)encoding error:(NSError **)error;
  65. + (void)appendNumericBytes:(NSString *)content bits:(ZXBitArray *)bits;
  66. + (BOOL)appendAlphanumericBytes:(NSString *)content bits:(ZXBitArray *)bits error:(NSError **)error;
  67. + (void)append8BitBytes:(NSString *)content bits:(ZXBitArray *)bits encoding:(NSStringEncoding)encoding;
  68. + (BOOL)appendKanjiBytes:(NSString *)content bits:(ZXBitArray *)bits error:(NSError **)error;
  69. @end