Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2014 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 "ZXAztecBinaryShiftToken.h"
  17. #import "ZXAztecSimpleToken.h"
  18. #import "ZXAztecToken.h"
  19. #import "ZXBitArray.h"
  20. @implementation ZXAztecToken
  21. - (id)initWithPrevious:(ZXAztecToken *)previous {
  22. if (self = [super init]) {
  23. _previous = previous;
  24. }
  25. return self;
  26. }
  27. + (ZXAztecToken *)empty {
  28. return [[ZXAztecSimpleToken alloc] initWithPrevious:nil value:0 bitCount:0];
  29. }
  30. - (ZXAztecToken *)add:(int)value bitCount:(int)bitCount {
  31. return [[ZXAztecSimpleToken alloc] initWithPrevious:self value:value bitCount:bitCount];
  32. }
  33. - (ZXAztecToken *)addBinaryShift:(int)start byteCount:(int)byteCount {
  34. // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
  35. return [[ZXAztecBinaryShiftToken alloc] initWithPrevious:self binaryShiftStart:start binaryShiftByteCount:byteCount];
  36. }
  37. - (void)appendTo:(ZXBitArray *)bitArray text:(ZXByteArray *)text {
  38. @throw [NSException exceptionWithName:NSInternalInconsistencyException
  39. reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]
  40. userInfo:nil];
  41. }
  42. @end