SBJsonStreamParserState.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. Copyright (c) 2010, Stig Brautaset.
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. Neither the name of the the author nor the names of its contributors
  13. may be used to endorse or promote products derived from this software
  14. without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  16. IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  17. TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  18. PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19. HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #import <Foundation/Foundation.h>
  28. #import "SBJsonTokeniser.h"
  29. #import "SBJsonStreamParser.h"
  30. @interface SBJsonStreamParserState : NSObject
  31. + (id)sharedInstance;
  32. - (BOOL)parser:(SBJsonStreamParser*)parser shouldAcceptToken:(sbjson_token_t)token;
  33. - (SBJsonStreamParserStatus)parserShouldReturn:(SBJsonStreamParser*)parser;
  34. - (void)parser:(SBJsonStreamParser*)parser shouldTransitionTo:(sbjson_token_t)tok;
  35. - (BOOL)needKey;
  36. - (BOOL)isError;
  37. - (NSString*)name;
  38. @end
  39. @interface SBJsonStreamParserStateStart : SBJsonStreamParserState
  40. @end
  41. @interface SBJsonStreamParserStateComplete : SBJsonStreamParserState
  42. @end
  43. @interface SBJsonStreamParserStateError : SBJsonStreamParserState
  44. @end
  45. @interface SBJsonStreamParserStateObjectStart : SBJsonStreamParserState
  46. @end
  47. @interface SBJsonStreamParserStateObjectGotKey : SBJsonStreamParserState
  48. @end
  49. @interface SBJsonStreamParserStateObjectSeparator : SBJsonStreamParserState
  50. @end
  51. @interface SBJsonStreamParserStateObjectGotValue : SBJsonStreamParserState
  52. @end
  53. @interface SBJsonStreamParserStateObjectNeedKey : SBJsonStreamParserState
  54. @end
  55. @interface SBJsonStreamParserStateArrayStart : SBJsonStreamParserState
  56. @end
  57. @interface SBJsonStreamParserStateArrayGotValue : SBJsonStreamParserState
  58. @end
  59. @interface SBJsonStreamParserStateArrayNeedValue : SBJsonStreamParserState
  60. @end