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

Container for lists of user overplayed songs. More...

#include <datastore.h>

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

Public Member Functions

 OverplayedList (const std::string &ratingGroup)
 
 OverplayedList (const Parsnip::Data &json)
 
bool isExpired (const std::string &song_id)
 
- Public Member Functions inherited from UserData::Dictionary< std::string, time_t >
 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 time_t &value)
 
const time_t & get (const std::string &key, const time_t &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 OverplayedListretrieve (const User *user, const std::string &key)
 Retrieve overplayed list for a user. More...
 
static OverplayedListretrieve (User *user, const std::string &key)
 Retrieve overplayed list for a user. More...
 
- Static Public Member Functions inherited from UserData::DataStore
static bool isSourceData (const std::string &origin)
 

Detailed Description

Container for lists of user overplayed songs.

Each source storing overplayed ratings uses one container for each user. Values are stored in key-value pairs, with an ID specific to the item and the time the overplayed ban expires.

Constructor & Destructor Documentation

◆ OverplayedList() [1/2]

UserData::OverplayedList::OverplayedList ( const std::string &  ratingGroup)
inline

◆ OverplayedList() [2/2]

UserData::OverplayedList::OverplayedList ( const Parsnip::Data json)
inline

Member Function Documentation

◆ isExpired()

bool UserData::OverplayedList::isExpired ( const std::string &  song_id)

◆ retrieve() [1/2]

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

Retrieve overplayed list for a user.

If the user doesn't have a list, try to create one.

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

◆ retrieve() [2/2]

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

Retrieve overplayed list for a user.

If the user doesn't have a list, try to create one.

Parameters
userThe user for whom to retrieve the list.
keyThe source's type/name of the collection to retrieve.
Returns
The list of overplays, 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: