tagparser/size.cpp

32 lines
828 B
C++
Raw Normal View History

#include "./size.h"
namespace TagParser {
/*!
* \brief Returns an abbreviation for the current instance, eg. 720p for sizes greather than 1280×720
* and 1080p for sizes greather than 1920×1080.
*/
std::string_view Size::abbreviation() const
{
2018-03-07 01:17:50 +01:00
if (*this >= Size(7680, 4320)) {
return "8k";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(3840, 2160)) {
return "4k";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(1920, 1080)) {
return "1080p";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(1280, 720)) {
return "720p";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(704, 576)) {
return "576p";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(640, 480)) {
return "480p";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(480, 320)) {
return "320p";
2018-03-07 01:17:50 +01:00
} else if (*this >= Size(320, 240)) {
return "240p";
}
return "<240p";
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser