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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 ZXParsedResult, ZXResult;
  17. /**
  18. * Abstract class representing the result of decoding a barcode, as more than
  19. * a String -- as some type of structured data. This might be a subclass which represents
  20. * a URL, or an e-mail address. parseResult() will turn a raw
  21. * decoded string into the most appropriate type of structured representation.
  22. *
  23. * Thanks to Jeff Griffin for proposing rewrite of these classes that relies less
  24. * on exception-based mechanisms during parsing.
  25. */
  26. @interface ZXResultParser : NSObject
  27. /**
  28. * Attempts to parse the raw ZXResult's contents as a particular type
  29. * of information (email, URL, etc.) and return a ZXParsedResult encapsulating
  30. * the result of parsing.
  31. */
  32. - (ZXParsedResult *)parse:(ZXResult *)result;
  33. + (NSString *)massagedText:(ZXResult *)result;
  34. + (ZXParsedResult *)parseResult:(ZXResult *)theResult;
  35. - (void)maybeAppend:(NSString *)value result:(NSMutableString *)result;
  36. - (void)maybeAppendArray:(NSArray *)value result:(NSMutableString *)result;
  37. - (NSArray *)maybeWrap:(NSString *)value;
  38. + (BOOL)isStringOfDigits:(NSString *)value length:(unsigned int)length;
  39. + (BOOL)isSubstringOfDigits:(NSString *)value offset:(int)offset length:(int)length;
  40. + (int)parseHexDigit:(unichar)c;
  41. - (NSMutableDictionary *)parseNameValuePairs:(NSString *)uri;
  42. + (NSString *)urlDecode:(NSString *)encoded;
  43. + (NSArray *)matchPrefixedField:(NSString *)prefix rawText:(NSString *)rawText endChar:(unichar)endChar trim:(BOOL)trim;
  44. + (NSString *)matchSinglePrefixedField:(NSString *)prefix rawText:(NSString *)rawText endChar:(unichar)endChar trim:(BOOL)trim;
  45. @end