diff --git a/Example/HppleDemo.xcodeproj/project.pbxproj b/Example/HppleDemo.xcodeproj/project.pbxproj index 1522f96..971721f 100644 --- a/Example/HppleDemo.xcodeproj/project.pbxproj +++ b/Example/HppleDemo.xcodeproj/project.pbxproj @@ -218,7 +218,7 @@ AD210CDA1A249B34007EB02E /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 1150; TargetAttributes = { AD210CE11A249B34007EB02E = { CreatedOnToolsVersion = 6.1; @@ -231,7 +231,7 @@ }; buildConfigurationList = AD210CDD1A249B34007EB02E /* Build configuration list for PBXProject "HppleDemo" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -328,24 +328,37 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -369,17 +382,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -387,6 +411,7 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -411,6 +436,7 @@ ); INFOPLIST_FILE = HppleDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "hpple.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -426,6 +452,7 @@ ); INFOPLIST_FILE = HppleDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "hpple.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -444,6 +471,7 @@ ); INFOPLIST_FILE = HppleDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "hpple.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HppleDemo.app/HppleDemo"; }; @@ -459,6 +487,7 @@ ); INFOPLIST_FILE = HppleDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "hpple.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HppleDemo.app/HppleDemo"; }; diff --git a/Example/HppleDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/HppleDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/HppleDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/HppleDemo/Info.plist b/Example/HppleDemo/Info.plist index dabe407..6905cc6 100644 --- a/Example/HppleDemo/Info.plist +++ b/Example/HppleDemo/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - hpple.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Example/HppleDemoTests/Info.plist b/Example/HppleDemoTests/Info.plist index db97c7a..ba72822 100644 --- a/Example/HppleDemoTests/Info.plist +++ b/Example/HppleDemoTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - hpple.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Pod/Classes/TFHpple.h b/Pod/Classes/TFHpple.h index 0cb8870..660c896 100644 --- a/Pod/Classes/TFHpple.h +++ b/Pod/Classes/TFHpple.h @@ -29,29 +29,32 @@ #import - #import "TFHppleElement.h" +NS_ASSUME_NONNULL_BEGIN + @interface TFHpple : NSObject -- (id) initWithData:(NSData *)theData encoding:(NSString *)encoding isXML:(BOOL)isDataXML; +- (id) initWithData:(NSData *)theData encoding:(nullable NSString *)encoding isXML:(BOOL)isDataXML; - (id) initWithData:(NSData *)theData isXML:(BOOL)isDataXML; - (id) initWithXMLData:(NSData *)theData encoding:(NSString *)encoding; - (id) initWithXMLData:(NSData *)theData; - (id) initWithHTMLData:(NSData *)theData encoding:(NSString *)encoding; - (id) initWithHTMLData:(NSData *)theData; -+ (TFHpple *) hppleWithData:(NSData *)theData encoding:(NSString *)encoding isXML:(BOOL)isDataXML; ++ (TFHpple *) hppleWithData:(NSData *)theData encoding:(nullable NSString *)encoding isXML:(BOOL)isDataXML; + (TFHpple *) hppleWithData:(NSData *)theData isXML:(BOOL)isDataXML; + (TFHpple *) hppleWithXMLData:(NSData *)theData encoding:(NSString *)encoding; + (TFHpple *) hppleWithXMLData:(NSData *)theData; + (TFHpple *) hppleWithHTMLData:(NSData *)theData encoding:(NSString *)encoding; + (TFHpple *) hppleWithHTMLData:(NSData *)theData; -- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS; -- (TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS; +- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS; +- (nullable TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS; @property (nonatomic, readonly) NSData * data; @property (nonatomic, readonly) NSString * encoding; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/TFHppleElement.h b/Pod/Classes/TFHppleElement.h index 5af1232..3dac517 100644 --- a/Pod/Classes/TFHppleElement.h +++ b/Pod/Classes/TFHppleElement.h @@ -29,19 +29,20 @@ #import +NS_ASSUME_NONNULL_BEGIN @interface TFHppleElement : NSObject -- (id) initWithNode:(NSDictionary *) theNode isXML:(BOOL)isDataXML withEncoding:(NSString *)theEncoding; +- (id) initWithNode:(NSDictionary *) theNode isXML:(BOOL)isDataXML withEncoding:(nullable NSString *)theEncoding; -+ (TFHppleElement *) hppleElementWithNode:(NSDictionary *) theNode isXML:(BOOL)isDataXML withEncoding:(NSString *)theEncoding; ++ (TFHppleElement *) hppleElementWithNode:(NSDictionary *) theNode isXML:(BOOL)isDataXML withEncoding:(nullable NSString *)theEncoding; @property (nonatomic, copy, readonly) NSString *raw; // Returns this tag's innerHTML content. -@property (nonatomic, copy, readonly) NSString *content; +@property (nonatomic, copy, readonly, nullable) NSString *content; // Returns the name of the current tag, such as "h3". -@property (nonatomic, copy, readonly) NSString *tagName; +@property (nonatomic, copy, readonly, nullable) NSString *tagName; // Returns tag attributes with name as key and content as value. // href = 'http://peepcode.com' @@ -52,7 +53,7 @@ @property (nonatomic, strong, readonly) NSArray *children; // Returns the first child of a given node -@property (nonatomic, strong, readonly) TFHppleElement *firstChild; +@property (nonatomic, strong, readonly, nullable) TFHppleElement *firstChild; // the parent of a node @property (nonatomic, unsafe_unretained, readonly) TFHppleElement *parent; @@ -66,41 +67,43 @@ // Provides easy access to the content of a specific attribute, // such as 'href' or 'class'. -- (NSString *) objectForKey:(NSString *) theKey; +- (nullable NSString *) objectForKey:(NSString *) theKey; // Returns the children whose tag name equals the given string // (comparison is performed with NSString's isEqualToString) // Returns an empty array if no matching child is found -- (NSArray *) childrenWithTagName:(NSString *)tagName; +- (NSArray *) childrenWithTagName:(NSString *)tagName; // Returns the first child node whose tag name equals the given string // (comparison is performed with NSString's isEqualToString) // Returns nil if no matching child is found -- (TFHppleElement *) firstChildWithTagName:(NSString *)tagName; +- (nullable TFHppleElement *) firstChildWithTagName:(NSString *)tagName; // Returns the children whose class equals the given string // (comparison is performed with NSString's isEqualToString) // Returns an empty array if no matching child is found -- (NSArray *) childrenWithClassName:(NSString *)className; +- (NSArray *) childrenWithClassName:(NSString *)className; // Returns the first child whose class requals the given string // (comparison is performed with NSString's isEqualToString) // Returns nil if no matching child is found -- (TFHppleElement *) firstChildWithClassName:(NSString*)className; +- (nullable TFHppleElement *) firstChildWithClassName:(NSString*)className; // Returns the first text node from this element's children // Returns nil if there is no text node among the children -- (TFHppleElement *) firstTextChild; +- (nullable TFHppleElement *) firstTextChild; // Returns the string contained by the first text node from this element's children // Convenience method which can be used instead of firstTextChild.content -- (NSString *) text; +- (nullable NSString *) text; // Returns elements searched with xpath -- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS; +- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS; // Custom keyed subscripting -- (id)objectForKeyedSubscript:(id)key; +- (nullable id)objectForKeyedSubscript:(id)key; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/XPathQuery.h b/Pod/Classes/XPathQuery.h index 85ed571..fc0ba54 100644 --- a/Pod/Classes/XPathQuery.h +++ b/Pod/Classes/XPathQuery.h @@ -8,7 +8,11 @@ #import -NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query); -NSArray *PerformHTMLXPathQueryWithEncoding(NSData *document, NSString *query,NSString *encoding); -NSArray *PerformXMLXPathQuery(NSData *document, NSString *query); -NSArray *PerformXMLXPathQueryWithEncoding(NSData *document, NSString *query,NSString *encoding); +NS_ASSUME_NONNULL_BEGIN + +NSArray * _Nullable PerformHTMLXPathQuery(NSData *document, NSString *query); +NSArray * _Nullable PerformHTMLXPathQueryWithEncoding(NSData *document, NSString *query, NSString * _Nullable encoding); +NSArray * _Nullable PerformXMLXPathQuery(NSData *document, NSString *query); +NSArray * _Nullable PerformXMLXPathQueryWithEncoding(NSData *document, NSString *query, NSString * _Nullable encoding); + +NS_ASSUME_NONNULL_END