objc2_itunes_library/generated/ITLibMediaEntity.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// The ITLibMediaEntity class serves as the abstract superclass for ITLibMediaItem and ITLibPlaylist instances.
12 /// As the superclass, ITLibMediaEntity defines methods used by those subclasses.
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/ituneslibrary/itlibmediaentity?language=objc)
15 #[unsafe(super(NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 pub struct ITLibMediaEntity;
18);
19
20extern_conformance!(
21 unsafe impl NSObjectProtocol for ITLibMediaEntity {}
22);
23
24impl ITLibMediaEntity {
25 extern_methods!(
26 /// The unique identifier of this media entity.
27 #[unsafe(method(persistentID))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn persistentID(&self) -> Retained<NSNumber>;
30
31 /// Gets the value for a specified media property key.
32 ///
33 /// The media property keys you can use with this property are listed in this document
34 /// and in Media Item Property Keys and Playlist Property Keys.
35 ///
36 /// Parameter `property`: The media property key that you want the corresponding value of.
37 ///
38 /// Returns: The value for the media property key.
39 #[unsafe(method(valueForProperty:))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn valueForProperty(&self, property: &NSString) -> Option<Retained<AnyObject>>;
42
43 #[cfg(feature = "block2")]
44 /// Executes a provided block with the fetched values for the given item properties.
45 ///
46 /// Use this method to get property values in a batch fashion.
47 /// In some cases, enumerating over a set of property keys can be more efficient
48 /// than fetching each individual property with valueForProperty:.
49 /// The media property keys you can use with this property are listed in this document
50 /// and in Media Item Property Keys and Playlist Property Keys.
51 ///
52 /// Parameter `properties`: A set of keys for the properties that will be enumerated, or nil to enumerate all properties.
53 ///
54 /// Parameter `block`: A block object that executes for each property in the properties set.
55 #[unsafe(method(enumerateValuesForProperties:usingBlock:))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn enumerateValuesForProperties_usingBlock(
58 &self,
59 properties: Option<&NSSet<NSString>>,
60 block: &block2::DynBlock<dyn Fn(NonNull<NSString>, NonNull<AnyObject>, NonNull<Bool>)>,
61 );
62
63 #[cfg(feature = "block2")]
64 /// Executes a provided block with the fetched values for all properties in the entity except for the provided set.
65 ///
66 /// Use this method to get property values in a batch fashion.
67 /// In some cases, enumerating over a set of property keys can be more efficient
68 /// than fetching each individual property with valueForProperty:.
69 /// The media property keys you can use with this property are listed in this document
70 /// and in Media Item Property Keys and Playlist Property Keys.
71 ///
72 /// Parameter `properties`: A set of property keys that should NOT be enumerated, or nil to enumerate all properties.
73 ///
74 /// Parameter `block`: A block object that executes for each property except for the ones in the properties set.
75 #[unsafe(method(enumerateValuesExceptForProperties:usingBlock:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn enumerateValuesExceptForProperties_usingBlock(
78 &self,
79 properties: Option<&NSSet<NSString>>,
80 block: &block2::DynBlock<dyn Fn(NonNull<NSString>, NonNull<AnyObject>, NonNull<Bool>)>,
81 );
82 );
83}
84
85/// Methods declared on superclass `NSObject`.
86impl ITLibMediaEntity {
87 extern_methods!(
88 #[unsafe(method(init))]
89 #[unsafe(method_family = init)]
90 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92 #[unsafe(method(new))]
93 #[unsafe(method_family = new)]
94 pub unsafe fn new() -> Retained<Self>;
95 );
96}
97
98extern "C" {
99 /// [Apple's documentation](https://developer.apple.com/documentation/ituneslibrary/itlibmediaentitypropertypersistentid?language=objc)
100 pub static ITLibMediaEntityPropertyPersistentID: &'static NSString;
101}