Reintroduce the HTMLNodeFilterValue for Tree Walker implementation

While the Node Iterator treats skip & reject the same way, the Tree Walker can skip over a node
and all its children if rejected.

This reverses dc3de7a470
This commit is contained in:
iska
2015-06-05 23:00:50 +02:00
parent 0c82f6891b
commit a390edf599
10 changed files with 61 additions and 50 deletions
+10 -3
View File
@@ -8,6 +8,13 @@
#import <Foundation/Foundation.h>
typedef NS_ENUM(unsigned short, HTMLNodeFilterValue)
{
HTMLNodeFilterAccept = 1,
HTMLNodeFilterReject = 2,
HTMLNodeFilterSkip = 3
};
typedef NS_ENUM(unsigned long, HTMLNodeFilterShowOptions)
{
HTMLNodeFilterShowAll = 0xFFFFFFFF,
@@ -23,12 +30,12 @@ typedef NS_ENUM(unsigned long, HTMLNodeFilterShowOptions)
@protocol HTMLNodeFilter <NSObject>
- (BOOL)acceptNode:(HTMLNode *)node;
- (HTMLNodeFilterValue)acceptNode:(HTMLNode *)node;
@end
@interface HTMLNodeFilterBlock : NSObject <HTMLNodeFilter>
+ (instancetype)filterWithBlock:(BOOL (^)(HTMLNode *node))block;
+ (instancetype)filterWithBlock:(HTMLNodeFilterValue (^)(HTMLNode *node))block;
@end
@end