pianod2
multisource multiuser scriptable networked music player
Functions | Variables
ratings.cpp File Reference

Ratings support. More...

#include <config.h>
#include <cmath>
#include "lookup.h"
#include "ratings.h"
Include dependency graph for ratings.cpp:

Functions

Rating floatToRating (float rating)
 Convert a star-rating to a ratings enumeration. More...
 

Variables

static const RATING_LOOKUP ratings_def []
 Rating enumeration to text lookup values. More...
 
const RatingLookup RATINGS (ratings_def)
 

Detailed Description

Ratings support.

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

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:

Variable Documentation

◆ RATINGS

const RatingLookup RATINGS(ratings_def) ( ratings_def  )

◆ ratings_def

const RATING_LOOKUP ratings_def[]
static
Initial value:
= {
{ Rating::UNRATED, "unrated" },
{ Rating::REPUGNANT, "repugnant" },
{ Rating::AWFUL, "awful" },
{ Rating::BAD, "bad" },
{ Rating::POOR, "poor" },
{ Rating::LACKLUSTER,"lackluster" },
{ Rating::NEUTRAL, "neutral" },
{ Rating::OKAY, "okay" },
{ Rating::GOOD, "good" },
{ Rating::EXCELLENT, "excellent" },
{ Rating::SUPERB, "superb" },
{ Rating::AWFUL, "terrible" },
{ Rating::OKAY, "ok" },
{ Rating::UNRATED, nullptr }
}
@ POOR
2 star, 4 enum
@ AWFUL
1 star, 2 enum
@ NEUTRAL
3 star, 6 enum
@ GOOD
4 star, 8 enum
@ LACKLUSTER
2.5 star, 5 enum
@ OKAY
3.5 star, 7 enum
@ REPUGNANT
0.5 star, 1 enum
@ EXCELLENT
4.5 star, 9 enum
@ UNRATED
Unrated/no rating found, 0 enum.
@ SUPERB
5 star, 10 enum
@ BAD
1.5 star, 3 enum

Rating enumeration to text lookup values.