Revision: 13826
          http://sourceforge.net/p/skim-app/code/13826
Author:   hofman
Date:     2023-12-04 15:47:53 +0000 (Mon, 04 Dec 2023)
Log Message:
-----------
Add lightweight generics to SkimNote headers

Modified Paths:
--------------
    trunk/SkimNotes/NSFileManager_SKNExtensions.h
    trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
    trunk/SkimNotes/PDFDocument_SKNExtensions.h
    trunk/SkimNotes/PDFDocument_SKNExtensions.m
    trunk/SkimNotes/SKNExtendedAttributeManager.h
    trunk/SkimNotes/SKNUtilities.h
    trunk/SkimNotes/SkimNotes.rtf

Modified: trunk/SkimNotes/NSFileManager_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNExtensions.h       2023-12-04 15:24:52 UTC 
(rev 13825)
+++ trunk/SkimNotes/NSFileManager_SKNExtensions.h       2023-12-04 15:47:53 UTC 
(rev 13826)
@@ -71,7 +71,7 @@
     @param      outError If there is an error reading the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     An array of dictionaries with Skim note properties, an empty 
array if no Skim notes were found, or <code>NULL</code> if there was an error 
reading the Skim notes.
 */
-- (nullable NSArray *)readSkimNotesFromExtendedAttributesAtURL:(NSURL *)aURL 
error:(NSError **)outError;
+- (nullable NSArray<NSDictionary<NSString *, id> *> 
*)readSkimNotesFromExtendedAttributesAtURL:(NSURL *)aURL error:(NSError 
**)outError;
 
 /*!
     @abstract   Reads text Skim notes as a string from the extended attributes 
of a file.
@@ -98,7 +98,7 @@
     @param      outError If there is an error reading the Skim notes, upon 
return contains an NSError object that describes the problem.
     @result     An array of dictionaries with Skim note properties, an empty 
array if no Skim notes were found, or <code>NULL</code> if there was an error 
reading the Skim notes.
 */
-- (nullable NSArray *)readSkimNotesFromPDFBundleAtURL:(NSURL *)aURL 
error:(NSError **)outError;
+- (nullable NSArray<NSDictionary<NSString *, id> *> 
*)readSkimNotesFromPDFBundleAtURL:(NSURL *)aURL error:(NSError **)outError;
 
 /*!
     @abstract   Reads text Skim notes as a string from the contents of a PDF 
bundle.
@@ -125,7 +125,7 @@
     @param      outError If there is an error reading the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     An array of dictionaries with Skim note properties, an empty 
array if no Skim notes were found, or <code>NULL</code> if there was an error 
reading the Skim notes.
 */
-- (nullable NSArray *)readSkimNotesFromSkimFileAtURL:(NSURL *)aURL 
error:(NSError **)outError;
+- (nullable NSArray<NSDictionary<NSString *, id> *> 
*)readSkimNotesFromSkimFileAtURL:(NSURL *)aURL error:(NSError **)outError;
 
 /*!
     @abstract   Writes Skim notes passed as an array of property dictionaries 
to the extended attributes of a file, as well as a defaultrepresentation for 
text Skim notes and RTF Skim notes.
@@ -135,7 +135,7 @@
     @param      outError If there is an error writing the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     Returns <code>YES</code> if writing out the Skim notes was 
successful; otherwise returns <code>NO</code>.
 */
-- (BOOL)writeSkimNotes:(nullable NSArray *)notes 
toExtendedAttributesAtURL:(NSURL *)aURL error:(NSError **)outError;
+- (BOOL)writeSkimNotes:(nullable NSArray<NSDictionary<NSString *, id> *> 
*)notes toExtendedAttributesAtURL:(NSURL *)aURL error:(NSError **)outError;
 
 /*!
     @abstract   Writes Skim notes passed as an array of property dictionaries 
to the extended attributes of a file, as well as text Skim notes and RTF Skim 
notes.  The array is converted to <code>NSData</code> using 
<code>NSKeyedArchiver</code>.
@@ -147,7 +147,7 @@
     @param      outError If there is an error writing the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     Returns <code>YES</code> if writing out the Skim notes was 
successful; otherwise returns <code>NO</code>.
 */
-- (BOOL)writeSkimNotes:(nullable NSArray *)notes textNotes:(nullable NSString 
*)notesString richTextNotes:(nullable NSData *)notesRTFData 
toExtendedAttributesAtURL:(NSURL *)aURL error:(NSError **)outError;
+- (BOOL)writeSkimNotes:(nullable NSArray<NSDictionary<NSString *, id> *> 
*)notes textNotes:(nullable NSString *)notesString richTextNotes:(nullable 
NSData *)notesRTFData toExtendedAttributesAtURL:(NSURL *)aURL error:(NSError 
**)outError;
 
 /*!
  @abstract   Writes Skim notes passed as an array of property dictionaries to 
the extended attributes of a file, as well as text Skim notes and RTF Skim 
notes.  The array is converted to <code>NSData</code> using 
<code>NSKeyedArchiver</code> or as plist data, depending on the options.
@@ -160,7 +160,7 @@
  @param      outError If there is an error writing the Skim notes, upon return 
contains an <code>NSError</code> object that describes the problem.
  @result     Returns <code>YES</code> if writing out the Skim notes was 
successful; otherwise returns <code>NO</code>.
  */
-- (BOOL)writeSkimNotes:(nullable NSArray *)notes textNotes:(nullable NSString 
*)notesString richTextNotes:(nullable NSData *)notesRTFData 
toExtendedAttributesAtURL:(NSURL *)aURL 
options:(SKNSkimNotesWritingOptions)options error:(NSError **)outError;
+- (BOOL)writeSkimNotes:(nullable NSArray<NSDictionary<NSString *, id> *> 
*)notes textNotes:(nullable NSString *)notesString richTextNotes:(nullable 
NSData *)notesRTFData toExtendedAttributesAtURL:(NSURL *)aURL 
options:(SKNSkimNotesWritingOptions)options error:(NSError **)outError;
 
 /*!
     @abstract   Writes Skim notes passed as an array of property dictionaries 
to a .skim file.
@@ -170,7 +170,7 @@
     @param      outError If there is an error writing the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     Returns <code>YES</code> if writing out the Skim notes was 
successful; otherwise returns <code>NO</code>.
 */
-- (BOOL)writeSkimNotes:(nullable NSArray *)notes toSkimFileAtURL:(NSURL *)aURL 
error:(NSError **)outError;
+- (BOOL)writeSkimNotes:(nullable NSArray<NSDictionary<NSString *, id> *> 
*)notes toSkimFileAtURL:(NSURL *)aURL error:(NSError **)outError;
 
 /*!
     @abstract   Writes Skim notes passed as an array of property dictionaries 
to a .skim file.  The array is converted to <code>NSData</code> using 
<code>NSKeyedArchiver</code> or as plist data, depending on the options.
@@ -181,7 +181,7 @@
     @param      outError If there is an error writing the Skim notes, upon 
return contains an <code>NSError</code> object that describes the problem.
     @result     Returns <code>YES</code> if writing out the Skim notes was 
successful; otherwise returns <code>NO</code>.
 */
-- (BOOL)writeSkimNotes:(nullable NSArray *)notes toSkimFileAtURL:(NSURL *)aURL 
options:(SKNSkimNotesWritingOptions)options error:(NSError **)outError;
+- (BOOL)writeSkimNotes:(nullable NSArray<NSDictionary<NSString *, id> *> 
*)notes toSkimFileAtURL:(NSURL *)aURL 
options:(SKNSkimNotesWritingOptions)options error:(NSError **)outError;
 
 /*!
     @abstract   Returns the file URL for the file of a given type inside a PDF 
bundle.
@@ -212,7 +212,7 @@
     @param      data The data object to extract the notes from, either an 
archive or plist data.
     @result     An array of dictionaries containing Skim notes properties.
 */
-extern NSArray * _Nullable SKNSkimNotesFromData(NSData * _Nullable data);
+extern NSArray<NSDictionary<NSString *, id> *> * _Nullable 
SKNSkimNotesFromData(NSData * _Nullable data);
 
 /*!
     @abstract   Returns data for the Skim notes.
@@ -221,7 +221,7 @@
     @param      asPlist Whether to create universal plist data rather than 
archived data.  Always returns plist data on iOS.
     @result     A data representation of the notes.
 */
-extern NSData * _Nullable SKNDataFromSkimNotes(NSArray * _Nullable notes, BOOL 
asPlist);
+extern NSData * _Nullable SKNDataFromSkimNotes(NSArray<NSDictionary<NSString 
*, id> *> * _Nullable notes, BOOL asPlist);
 
 /*!
     @abstract   Returns a string representation of Skim notes.
@@ -229,7 +229,7 @@
     @param      noteDicts An array of dictionaries containing Skim note 
properties, as returned by the properties of a <code>PDFAnnotation</code>.
     @result     A string representation of the notes.
 */
-extern NSString * _Nullable SKNSkimTextNotes(NSArray * _Nullable noteDicts);
+extern NSString * _Nullable SKNSkimTextNotes(NSArray<NSDictionary<NSString *, 
id> *> * _Nullable noteDicts);
 
 /*!
     @abstract   Returns an RTF data representation of Skim notes.
@@ -237,6 +237,6 @@
     @param      noteDicts An array of dictionaries containing Skim note 
properties, as returned by the properties of a <code>PDFAnnotation</code>.
     @result     An RTF data representation of the notes.
 */
-extern NSData * _Nullable SKNSkimRTFNotes(NSArray * _Nullable noteDicts);
+extern NSData * _Nullable SKNSkimRTFNotes(NSArray<NSDictionary<NSString *, id> 
*> * _Nullable noteDicts);
 
 NS_ASSUME_NONNULL_END

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.h       2023-12-04 15:24:52 UTC 
(rev 13825)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.h       2023-12-04 15:47:53 UTC 
(rev 13826)
@@ -285,7 +285,7 @@
     @param      dict A dictionary with Skim notes properties, as returned from 
properties.  This is required to contain values for <code>"type"</code> and 
<code>"bounds"</code>.
     @result     An initialized Skim note annotation instance, or 
<code>NULL</code> if the object could not be initialized.
 */
-- (nullable id)initSkimNoteWithProperties:(NSDictionary *)dict;
+- (nullable id)initSkimNoteWithProperties:(NSDictionary<NSString *, id> *)dict;
 
 /*!
     @abstract   The Skim notes properties.
@@ -292,7 +292,7 @@
     @discussion These properties can be used to initialize a new copy, and to 
save to extended attributes or file.
     @result     A dictionary with properties of the Skim note.  All values are 
standard Cocoa objects conforming to <code>NSCoding</code> and 
<code>NSCopying</code>.
 */
-@property (nonatomic, readonly) NSDictionary *SkimNoteProperties;
+@property (nonatomic, readonly) NSDictionary<NSString *, id> 
*SkimNoteProperties;
 
 /*!
     @abstract   Returns whether the annotation is a Skim note.  
@@ -314,7 +314,7 @@
     @discussion This method gets the points between which the path 
interpolates.
     @result     An array of point strings.
 */
-+ (NSArray *)pointsFromSkimNotePath:(PDFKitPlatformBezierPath *)path;
++ (NSArray<NSString *> *)pointsFromSkimNotePath:(PDFKitPlatformBezierPath 
*)path;
 
 /*!
     @abstract   Method to set the points from a path of an Ink Skim note.

Modified: trunk/SkimNotes/PDFDocument_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/PDFDocument_SKNExtensions.h 2023-12-04 15:24:52 UTC (rev 
13825)
+++ trunk/SkimNotes/PDFDocument_SKNExtensions.h 2023-12-04 15:47:53 UTC (rev 
13826)
@@ -61,7 +61,7 @@
     @param      notes An array of <code>PDFAnnotation</code> objects 
initialized using the Skim note properties read from the extended attributes or 
bundled Skim file.
     @result     The initialized <code>PDFDocument</code>.
 */
-- (nullable id)initWithURL:(NSURL *)url readSkimNotes:(NSArray * _Nullable * 
_Nullable)notes;
+- (nullable id)initWithURL:(NSURL *)url readSkimNotes:(NSArray<PDFAnnotation 
*> * _Nullable * _Nullable)notes;
 
 /*!
     @method     
@@ -70,7 +70,7 @@
     @param      noteDicts An array of dictionaries containing Skim note 
properties as returned by the properties of <code>PDFAnnotation</code> objects.
     @result     An array of <code>PDFAnnotation</code> objects initialized 
using the Skim note properties read from the extended attributes or bundled 
Skim file.
 */
-- (nullable NSArray *)addSkimNotesWithProperties:(NSArray *)noteDicts;
+- (nullable NSArray<PDFAnnotation *> 
*)addSkimNotesWithProperties:(NSArray<NSDictionary<NSString *, id> *> 
*)noteDicts;
 
 @end
 

Modified: trunk/SkimNotes/PDFDocument_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFDocument_SKNExtensions.m 2023-12-04 15:24:52 UTC (rev 
13825)
+++ trunk/SkimNotes/PDFDocument_SKNExtensions.m 2023-12-04 15:47:53 UTC (rev 
13826)
@@ -74,7 +74,7 @@
 
 @implementation PDFDocument (SKNExtensions)
 
