pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Static Public Member Functions | List of all members
UserData::Ratings Class Reference

Container for user ratings values (playlists & songs). More...

#include <datastore.h>

Inheritance diagram for UserData::Ratings:
Inheritance graph
[legend]
Collaboration diagram for UserData::Ratings:
Collaboration graph
[legend]

Public Member Functions

 Dictionary (const std::string &_origin, const std::string &_id)
 
 Dictionary (const Parsnip::Data &data)
 
- Public Member Functions inherited from UserData::Dictionary< std::string, Rating, std::string >
 Dictionary (const std::string &_origin, const std::string &_id)
 
 Dictionary (const Parsnip::Data &data)
 
virtual const std::string & origin (void) const override
 Retrieve the origin (type of data) stored in this storage unit. More...
 
virtual const std::string & identity (void) const override
 Retrieve the identity (primary identifier) of the data in this storage unit. More...
 
void rename (const std::string new_id)
 
bool add (const std::string &key, const Rating &value)
 
const Ratingget (const std::string &key, const Rating &def) const
 
virtual bool reconstitute (const Parsnip::Data &data) override
 Restore data from a JSON source. More...
 
virtual Parsnip::Data persist () const override
 Persist data using Parsnip. More...
 
- Public Member Functions inherited from UserData::DataStore
virtual ~DataStore (void)
 
bool isSourceData (void) const
 

Static Public Member Functions

static Ratingsretrieve (const User *user, const std::string &ratingKind, const std::string &key)
 
static Ratingsretrieve (User *user, const std::string &ratingKind, const std::string &key)
 Retrieve a ratings group for a user. More...
 
- Static Public Member Functions inherited from UserData::DataStore
static bool isSourceData (const std::string &origin)
 

Detailed Description

Container for user ratings values (playlists & songs).

Playlist ratings are stored in one container per user. Each sources storing song ratings uses one container for each user. Values are stored in key-value pairs, with an ID specific to the item.

Member Function Documentation

◆ Dictionary() [1/2]

UserData::Dictionary< TKey, TValue, TStorage >::Dictionary
inline

◆ Dictionary() [2/2]

UserData::Dictionary< TKey, TValue, TStorage >::Dictionary
inline

◆ retrieve() [1/2]

Ratings * UserData::Ratings::retrieve ( const User user,
const std::string &  ratingKind,
const std::string &  key 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieve() [2/2]

Ratings * UserData::Ratings::retrieve ( User user,
const std::string &  ratingKind,
const std::string &  key 
)
static

Retrieve a ratings group for a user.

If the user doesn't have the requested group, try to create one.

Parameters
userThe user for whom to retrieve ratings.
ratingKindThe type of ratings, either playlist ratings or song ratings key.
keyThe source's type/name of the collection to retrieve.
Returns
The user's ratings, or a nullptr if it couldn't be found or created.
Here is the call graph for this function:

The documentation for this class was generated from the following files: