Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 "ZXByteMatrix.h"
  17. #import "ZXQRCode.h"
  18. #import "ZXQRCodeErrorCorrectionLevel.h"
  19. #import "ZXQRCodeMode.h"
  20. const int ZX_NUM_MASK_PATTERNS = 8;
  21. @implementation ZXQRCode
  22. - (id)init {
  23. if (self = [super init]) {
  24. _mode = nil;
  25. _ecLevel = nil;
  26. _version = nil;
  27. _maskPattern = -1;
  28. _matrix = nil;
  29. }
  30. return self;
  31. }
  32. - (NSString *)description {
  33. NSMutableString *result = [NSMutableString stringWithCapacity:200];
  34. [result appendFormat:@"<<\n mode: %@", self.mode];
  35. [result appendFormat:@"\n ecLevel: %@", self.ecLevel];
  36. [result appendFormat:@"\n version: %@", self.version];
  37. [result appendFormat:@"\n maskPattern: %d", self.maskPattern];
  38. if (self.matrix == nil) {
  39. [result appendString:@"\n matrix: (null)\n"];
  40. } else {
  41. [result appendFormat:@"\n matrix:\n%@", [self.matrix description]];
  42. }
  43. [result appendString:@">>\n"];
  44. return [NSString stringWithString:result];
  45. }
  46. // Check if "mask_pattern" is valid.
  47. + (BOOL)isValidMaskPattern:(int)maskPattern {
  48. return maskPattern >= 0 && maskPattern < ZX_NUM_MASK_PATTERNS;
  49. }
  50. @end