Manages the user's music playlists, persisting them to a property-list file.
More...
#include <MusicPlaylistManager.h>
|
|
NSMutableArray * | arrayPlaylist |
| | The playlists, each an NSMutableDictionary keyed by identifier, name, and music list.
|
|
NSString * | filePath |
| | The property-list file the playlists are loaded from and written back to.
|
Manages the user's music playlists, persisting them to a property-list file.
Each playlist is a mutable dictionary with three keys: a stable string identifier, a display name, and a mutable array of music identifiers (boxed NSUInteger values). The manager loads the array from a file on construction and writes it back on -synchronize .
◆ addMusic:toPlaylistAtIndex:
| - (void) addMusic: |
|
(NSUInteger) | musicIdentifier |
| toPlaylistAtIndex: |
|
(NSUInteger) | index |
Adds the music identified by musicIdentifier to the playlist at index.
Creates the music list if the playlist has none yet, and does nothing if the music is already present or musicIdentifier is 0 .
- Parameters
-
| musicIdentifier | The music identifier. |
| index | The playlist index. |
- Ghidra address:
- 0x165858
◆ addPlaylistWithName:
| - (BOOL) addPlaylistWithName: |
|
(nonnull NSString *) | name |
|
Appends a new, empty playlist with the given display name.
Mints a stable identifier and stores a playlist with an empty music list.
- Parameters
-
| name | The display name; an empty name is rejected. |
- Returns
YES if name is non-empty and the playlist was added, NO otherwise.
- Ghidra address:
- 0x1652e4
◆ containsMusic:inPlaylistAtIndex:
| - (BOOL) containsMusic: |
|
(NSUInteger) | musicIdentifier |
| inPlaylistAtIndex: |
|
(NSUInteger) | index |
Tests whether the music identified by musicIdentifier is in the playlist at index.
- Parameters
-
| musicIdentifier | The music identifier; 0 is treated as absent. |
| index | The playlist index. |
- Returns
YES if present, NO otherwise.
- Ghidra address:
- 0x16570c
◆ identifierOfPlaylistAtIndex:
| - (NSString *) identifierOfPlaylistAtIndex: |
|
(NSUInteger) | index |
|
Returns the identifier of the playlist at index, or nil if out of range.
- Parameters
-
- Returns
- The playlist's identifier, or nil when the index is out of range.
- Ghidra address:
- 0x165144
◆ indexOfPlaylist:
| - (NSUInteger) indexOfPlaylist: |
|
(nonnull NSDictionary *) | playlist |
|
Returns the index of playlist by identity, or NSNotFound .
- Parameters
-
| playlist | The playlist dictionary to search for. |
- Returns
- The playlist's index, or
NSNotFound when it is not present.
- Ghidra address:
- 0x164e4c
◆ indexOfPlaylistWithIdentifier:
| - (NSUInteger) indexOfPlaylistWithIdentifier: |
|
(nullable NSString *) | identifier |
|
Returns the index of the playlist whose identifier equals identifier.
- Parameters
-
| identifier | The playlist identifier to match. |
- Returns
- The index, or
NSNotFound if no playlist matches or identifier is nil .
- Ghidra address:
- 0x164ec4
◆ initWithFile:
| - (instancetype) initWithFile: |
|
(nonnull NSString *) | file |
|
Initialises the manager and loads any playlists already stored at file.
Seeds an empty mutable array, remembers a copy of the path, then reads the file as an array of dictionaries. Each element that is a dictionary carrying all three keys is normalised into a fresh mutable dictionary and appended; malformed elements are skipped.
- Parameters
-
| file | The property-list path to load from and later synchronise to. |
- Returns
- The initialised manager, or
nil if [super init] fails.
- Ghidra address:
- 0x164804
◆ nameOfPlaylistAtIndex:
| - (NSString *) nameOfPlaylistAtIndex: |
|
(NSUInteger) | index |
|
Returns the display name of the playlist at index, or nil if out of range.
- Parameters
-
- Returns
- The playlist's display name, or nil when the index is out of range.
- Ghidra address:
- 0x165068
◆ numberOfMusicInPlaylistAtIndex:
| - (NSUInteger) numberOfMusicInPlaylistAtIndex: |
|
(NSUInteger) | index |
|
Returns the number of music entries in the playlist at index.
- Parameters
-
- Returns
- The count, or
0 if the index is out of range or the playlist has no music list.
- Ghidra address:
- 0x165608
◆ numberOfPlaylists
| - (NSUInteger) numberOfPlaylists |
|
|
|
Returns the number of playlists.
- Returns
- The playlist count.
- Ghidra address:
- 0x164c74
◆ playlistAtIndex:
| - (NSMutableDictionary *) playlistAtIndex: |
|
(NSUInteger) | index |
|
Returns the playlist dictionary at index, or nil if out of range or malformed.
The element is returned only when it is a dictionary carrying all three keys.
- Parameters
-
- Returns
- The playlist dictionary, or
nil .
- Ghidra address:
- 0x164cc0
◆ removeMusic:fromPlaylistAtIndex:
| - (BOOL) removeMusic: |
|
(NSUInteger) | musicIdentifier |
| fromPlaylistAtIndex: |
|
(NSUInteger) | index |
Removes the music identified by musicIdentifier from the playlist at index.
- Parameters
-
| musicIdentifier | The music identifier; 0 is treated as absent. |
| index | The playlist index. |
- Returns
YES if the index was in range, NO otherwise.
- Ghidra address:
- 0x1659f0
◆ removePlaylistAtIndex:
| - (BOOL) removePlaylistAtIndex: |
|
(NSUInteger) | index |
|
Removes the playlist at index.
- Parameters
-
- Returns
YES if the index was in range, NO otherwise.
- Ghidra address:
- 0x165560
◆ setNameOfPlaylist:atIndex:
| - (BOOL) setNameOfPlaylist: |
|
(nonnull NSString *) | name |
| atIndex: |
|
(NSUInteger) | index |
Sets the display name of the playlist at index.
- Parameters
-
| name | The new name; an empty name is rejected. |
| index | The playlist index. |
- Returns
YES if name is non-empty (whether or not the index was in range), NO otherwise.
- Ghidra address:
- 0x165220
◆ synchronize
Writes the current playlists back to the file, atomically.
- Ghidra address:
- 0x164c00
The documentation for this class was generated from the following files: