Skip to content

Commit

Permalink
added property on YAJLParser to get the number of bytes consumed afte…
Browse files Browse the repository at this point in the history
…r parsing
  • Loading branch information
pegli committed Jun 12, 2013
1 parent 29c9179 commit db9e039
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Classes/YAJLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ typedef NSUInteger YAJLParserStatus; //!< Status of the last parse event
@property (assign, nonatomic) id <YAJLParserDelegate> delegate;
@property (readonly, retain, nonatomic) NSError *parserError;
@property (readonly, nonatomic) YAJLParserOptions parserOptions;
@property (readonly, nonatomic) unsigned int bytesConsumed;

/*!
Create parser with data and options.
Expand Down
4 changes: 4 additions & 0 deletions Classes/YAJLParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ - (void)_endArray {

//! @endinternal

- (unsigned int)bytesConsumed {
return handle_ ? yajl_get_bytes_consumed(handle_) : 0;
}

- (YAJLParserStatus)parse:(NSData *)data {
if (!handle_) {
yajl_parser_config cfg = {
Expand Down

0 comments on commit db9e039

Please sign in to comment.