|
pianod2
multisource multiuser scriptable networked music player
|
Base class for songs, albums, artists, playlists, genres, etc. More...
#include <musictypes.h>


Public Types | |
| enum class | Type : char { Playlist = 'p' , Artist = 'a' , Album = 'l' , Song = 's' , PlaylistSuggestion = 'e' , ArtistSuggestion = 't' , AlbumSuggestion = 'b' , SongSuggestion = 'n' , PlaylistSeed = 'y' , ArtistSeed = 'd' , AlbumSeed = 'u' , SongSeed = 'g' , SongRating = 'i' } |
Public Types inherited from Ownership | |
| enum class | Type { DISOWNED , PRIVATE , SHARED , PUBLISHED , PUBLIC } |
| Access levels for an object. More... | |
| enum class | Action { SEE , USE , READ , ALTER } |
| Access actions for an object. More... | |
Public Member Functions | |
| MusicThingie (void) | |
| When allocated, use count starts at 1 and the object is put in the release pool, justifying its existence. More... | |
| bool | isPrimary (void) const |
| bool | isSuggestion (void) const |
| bool | isSeed (void) const |
| bool | isPlaylist (void) const |
| bool | isSong (void) const |
| bool | isAlbum (void) const |
| bool | isArtist (void) const |
| bool | isValidType (void) const |
| Type | primaryType (void) const |
| virtual bool | canQueue () const |
| Indicate if specific item can be queued/requested. More... | |
| virtual PianodArtist * | asArtist () |
| virtual PianodAlbum * | asAlbum () |
| virtual PianodSong * | asSong () |
| virtual PianodPlaylist * | asPlaylist () |
| virtual const PianodArtist * | asArtist () const |
| virtual const PianodAlbum * | asAlbum () const |
| virtual const PianodSong * | asSong () const |
| virtual const PianodPlaylist * | asPlaylist () const |
| std::string | operator() (void) const |
| void | retain (void) const |
| Claim an instance. More... | |
| void | release (void) |
| Abandon an instance. More... | |
| int | getUseCount (void) const |
| virtual Ownership * | parentOwner (void) const |
| Defer the ownership to the source. More... | |
| virtual Media::Source *const | source (void) const =0 |
| MediaSource from which this thingie originates. More... | |
| virtual const std::string | id (void) const =0 |
| Get the primary id of this thingie. More... | |
| virtual const std::string | id (MusicThingie::Type type) const =0 |
| Return the complete ID when used in a specific context. More... | |
| virtual const std::string & | internalId (MusicThingie::Type type) const =0 |
| Return the inner ID when used in a specific context. More... | |
| virtual const std::string & | name (void) const =0 |
| Return the most specific name of this, whatever type it is. More... | |
| virtual Type | type (void) const =0 |
| Return the type letter for a thingie. More... | |
| virtual Football::Thingie & | transmitCommon (Football::Thingie &recipient) const =0 |
| Transmit the thingie's data to a connection or service. More... | |
| virtual PianodConnection & | transmitPrivate (PianodConnection &recipient) const =0 |
| Transmit the thingie's user-specific data on a connection. More... | |
| virtual Parsnip::Data | serialize () const =0 |
| Assemble the thingie's data for JSON tranmission. More... | |
| virtual void | serializePrivate (Parsnip::Data &, const User *user) const =0 |
| Add the thingie's user-specific data for JSON transmission. More... | |
| void | serializeCommon (Parsnip::Data &) const |
| Insert common items into the serialization dictionary. More... | |
| virtual bool | matches (const Filter &filter) const =0 |
| Check if a filter matches this item. More... | |
| virtual bool | operator== (const std::string &compare) const =0 |
| Check if the primary name of this thingie matches. More... | |
| virtual bool | operator== (const MusicThingie &compare) const =0 |
| Compare a thingie's name to another of the equivalent or decendent type. More... | |
| bool | operator!= (const std::string &compare) |
| bool | operator!= (const MusicThingie &compare) |
| virtual SongList | songs () |
| Retrieve a list of requestable songs applicable to this thingie. More... | |
Public Member Functions inherited from SubordinateOwnership | |
| virtual bool | isOwnedBy (const User *user) const override |
| virtual bool | hasPermission (const User *user, Action action) const override |
Public Member Functions inherited from Ownership | |
| bool | isVisibleBy (const User *user) const |
| bool | isUsableBy (const User *user) const |
| bool | isDecendableBy (const User *user) const |
| bool | isReadableBy (const User *user) const |
| bool | isEditableBy (const User *user) const |
Static Public Member Functions | |
| static std::string | TypeName (Type type) |
| Get the type name of a music thingie. More... | |
| static Type | TypeFromName (const std::string &name) |
| static constexpr bool | isPrimary (Type t) |
| static constexpr bool | isSuggestion (const Type t) |
| static constexpr bool | isSeed (const Type t) |
| static constexpr bool | isPlaylist (const Type t) |
| static constexpr bool | isSong (const Type t) |
| static constexpr bool | isAlbum (const Type t) |
| static constexpr bool | isArtist (const Type t) |
| static constexpr bool | isValidType (const Type t) |
| static Type | primaryType (const Type t) |
Protected Member Functions | |
| virtual | ~MusicThingie (void) |
Private Attributes | |
| short | useCount = 1 |
Static Private Attributes | |
| static MusicAutoReleasePool * | releasePool = nullptr |
| The current autorelease pool to put newly created music thingies into. More... | |
Friends | |
| class | MusicAutoReleasePool |
Base class for songs, albums, artists, playlists, genres, etc.
This class is reference counted using an autorelease pool; the pool must be periodically released (such as at end end of the main run loop) to free things up.
This offers a simplistic but effective and efficient garbage collection scheme. For more information, see Cocoa/NextStep.
|
strong |
|
protectedvirtual |

