pianod2
multisource multiuser scriptable networked music player
Classes | Typedefs | Enumerations | Functions | Variables
ratings.h File Reference

Ratings support. More...

#include <config.h>
#include "lookup.h"
Include dependency graph for ratings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RatingAverager
 A class to average ratings. More...
 
struct  rating_lookup_t
 
class  RatingLookup
 String to rating conversion. More...
 

Typedefs

typedef struct rating_lookup_t RATING_LOOKUP
 

Enumerations

enum class  RatingScheme { NOBODY , INDIVIDUAL , OWNER }
 Rules of who may rate an object. More...
 
enum class  Rating {
  UNRATED , REPUGNANT , AWFUL , BAD ,
  POOR , LACKLUSTER , NEUTRAL , OKAY ,
  GOOD , EXCELLENT , SUPERB
}
 Discrete ratings values. More...
 

Functions

constexpr float ratingAsFloat (Rating rating)
 Convert from a ratings enumeration to a floating-point star-rating. More...
 
Rating floatToRating (float rating)
 Convert a star-rating to a ratings enumeration. More...
 

Variables

const RatingLookup RATINGS
 

Detailed Description

Ratings support.

Ratings enumerations, conversion to stars, averaging and text equivalence.

Typedef Documentation

◆ RATING_LOOKUP

Enumeration Type Documentation

◆ Rating

enum Rating
strong

Discrete ratings values.

Enumerator
UNRATED 

Unrated/no rating found, 0 enum.

REPUGNANT 

0.5 star, 1 enum

AWFUL 

1 star, 2 enum

BAD 

1.5 star, 3 enum

POOR 

2 star, 4 enum

LACKLUSTER 

2.5 star, 5 enum

NEUTRAL 

3 star, 6 enum

OKAY 

3.5 star, 7 enum

GOOD 

4 star, 8 enum

EXCELLENT 

4.5 star, 9 enum

SUPERB 

5 star, 10 enum

◆ RatingScheme

enum RatingScheme
strong

Rules of who may rate an object.

Enumerator
NOBODY 

Ratings are unsupported.

INDIVIDUAL 

Each user gets a private rating for this song.

OWNER 

One rating/song, so only ratable by owner.

Function Documentation

◆ floatToRating()

Rating floatToRating ( float  rating)

Convert a star-rating to a ratings enumeration.

Returns
Closes equivalent rating from the ratings enumeration.
Here is the caller graph for this function:

◆ ratingAsFloat()

constexpr float ratingAsFloat ( Rating  rating)
inlineconstexpr

Convert from a ratings enumeration to a floating-point star-rating.

Here is the caller graph for this function:

Variable Documentation

◆ RATINGS

const RatingLookup RATINGS
extern