summaryrefslogtreecommitdiffstats
path: root/macosx/HBCodingUtilities.h
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/HBCodingUtilities.h')
-rw-r--r--macosx/HBCodingUtilities.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/macosx/HBCodingUtilities.h b/macosx/HBCodingUtilities.h
index c8eb3763e..de50bfaf7 100644
--- a/macosx/HBCodingUtilities.h
+++ b/macosx/HBCodingUtilities.h
@@ -19,6 +19,8 @@
#define decodeDouble(x) x = [decoder decodeDoubleForKey:OBJC_STRINGIFY(x)]
#define decodeObject(x, cl) x = [HBCodingUtilities decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x) decoder:decoder];
+#define decodeCollectionOfObjects(x, cl, objectcl) x = [HBCodingUtilities decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], nil] forKey:OBJC_STRINGIFY(x) decoder:decoder];
+
#define decodeObjectOrFail(x, class) x = [HBCodingUtilities decodeObjectOfClass:class forKey:OBJC_STRINGIFY(x) decoder:decoder]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;}
NS_ASSUME_NONNULL_BEGIN
@@ -41,6 +43,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder;
+
++ (nullable id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key decoder:(NSCoder *)decoder;
+
@end
NS_ASSUME_NONNULL_END