diff --git a/Classes/YAJLDocument.h b/Classes/YAJLDocument.h index 7890665..2fc9e2b 100644 --- a/Classes/YAJLDocument.h +++ b/Classes/YAJLDocument.h @@ -75,6 +75,12 @@ extern NSInteger YAJLDocumentStackCapacity; @param dict Dictionary object was set for key on */ - (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict; + +/*! + Did reach the end of document. + @param document Sender + */ +- (void)didEndDocument:(YAJLDocument *)document; @end /*! diff --git a/Classes/YAJLDocument.m b/Classes/YAJLDocument.m index 382c172..e8f5cd8 100644 --- a/Classes/YAJLDocument.m +++ b/Classes/YAJLDocument.m @@ -172,6 +172,10 @@ - (void)_pop { dict_ = (NSMutableDictionary *)value; currentType_ = YAJLDecoderCurrentTypeDict; } + if ([stack_ count] == 0) { + if ([delegate_ respondsToSelector:@selector(didEndDocument:)]) + [delegate_ didEndDocument:self]; + } } @end