Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ZXVINParsedResult.m 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "ZXVINParsedResult.h"
  17. @implementation ZXVINParsedResult
  18. - (id)initWithVIN:(NSString *)vin worldManufacturerID:(NSString *)worldManufacturerID
  19. vehicleDescriptorSection:(NSString *)vehicleDescriptorSection vehicleIdentifierSection:(NSString *)vehicleIdentifierSection
  20. countryCode:(NSString *)countryCode vehicleAttributes:(NSString *)vehicleAttributes modelYear:(int)modelYear
  21. plantCode:(unichar)plantCode sequentialNumber:(NSString *)sequentialNumber {
  22. if (self = [super initWithType:kParsedResultTypeVIN]) {
  23. _vin = vin;
  24. _worldManufacturerID = worldManufacturerID;
  25. _vehicleDescriptorSection = vehicleDescriptorSection;
  26. _vehicleIdentifierSection = vehicleIdentifierSection;
  27. _countryCode = countryCode;
  28. _vehicleAttributes = vehicleAttributes;
  29. _modelYear = modelYear;
  30. _plantCode = plantCode;
  31. _sequentialNumber = sequentialNumber;
  32. }
  33. return self;
  34. }
  35. - (NSString *)displayResult {
  36. NSMutableString *result = [NSMutableString stringWithCapacity:50];
  37. [result appendFormat:@"%@ ", self.worldManufacturerID];
  38. [result appendFormat:@"%@ ", self.vehicleDescriptorSection];
  39. [result appendFormat:@"%@\n", self.vehicleIdentifierSection];
  40. if (self.countryCode) {
  41. [result appendFormat:@"%@ ", self.countryCode];
  42. }
  43. [result appendFormat:@"%d ", self.modelYear];
  44. [result appendFormat:@"%C ", self.plantCode];
  45. [result appendFormat:@"%@\n", self.sequentialNumber];
  46. return [NSString stringWithString:result];
  47. }
  48. @end