Revision: 29021 http://sourceforge.net/p/bibdesk/svn/29021 Author: hofman Date: 2025-02-18 17:11:28 +0000 (Tue, 18 Feb 2025) Log Message: ----------- add nullability to web parser classes
Modified Paths: -------------- trunk/bibdesk/BDSKACLParser.h trunk/bibdesk/BDSKACMDLParser.h trunk/bibdesk/BDSKArxivParser.h trunk/bibdesk/BDSKAsynchronousWebParser.h trunk/bibdesk/BDSKBibTeXWebParser.h trunk/bibdesk/BDSKCOinSParser.h trunk/bibdesk/BDSKCiteULikeParser.h trunk/bibdesk/BDSKDOIWebParser.h trunk/bibdesk/BDSKGoogleScholarParser.h trunk/bibdesk/BDSKHCiteParser.h trunk/bibdesk/BDSKHubmedParser.h trunk/bibdesk/BDSKIACRParser.h trunk/bibdesk/BDSKIEEEXploreParser.h trunk/bibdesk/BDSKIUCrParser.h trunk/bibdesk/BDSKInspireParser.h trunk/bibdesk/BDSKJSTORWebParser.h trunk/bibdesk/BDSKMASParser.h trunk/bibdesk/BDSKMathSciNetParser.h trunk/bibdesk/BDSKNumdamParser.h trunk/bibdesk/BDSKProjectEuclidParser.h trunk/bibdesk/BDSKSIAMParser.h trunk/bibdesk/BDSKScienceDirectParser.h trunk/bibdesk/BDSKSpringerParser.h trunk/bibdesk/BDSKWebParser.h trunk/bibdesk/BDSKZentralblattParser.h Modified: trunk/bibdesk/BDSKACLParser.h =================================================================== --- trunk/bibdesk/BDSKACLParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKACLParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,5 +38,9 @@ #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN + @interface BDSKACLParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKACMDLParser.h =================================================================== --- trunk/bibdesk/BDSKACMDLParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKACMDLParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,8 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKACMDLParser : BDSKAsynchronousWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKArxivParser.h =================================================================== --- trunk/bibdesk/BDSKArxivParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKArxivParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKArxivParser : BDSKWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKAsynchronousWebParser.h =================================================================== --- trunk/bibdesk/BDSKAsynchronousWebParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKAsynchronousWebParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,11 +39,13 @@ #import <Cocoa/Cocoa.h> #import "BDSKWebParser.h" +NS_ASSUME_NONNULL_BEGIN + @class BDSKCitationDownload; @protocol BDSKCitationDownloadDelegate <NSObject> - (void)downloadDidFinish:(BDSKCitationDownload *)download; -- (NSWindow *)citationDownloadWindowForAuthenticationSheet:(BDSKCitationDownload *)download; +- (nullable NSWindow *)citationDownloadWindowForAuthenticationSheet:(BDSKCitationDownload *)download; @end #pragma mark - @@ -60,19 +62,19 @@ // Cet the URL string pointing to the bibTeX data from the node found by citationNodeXPath // Can be a relative URL, which is completed using the URL of the web page // By default returns the href attribute of the node -+ (NSString *)citationURLStringFromNode:(DOMNode *)node; ++ (nullable NSString *)citationURLStringFromNode:(DOMNode *)node; // Subclasses can also override -itemsReturningError: adding downloads themselves using the following -- (void)addDownloadWithRequest:(NSURLRequest *)request contextInfo:(id)contextInfo; +- (void)addDownloadWithRequest:(NSURLRequest *)request contextInfo:(nullable id)contextInfo; // Main method to get items from the downloaded citations // The default parses the bibtex string returned from -bibTeXStringFromDownload: for a single item // Subclasses can also override this for custom handling of the download data -- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError **)outError; +- (nullable NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError **)outError; // Helper method to return the bibtex string from the download, defaults to the string property // Subclasses can override this to do some cleaning -- (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download; +- (nullable NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download; @end @@ -88,13 +90,13 @@ id contextInfo; } -- (instancetype)initWithRequest:(NSURLRequest *)aRequest delegate:(id<BDSKCitationDownloadDelegate>)aDelegate contextInfo:(id)aContextInfo; +- (instancetype)initWithRequest:(NSURLRequest *)aRequest delegate:(nullable id<BDSKCitationDownloadDelegate>)aDelegate contextInfo:(nullable id)aContextInfo; @property (nonatomic, readonly) NSURL *URL; -@property (nonatomic, readonly) NSData *data; -@property (nonatomic, readonly) NSString *string; -@property (nonatomic, readonly) NSError *error; -@property (nonatomic, readonly) id contextInfo; +@property (nonatomic, nullable, readonly) NSData *data; +@property (nonatomic, nullable, readonly) NSString *string; +@property (nonatomic, nullable, readonly) NSError *error; +@property (nonatomic, nullable, readonly) id contextInfo; - (void)start; - (void)cancel; @@ -101,3 +103,4 @@ @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKBibTeXWebParser.h =================================================================== --- trunk/bibdesk/BDSKBibTeXWebParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKBibTeXWebParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,7 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKBibTeXWebParser : BDSKWebParser @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKCOinSParser.h =================================================================== --- trunk/bibdesk/BDSKCOinSParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKCOinSParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -41,5 +41,9 @@ #import "BibItem.h" #import "BDSKWebParser.h" +NS_ASSUME_NONNULL_BEGIN + @interface BDSKCOinSParser : BDSKWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKCiteULikeParser.h =================================================================== --- trunk/bibdesk/BDSKCiteULikeParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKCiteULikeParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,7 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN + @interface BDSKCiteULikeParser : BDSKAsynchronousWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKDOIWebParser.h =================================================================== --- trunk/bibdesk/BDSKDOIWebParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKDOIWebParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,6 +38,9 @@ #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKDOIWebParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKGoogleScholarParser.h =================================================================== --- trunk/bibdesk/BDSKGoogleScholarParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKGoogleScholarParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,8 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKGoogleScholarParser : BDSKAsynchronousWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKHCiteParser.h =================================================================== --- trunk/bibdesk/BDSKHCiteParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKHCiteParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,8 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKHCiteParser : BDSKWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKHubmedParser.h =================================================================== --- trunk/bibdesk/BDSKHubmedParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKHubmedParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,8 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKHubmedParser : BDSKAsynchronousWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKIACRParser.h =================================================================== --- trunk/bibdesk/BDSKIACRParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKIACRParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKIACRParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKIEEEXploreParser.h =================================================================== --- trunk/bibdesk/BDSKIEEEXploreParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKIEEEXploreParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -38,8 +38,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKIEEEXploreParser : BDSKAsynchronousWebParser @end - +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKIUCrParser.h =================================================================== --- trunk/bibdesk/BDSKIUCrParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKIUCrParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKIUCrParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKInspireParser.h =================================================================== --- trunk/bibdesk/BDSKInspireParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKInspireParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKInspireParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKJSTORWebParser.h =================================================================== --- trunk/bibdesk/BDSKJSTORWebParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKJSTORWebParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKJSTORWebParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKMASParser.h =================================================================== --- trunk/bibdesk/BDSKMASParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKMASParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKMASParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKMathSciNetParser.h =================================================================== --- trunk/bibdesk/BDSKMathSciNetParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKMathSciNetParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,8 +39,11 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKMathSciNetParser : BDSKAsynchronousWebParser -+ (NSArray *)bibTeXRequestsForMRIDs:(NSArray *)IDs serverName:(NSString *)serverName error:(NSError **)outError; -+ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download parser:(BDSKWebParser *)parser error:(NSError **)outError; ++ (nullable NSArray *)bibTeXRequestsForMRIDs:(NSArray *)IDs serverName:(nullable NSString *)serverName error:(NSError **)outError; ++ (nullable NSArray *)itemsFromDownload:(BDSKCitationDownload *)download parser:(BDSKWebParser *)parser error:(NSError **)outError; @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKNumdamParser.h =================================================================== --- trunk/bibdesk/BDSKNumdamParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKNumdamParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,7 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKNumdamParser : BDSKAsynchronousWebParser @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKProjectEuclidParser.h =================================================================== --- trunk/bibdesk/BDSKProjectEuclidParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKProjectEuclidParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,7 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKProjectEuclidParser : BDSKAsynchronousWebParser @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKSIAMParser.h =================================================================== --- trunk/bibdesk/BDSKSIAMParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKSIAMParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,7 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKSIAMParser : BDSKAsynchronousWebParser +@end -@end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKScienceDirectParser.h =================================================================== --- trunk/bibdesk/BDSKScienceDirectParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKScienceDirectParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKScienceDirectParser : BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKSpringerParser.h =================================================================== --- trunk/bibdesk/BDSKSpringerParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKSpringerParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,6 +39,9 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKSpringerParser: BDSKAsynchronousWebParser @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKWebParser.h =================================================================== --- trunk/bibdesk/BDSKWebParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKWebParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -40,6 +40,8 @@ #import <WebKit/WebKit.h> #import "BDSKOwnerProtocol.h" +NS_ASSUME_NONNULL_BEGIN + typedef NS_ENUM(NSInteger, BDSKParserFeature) { BDSKParserFeaturePublic = 0, // flag indicating that full usage of the parser's feature requires some sort of subscription @@ -58,7 +60,7 @@ } // this method is the main entry point for the BDSKWebParser class -+ (BDSKWebParser *)parserForDocument:(DOMDocument *)domDocument fromURL:(NSURL *)url shouldMonitor:(BOOL *)shouldMonitor; ++ (nullable BDSKWebParser *)parserForDocument:(DOMDocument *)domDocument fromURL:(NSURL *)url shouldMonitor:(BOOL * _Nullable)shouldMonitor; // Returns all parser classes of a specific feature @property (class, nonatomic, readonly) NSArray *parsers; @@ -71,12 +73,12 @@ @property (nonatomic, readonly) DOMDocument *domDocument; @property (nonatomic, readonly) NSURL *URL; -@property (nonatomic, readonly) id<BDSKWebParserDelegate> delegate; +@property (nonatomic, nullable, readonly) id<BDSKWebParserDelegate> delegate; // set at the end of -start, to know thereis not more coming, so we may finish @property (nonatomic) BOOL finishedStarting; -- (instancetype)initWithDocument:(DOMDocument *)aDomDocument fromURL:(NSURL *)aURL; +- (nullable instancetype)initWithDocument:(DOMDocument *)aDomDocument fromURL:(NSURL *)aURL; - (void)startWithDelegate:(id<BDSKWebParserDelegate>)aDelegate; - (void)cancel; @@ -91,20 +93,22 @@ + (BOOL)shouldMonitorURL:(NSURL *)url; // main method for subclasses to implement -- (NSArray *)itemsReturningError:(NSError **)outError; +- (nullable NSArray *)itemsReturningError:(NSError **)outError; // information for the parser, to be implemented by the subclasses @property (class, nonatomic, readonly) NSString *name; -@property (class, nonatomic, readonly) NSString *address; -@property (class, nonatomic, readonly) NSString *info; +@property (class, nonatomic, nullable, readonly) NSString *address; +@property (class, nonatomic, nullable, readonly) NSString *info; @property (class, nonatomic, readonly) BDSKParserFeature feature; // convenience method to return items from a bibtex string -- (NSArray *)itemsFromBibTeXString:(NSString *)bibtexString error:(NSError **)outError; +- (nullable NSArray *)itemsFromBibTeXString:(NSString *)bibtexString error:(NSError **)outError; @end @protocol BDSKWebParserDelegate <BDSKOwner> - (void)webParser:(BDSKWebParser *)parser didFindItems:(NSArray *)items; -- (void)webParser:(BDSKWebParser *)parser didFinishWithSuccess:(BOOL)success error:(NSError *)error; +- (void)webParser:(BDSKWebParser *)parser didFinishWithSuccess:(BOOL)success error:(nullable NSError *)error; @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKZentralblattParser.h =================================================================== --- trunk/bibdesk/BDSKZentralblattParser.h 2025-02-18 16:50:52 UTC (rev 29020) +++ trunk/bibdesk/BDSKZentralblattParser.h 2025-02-18 17:11:28 UTC (rev 29021) @@ -39,8 +39,11 @@ #import <Cocoa/Cocoa.h> #import "BDSKAsynchronousWebParser.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKZentralblattParser : BDSKAsynchronousWebParser -+ (NSArray *)bibTeXRequestsForZMathIDs:(NSArray *)IDs serverName:(NSString *)serverName error:(NSError **)outError; -+ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download parser:(BDSKWebParser *)parser error:(NSError **)outError; ++ (nullable NSArray *)bibTeXRequestsForZMathIDs:(NSArray *)IDs serverName:(nullable NSString *)serverName error:(NSError **)outError; ++ (nullable NSArray *)itemsFromDownload:(BDSKCitationDownload *)download parser:(BDSKWebParser *)parser error:(NSError **)outError; @end + +NS_ASSUME_NONNULL_END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit