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.

ZXRSSExpandedCurrentParsingState.m 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "ZXRSSExpandedCurrentParsingState.h"
  17. enum {
  18. ZX_NUMERIC_STATE,
  19. ZX_ALPHA_STATE,
  20. ZX_ISO_IEC_646_STATE
  21. };
  22. @interface ZXRSSExpandedCurrentParsingState ()
  23. @property (nonatomic, assign) int encoding;
  24. @end
  25. @implementation ZXRSSExpandedCurrentParsingState
  26. - (id)init {
  27. if (self = [super init]) {
  28. _position = 0;
  29. _encoding = ZX_NUMERIC_STATE;
  30. }
  31. return self;
  32. }
  33. - (BOOL)alpha {
  34. return self.encoding == ZX_ALPHA_STATE;
  35. }
  36. - (BOOL)numeric {
  37. return self.encoding == ZX_NUMERIC_STATE;
  38. }
  39. - (BOOL)isoIec646 {
  40. return self.encoding == ZX_ISO_IEC_646_STATE;
  41. }
  42. - (void)setNumeric {
  43. self.encoding = ZX_NUMERIC_STATE;
  44. }
  45. - (void)setAlpha {
  46. self.encoding = ZX_ALPHA_STATE;
  47. }
  48. - (void)setIsoIec646 {
  49. self.encoding = ZX_ISO_IEC_646_STATE;
  50. }
  51. @end