Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The Popularity class contains a value for ID3v2's "Popularimeter" field. More...
#include <tagvalue.h>
Public Member Functions | |
bool | scaleTo (TagType targetScale) |
Scales the rating from the current scale to targetScale. | |
Popularity | scaled (TagType targetScale) const |
Same as Popularity::scaleTo() but returns a new object. | |
std::string | toString () const |
Returns the popularity as string in the format "rating" if only a rating is present or in the format "user|rating|play-counter" or an empty string if the popularity isEmpty(). | |
bool | isEmpty () const |
Returns whether the Popularity is empty. The scale and zero-values don't count. | |
bool | operator== (const Popularity &other) const |
Returns whether two instances are equal. | |
Static Public Member Functions | |
static Popularity | fromString (std::string_view str) |
Parses the popularity from str assuming the same format as toString() produces and sets TagType::Unspecified as scale. | |
static Popularity | fromString (std::string_view str, TagType scale) |
Public Attributes | |
std::string | user |
The user who gave the rating / played the file, e.g. identified by e-mail address. | |
double | rating = 0.0 |
The rating on a tag type specific scale. | |
std::uint64_t | playCounter = 0 |
Play counter specific to the user. | |
TagType | scale = TagType::Unspecified |
Specifies the scale used for rating by the tag defining that scale. | |
The Popularity class contains a value for ID3v2's "Popularimeter" field.
|
static |
Parses the popularity from str assuming the same format as toString() produces and sets TagType::Unspecified as scale.
So str is expected to contain a rating within the range of 1.0 and 5.0 or 0.0 to denote there's no rating.
Throws | ConversionException() if the format is invalid. |
Definition at line 1515 of file tagvalue.cpp.
|
static |
|
inline |
Returns whether the Popularity is empty. The scale and zero-values don't count.
Definition at line 91 of file tagvalue.h.
|
inline |
Returns whether two instances are equal.
Definition at line 100 of file tagvalue.h.
|
inline |
Same as Popularity::scaleTo() but returns a new object.
Definition at line 109 of file tagvalue.h.
bool TagParser::Popularity::scaleTo | ( | TagType | targetScale | ) |
Scales the rating from the current scale to targetScale.
Definition at line 1450 of file tagvalue.cpp.
std::string TagParser::Popularity::toString | ( | ) | const |
Returns the popularity as string in the format "rating" if only a rating is present or in the format "user|rating|play-counter" or an empty string if the popularity isEmpty().
Definition at line 1503 of file tagvalue.cpp.
std::uint64_t TagParser::Popularity::playCounter = 0 |
Play counter specific to the user.
Definition at line 78 of file tagvalue.h.
double TagParser::Popularity::rating = 0.0 |
The rating on a tag type specific scale.
Definition at line 76 of file tagvalue.h.
TagType TagParser::Popularity::scale = TagType::Unspecified |
Specifies the scale used for rating by the tag defining that scale.
Definition at line 82 of file tagvalue.h.
std::string TagParser::Popularity::user |
The user who gave the rating / played the file, e.g. identified by e-mail address.
Definition at line 74 of file tagvalue.h.