|
| 1 | +// |
| 2 | +// DTLocalizableStringsParser.h |
| 3 | +// genstrings2 |
| 4 | +// |
| 5 | +// Created by Stefan Gugarel on 2/27/13. |
| 6 | +// Copyright (c) 2013 Drobnik KG. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | + |
| 10 | +@class DTLocalizableStringsParser; |
| 11 | + |
| 12 | +@protocol DTLocalizableStringsParserDelegate <NSObject> |
| 13 | + |
| 14 | +@optional |
| 15 | + |
| 16 | +/** |
| 17 | + Sent to the delegate for each comment block found |
| 18 | + */ |
| 19 | +- (void)parser:(DTLocalizableStringsParser *)parser foundComment:(NSString *)comment; |
| 20 | + |
| 21 | +/** |
| 22 | + Sent to the delegate for each comment block found |
| 23 | + */ |
| 24 | +- (void)parser:(DTLocalizableStringsParser *)parser foundKey:(NSString *)key value:(NSString *)value; |
| 25 | + |
| 26 | +/** |
| 27 | + Sent to the delegate once parsing has finished |
| 28 | + */ |
| 29 | +- (void)parserDidStartDocument:(DTLocalizableStringsParser *)parser; |
| 30 | + |
| 31 | +/** |
| 32 | +Sent to the delegate once parsing has finished |
| 33 | + */ |
| 34 | +- (void)parserDidEndDocument:(DTLocalizableStringsParser *)parser; |
| 35 | + |
| 36 | +/** |
| 37 | + Sent to the delegate if an error occurs |
| 38 | + */ |
| 39 | +- (void)parser:(DTLocalizableStringsParser *)parser parseErrorOccurred:(NSError *)parseError; |
| 40 | + |
| 41 | +@end |
| 42 | + |
| 43 | +/** |
| 44 | + Parser for strings files. You initialize it with a file URL, set a delegate and start parsing with parse. This returns `YES` in case of success. |
| 45 | + */ |
| 46 | +@interface DTLocalizableStringsParser : NSObject |
| 47 | + |
| 48 | +/** |
| 49 | + @name Creating a Parser |
| 50 | + */ |
| 51 | + |
| 52 | +/** |
| 53 | + Instantiates a strings file parser |
| 54 | + */ |
| 55 | +- (id)initWithFileURL:(NSURL *)url; |
| 56 | + |
| 57 | +/** |
| 58 | + @name Parsing File Contents |
| 59 | + */ |
| 60 | + |
| 61 | +/** |
| 62 | + Parses the file. |
| 63 | + */ |
| 64 | +- (BOOL)parse; |
| 65 | + |
| 66 | +/** |
| 67 | + The parser delegate |
| 68 | + */ |
| 69 | +@property (nonatomic, unsafe_unretained) id <DTLocalizableStringsParserDelegate> delegate; |
| 70 | + |
| 71 | +/** |
| 72 | + The last reported parse error |
| 73 | + */ |
| 74 | +@property (nonatomic, readonly) NSError *parseError; |
| 75 | + |
| 76 | +@end |
0 commit comments