Replace nullability specifiers from methods and properties with nullability-regions
This commit is contained in:
@@ -9,30 +9,22 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CSSSelector.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, CSSAttributeSelectorType)
|
||||
{
|
||||
CSSAttributeSelectorExists,
|
||||
CSSAttributeSelectorExactMatch,
|
||||
CSSAttributeSelectorIncludes,
|
||||
CSSAttributeSelectorBegins,
|
||||
CSSAttributeSelectorEnds,
|
||||
CSSAttributeSelectorContains,
|
||||
CSSAttributeSelectorHyphen,
|
||||
CSSAttributeSelectorNot
|
||||
};
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CSSAttributeSelector : CSSSelector
|
||||
|
||||
@property (nonatomic, assign) CSSAttributeSelectorType type;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull name;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull value;
|
||||
@property (nonatomic, strong, readonly) NSString *name;
|
||||
@property (nonatomic, strong, readonly) NSString *value;
|
||||
|
||||
+ (nullable instancetype)classSelector:(nonnull NSString *)className;
|
||||
+ (nullable instancetype)idSelector:(nonnull NSString *)elementId;
|
||||
+ (nullable instancetype)attributeSelector:(nonnull NSString *)attributeName;
|
||||
+ (instancetype)classSelector:(NSString *)className;
|
||||
+ (instancetype)idSelector:(NSString *)elementId;
|
||||
+ (instancetype)hasAttributeSelector:(NSString *)attributeName;
|
||||
|
||||
- (nullable instancetype)initWithType:(CSSAttributeSelectorType)type
|
||||
attributeName:(nonnull NSString *)name
|
||||
attrbiuteValue:(nonnull NSString *)value;
|
||||
- (instancetype)initWithType:(CSSAttributeSelectorType)type
|
||||
attributeName:(NSString *)name
|
||||
attrbiuteValue:(NSString *)value;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
return [[self alloc] initWithType:CSSAttributeSelectorExactMatch attributeName:@"id" attrbiuteValue:elementId];
|
||||
}
|
||||
|
||||
+ (nullable instancetype)attributeSelector:(nonnull NSString *)attributeName
|
||||
+ (instancetype)hasAttributeSelector:(NSString *)attributeName
|
||||
{
|
||||
return [[self alloc] initWithType:CSSAttributeSelectorExists attributeName:attributeName attrbiuteValue:@""];
|
||||
}
|
||||
|
||||
@@ -8,11 +8,15 @@
|
||||
|
||||
#import "CSSSelector.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CSSCombinatorSelector : CSSSelector
|
||||
|
||||
+ (nullable instancetype)childOfElementCombinator:(nonnull CSSSelector *)selector;
|
||||
+ (nullable instancetype)descendantOfElementCombinator:(nonnull CSSSelector *)selector;
|
||||
+ (nullable instancetype)adjacentSiblingCombinator:(nonnull CSSSelector *)selector;
|
||||
+ (nullable instancetype)generalSiblingCombinator:(nonnull CSSSelector *)selector;
|
||||
+ (instancetype)childOfElementCombinator:(CSSSelector *)selector;
|
||||
+ (instancetype)descendantOfElementCombinator:(CSSSelector *)selector;
|
||||
+ (instancetype)adjacentSiblingCombinator:(CSSSelector *)selector;
|
||||
+ (instancetype)generalSiblingCombinator:(CSSSelector *)selector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -35,22 +35,22 @@
|
||||
@implementation CSSCombinatorSelector
|
||||
@synthesize selector = _selector;
|
||||
|
||||
+ (nullable instancetype)childOfElementCombinator:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)childOfElementCombinator:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSChildOfElementCombinatorSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
|
||||
+ (nullable instancetype)descendantOfElementCombinator:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)descendantOfElementCombinator:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSDecendantOfElementCombinatorSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
|
||||
+ (nullable instancetype)adjacentSiblingCombinator:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)adjacentSiblingCombinator:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSAdjacentSiblingCombinatorSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
|
||||
+ (nullable instancetype)generalSiblingCombinator:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)generalSiblingCombinator:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSGeneralSiblingCombinatorSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
- (NSString *)debugDescription
|
||||
{
|
||||
return @" > ";
|
||||
return @">";
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
- (NSString *)debugDescription
|
||||
{
|
||||
return @" + ";
|
||||
return @"+";
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -148,7 +148,7 @@
|
||||
|
||||
- (NSString *)debugDescription
|
||||
{
|
||||
return @" ~ ";
|
||||
return @"~";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,9 +8,13 @@
|
||||
|
||||
#import "CSSSelector.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CSSCompoundSelector : CSSSelector
|
||||
|
||||
+ (nullable instancetype)andSelector:(nonnull NSArray<CSSSelector *> *)selectors;
|
||||
+ (nullable instancetype)orSelector:(nonnull NSArray<CSSSelector *> *)selectors;
|
||||
+ (instancetype)andSelector:(NSArray<CSSSelector *> *)selectors;
|
||||
+ (instancetype)orSelector:(NSArray<CSSSelector *> *)selectors;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
//
|
||||
|
||||
#import "CSSSelector.h"
|
||||
#import "CSSSimpleSelector.h"
|
||||
|
||||
@interface CSSPseudoClassSelector : NSObject <CSSSimpleSelector>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull className;
|
||||
@interface CSSPseudoClassSelector : CSSSelector
|
||||
|
||||
- (nullable instancetype)initWithClassName:(nonnull NSString *)className
|
||||
andBlock:(nonnull CSSSelectorAcceptElementBlock)block;
|
||||
@property (nonatomic, strong, readonly) NSString *className;
|
||||
|
||||
- (instancetype)initWithClassName:(NSString *)className selector:(CSSSelector *)selector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,35 +7,30 @@
|
||||
//
|
||||
|
||||
#import "CSSPseudoClassSelector.h"
|
||||
#import "HTMLElement.h"
|
||||
#import "NSString+HTMLKit.h"
|
||||
|
||||
@interface CSSPseudoClassSelector ()
|
||||
{
|
||||
CSSSelectorAcceptElementBlock _block;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface CSSPseudoClassSelector ()
|
||||
{
|
||||
NSString *_className;
|
||||
CSSSelector *_selector;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CSSPseudoClassSelector
|
||||
@synthesize className = _className;
|
||||
|
||||
- (instancetype)initWithClassName:(NSString *)className andBlock:(CSSSelectorAcceptElementBlock)block
|
||||
- (instancetype)initWithClassName:(NSString *)className selector:(CSSSelector *)selector
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_block = block;
|
||||
_className = [className copy];
|
||||
_selector = selector;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(BOOL)acceptElement:(HTMLElement *)element
|
||||
{
|
||||
return _block ? _block(element) : NO;
|
||||
return [_selector acceptElement:element];
|
||||
}
|
||||
|
||||
- (NSString *)debugDescription
|
||||
|
||||
@@ -8,9 +8,13 @@
|
||||
|
||||
#import "CSSSelector.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CSSPseudoFunctionSelector : CSSSelector
|
||||
|
||||
+ (nullable instancetype)notSelector:(nonnull CSSSelector *)selector;
|
||||
+ (nullable instancetype)hasSelector:(nonnull CSSSelector *)selector;
|
||||
+ (instancetype)notSelector:(CSSSelector *)selector;
|
||||
+ (instancetype)hasSelector:(CSSSelector *)selector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
@implementation CSSPseudoFunctionSelector
|
||||
@synthesize selector = _selector;
|
||||
|
||||
+ (nullable instancetype)notSelector:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)notSelector:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSNotSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
|
||||
+ (nullable instancetype)hasSelector:(nonnull CSSSelector *)selector
|
||||
+ (instancetype)hasSelector:(CSSSelector *)selector
|
||||
{
|
||||
return [[CSSHasSelector alloc] initWithSelector:selector];
|
||||
}
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CSSSelector.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CSSTypeSelector : CSSSelector
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull type;
|
||||
@property (nonatomic, strong, readonly) NSString *type;
|
||||
|
||||
+ (nullable instancetype)universalSelector;
|
||||
+ (instancetype)universalSelector;
|
||||
|
||||
- (nullable instancetype)initWithType:(nonnull NSString *)type;
|
||||
- (instancetype)initWithType:(NSString *)type;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
Reference in New Issue
Block a user