-- (id)initWithURL:(NSURL *)url readSkimNotes:(NSArray **)notes {
+- (id)initWithURL:(NSURL *)url readSkimNotes:(NSArray<PDFAnnotation *> 
**)notes {
     NSFileManager *fm = [NSFileManager defaultManager];
     NSURL *pdfURL = url;
     BOOL isPDFBundle = [[[url path] pathExtension] 
caseInsensitiveCompare:@"pdfd"] == NSOrderedSame;

Modified: trunk/SkimNotes/SKNExtendedAttributeManager.h
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.h       2023-12-04 15:24:52 UTC 
(rev 13825)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.h       2023-12-04 15:47:53 UTC 
(rev 13826)
@@ -130,7 +130,7 @@
     @param      prefix Defaults to <code>"net_sourceforge_skim-app"</code> for 
the shared instance.  If <code>nil</code>, the manager never splits attributes.
     @result     An initialized EA manager object.  This may be one of the 
shared managers.
 */
-- (id)initWithPrefix:(NSString * _Nullable)prefix;
+- (id)initWithPrefix:(nullable NSString *)prefix;
 
 /*!
     @abstract   Return a list of extended attributes for the given file.
@@ -141,7 +141,7 @@
     @param      error Error object describing the error if <code>nil</code> 
was returned.
     @result     Array of strings or <code>nil</code> if an error occurred.
 */
-- (nullable NSArray *)extendedAttributeNamesAtPath:(NSString *)path 
traverseLink:(BOOL)follow error:(NSError **)error;
+- (nullable NSArray<NSString *> *)extendedAttributeNamesAtPath:(NSString 
*)path traverseLink:(BOOL)follow error:(NSError **)error;
 
 /*!
     @abstract   Return the extended attribute named <code>attr</code> for a 
given file.
@@ -162,7 +162,7 @@
     @param      error Error object describing the error if <code>nil</code> 
was returned.
     @result     Dictionary of data objects as values and strings as key, or 
<code>nil</code> if an error occurred.
 */
-- (nullable NSDictionary *)allExtendedAttributesAtPath:(NSString *)path 
traverseLink:(BOOL)follow error:(NSError **)error;
+- (nullable NSDictionary<NSString *, NSData *> 
*)allExtendedAttributesAtPath:(NSString *)path traverseLink:(BOOL)follow 
error:(NSError **)error;
 
 /*!
     @abstract   Returns a property list using NSPropertyListSerialization.

Modified: trunk/SkimNotes/SKNUtilities.h
===================================================================
--- trunk/SkimNotes/SKNUtilities.h      2023-12-04 15:24:52 UTC (rev 13825)
+++ trunk/SkimNotes/SKNUtilities.h      2023-12-04 15:47:53 UTC (rev 13826)
@@ -52,10 +52,10 @@
 #define RTF_EXTENSION   @"rtf"
 #define FDF_EXTENSION   @"fdf"
 
-extern NSString * _Nullable SKNSkimTextNotes(NSArray * _Nullable noteDicts);
-extern NSData * _Nullable SKNSkimRTFNotes(NSArray * _Nullable noteDicts);
+extern NSString * _Nullable SKNSkimTextNotes(NSArray<NSDictionary<NSString *, 
id> *> * _Nullable noteDicts);
+extern NSData * _Nullable SKNSkimRTFNotes(NSArray<NSDictionary<NSString *, id> 
*> * _Nullable noteDicts);
 
-extern NSArray * _Nullable SKNSkimNotesFromData(NSData * _Nullable data);
-extern NSData * _Nullable SKNDataFromSkimNotes(NSArray * _Nullable noteDicts, 
BOOL asPlist);
+extern NSArray<NSDictionary<NSString *, id> *> * _Nullable 
SKNSkimNotesFromData(NSData * _Nullable data);
+extern NSData * _Nullable SKNDataFromSkimNotes(NSArray<NSDictionary<NSString 
*, id> *> * _Nullable noteDicts, BOOL asPlist);
 
 NS_ASSUME_NONNULL_END

Modified: trunk/SkimNotes/SkimNotes.rtf
===================================================================
--- trunk/SkimNotes/SkimNotes.rtf       2023-12-04 15:24:52 UTC (rev 13825)
+++ trunk/SkimNotes/SkimNotes.rtf       2023-12-04 15:47:53 UTC (rev 13826)
@@ -170,7 +170,7 @@
 
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
 
 \f1\fs24 \cf0 \CocoaLigature1 \
-The code does not support deployment targets lower than 10.6 currently.  
However, for older compiler versions the nullability qualifiers and macros way 
need to be removed.\
+The code does not support deployment targets lower than 10.6 currently.  
However, for older compiler versions the nullability qualifiers and macros and 
lightweight generics declarations may need to be removed.\
 \
 Also you may want to support older architectures by changing the 
 \f3\fs22 \CocoaLigature0 ARCHS

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to