Created
March 2, 2010 01:44
-
-
Save takuma104/319038 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void indentedMsg(int indent, NSString *str) { | |
NSMutableString *idt = [NSMutableString string]; | |
for (int i = 0; i < indent; i++) { | |
[idt appendString:@" "]; | |
} | |
NSLog(@"%@%@", idt, str); | |
} | |
- (void)parserDidStartDictionary:(YAJLParser *)parser { | |
indentedMsg(indent, @"dict>"); | |
indent++; | |
} | |
- (void)parserDidEndDictionary:(YAJLParser *)parser { | |
indent--; | |
indentedMsg(indent, @"<dict"); | |
} | |
- (void)parserDidStartArray:(YAJLParser *)parser { | |
indentedMsg(indent, @"array>"); | |
indent++; | |
} | |
- (void)parserDidEndArray:(YAJLParser *)parser { | |
indent--; | |
indentedMsg(indent, @"<array"); | |
} | |
- (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key { | |
indentedMsg(indent, [NSString stringWithFormat:@"key:%@", key]); | |
} | |
- (void)parser:(YAJLParser *)parser didAdd:(id)value { | |
indentedMsg(indent, [NSString stringWithFormat:@"val:%@", value]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment