// // MP42Metadata.h // Subler // // Created by Damiano Galassi on 06/02/09. // Copyright 2022 Damiano Galassi. All rights reserved. // #import #import NS_ASSUME_NONNULL_BEGIN @interface MP42Metadata : NSObject /** * Initializes a new metadata instance by a given URL * * @param URL An URL that identifies an xml file. * * @return The receiver, initialized with the resource specified by URL. */ - (nullable instancetype)initWithURL:(NSURL *)URL; /** * Returns the complete list of available metadata. */ @property (nonatomic, class, readonly) NSArray *availableMetadata; /** * Returns the complete list of writable metadata. */ @property (nonatomic, class, readonly) NSArray *writableMetadata; - (void)addMetadataItems:(NSArray *)items; - (void)addMetadataItem:(MP42MetadataItem *)item; - (void)removeMetadataItem:(MP42MetadataItem *)item; - (void)removeMetadataItems:(NSArray *)items; @property (nonatomic, readonly) NSArray *items; /*! @abstract Filters an array of MP42MetadataItems according to identifier. @param identifier The identifier that must be matched for a metadata item to be copied to the output array. Items are considered a match not only when their identifiers are equal to the specified identifier, and also when their identifiers conform to the specified identifier. @result An instance of NSArray containing the metadata items of the target NSArray that match the specified identifier. */ - (NSArray *)metadataItemsFilteredByIdentifier:(NSString *)identifier; /*! @abstract Filters an array of MP42MetadataItems according to a identifiers array. @param identifiers The identifiers that must be matched for a metadata item to be copied to the output array. Items are considered a match not only when their identifiers are equal to the specified identifier, and also when their identifiers conform to the specified identifier. @result An instance of NSArray containing the metadata items of the target NSArray that match the specified identifier. */ - (NSArray *)metadataItemsFilteredByIdentifiers:(NSArray *)identifiers; /*! @abstract Filters an array of MP42MetadataItems according a data type mask. @param dataType The identifier that must be matched for a metadata item to be copied to the output array. Items are considered a match not only when their identifiers are equal to the specified identifier, and also when their identifiers conform to the specified identifier. @result An instance of NSArray containing the metadata items of the target NSArray that match the specified identifier. */ - (NSArray *)metadataItemsFilteredByDataType:(MP42MetadataItemDataType)dataType; /** Merges the tags of the passed MP42Metadata instance @param metadata the instance to merge. */ - (void)mergeMetadata:(MP42Metadata *)metadata overwrite:(BOOL)overwrite; @property (nonatomic, readwrite, nullable) NSUndoManager *undo; @end NS_ASSUME_NONNULL_END