| MusicThingie::MusicThingie | ( | void | ) |
When allocated, use count starts at 1 and the object is put in the release pool, justifying its existence.
If anyone wants it, they must retain() it before autorelease. One MusicAutoReleasePool is in the main run loop; others may be created to shorten temporary lives. Retained objects are later deleted instantly when released().

|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PianodAlbum.
|
inlinevirtual |
Reimplemented in MusicLibrary::Song, PianodAlbum, and PianodArtist.

|
inlinevirtual |
Reimplemented in MusicLibrary::Song, PianodAlbum, and PianodArtist.
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PianodPlaylist.
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PianodSong.
|
inlinevirtual |
Indicate if specific item can be queued/requested.
Reimplemented in MusicLibrary::Playlist, MusicLibrary::Song, MusicLibrary::Album, MusicLibrary::Artist, and Pandora::PlayableSong.

|
inline |

|
pure virtual |
Return the complete ID when used in a specific context.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.
|
pure virtual |
Get the primary id of this thingie.
If this is an artist, the artist ID; if an album, the album ID; etc.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.

|
pure virtual |
Return the inner ID when used in a specific context.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.

|
inlinestaticconstexpr |
|
inline |


|
inlinestaticconstexpr |
|
inline |


|
inlinestaticconstexpr |
|
inline |


|
inlinestaticconstexpr |
|
inline |


|
inlinestaticconstexpr |

|
inline |

|
inlinestaticconstexpr |
|
inline |


|
inlinestaticconstexpr |

|
inline |


|
inlinestaticconstexpr |

|
inline |


|
pure virtual |
Check if a filter matches this item.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.

|
pure virtual |
Return the most specific name of this, whatever type it is.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.

|
inline |
|
inline |
| std::string MusicThingie::operator() | ( | void | ) | const |

|
pure virtual |
Compare a thingie's name to another of the equivalent or decendent type.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.
|
pure virtual |
Check if the primary name of this thingie matches.
If this is an artist, compares to the artist name; if an album, the album name; etc.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.

|
virtual |
Defer the ownership to the source.
Implements SubordinateOwnership.

|
static |


|
inline |

|
inline |
Abandon an instance.


|
inline |
Claim an instance.


|
pure virtual |
Assemble the thingie's data for JSON tranmission.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.
| void MusicThingie::serializeCommon | ( | Parsnip::Data & | serialdata | ) | const |
Insert common items into the serialization dictionary.


|
pure virtual |
Add the thingie's user-specific data for JSON transmission.
Implemented in MusicLibrary::Playlist, Filesystem::Song, PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.
|
virtual |
Retrieve a list of requestable songs applicable to this thingie.
Reimplemented in PianodPlaylist, PianodSong, MusicLibrary::Album, MusicLibrary::Artist, and MusicLibrary::Playlist.
|
pure virtual |
MediaSource from which this thingie originates.
Implemented in MusicLibrary::Song, MusicLibrary::Album, MusicLibrary::Artist, MusicLibrary::Playlist, EncapsulatedPlaylist, EncapsulatedSong, EncapsulatedAlbum, and EncapsulatedArtist.

|
pure virtual |
Transmit the thingie's data to a connection or service.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, and PianodArtist.
|
pure virtual |
Transmit the thingie's user-specific data on a connection.
Implemented in Filesystem::Song, PianodPlaylist, PianodSong, PianodAlbum, PianodArtist, and MusicLibrary::Playlist.
|
pure virtual |
Return the type letter for a thingie.
This is used as the first letter of the ID, so IDs can be routed to the appropriate dataset/handler.
Implemented in PianodPlaylist, PianodSong, PianodAlbum, PianodArtist, EncapsulatedPlaylist, EncapsulatedSong, EncapsulatedAlbum, and EncapsulatedArtist.

|
static |


|
static |
Get the type name of a music thingie.
| type | The type whose name to retrieve. |


|
friend |
|
staticprivate |
The current autorelease pool to put newly created music thingies into.
|
mutableprivate |