Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The Locale struct specifies a language and/or a country using one or more LocaleDetail objects. More...
#include <localehelper.h>
Public Member Functions | |
Locale ()=default | |
Locale (std::initializer_list< LocaleDetail > details) | |
Constructs a new locale with the specified details. | |
Locale (std::string &&value, LocaleFormat format) | |
Constructs a new locale with the specified value and format. | |
Locale (std::string_view value, LocaleFormat format) | |
Constructs a new locale with the specified value and format. | |
const LocaleDetail & | abbreviatedName (LocaleFormat format) const |
Returns the abbreviated name of the specified format. | |
template<typename LocaleFormat , typename... LocaleFormats> | |
const LocaleDetail & | abbreviatedName (LocaleFormat format, LocaleFormats... moreFormats) const |
Returns the abbreviated name of the specified format; if not present, checks moreFormats. | |
const LocaleDetail & | someAbbreviatedName (LocaleFormat preferredFormat=LocaleFormat::BCP_47) const |
Returns some abbreviated name, preferably of the specified preferredFormat. | |
const std::string & | fullName () const |
const std::string & | fullOrSomeAbbreviatedName () const |
Returns the full name if possible and otherwise falls back to the abbreviated name. | |
std::string | toString () const |
Returns all details as comma-separated string. | |
The Locale struct specifies a language and/or a country using one or more LocaleDetail objects.
Definition at line 61 of file localehelper.h.
|
explicitdefault |
|
inlineexplicit |
Constructs a new locale with the specified details.
Definition at line 91 of file localehelper.h.
|
inlineexplicit |
Constructs a new locale with the specified value and format.
Definition at line 99 of file localehelper.h.
|
inlineexplicit |
Constructs a new locale with the specified value and format.
Definition at line 108 of file localehelper.h.
const LocaleDetail & TagParser::Locale::abbreviatedName | ( | LocaleFormat | format | ) | const |
Returns the abbreviated name of the specified format.
This function returns the format if present. Otherwise it returns an empty string. This might be improved in the future, e.g. to convert to the specified format. It would also be possible to combine multiple details. For instance, if BCP-47 is required but only an ISO language and a domain name country are present, both could be combined and returned as BCP-47 abbreviation.
Definition at line 62 of file localehelper.cpp.
|
inline |
Returns the abbreviated name of the specified format; if not present, checks moreFormats.
Definition at line 79 of file localehelper.h.
const std::string & TagParser::Locale::fullName | ( | ) | const |
const std::string & TagParser::Locale::fullOrSomeAbbreviatedName | ( | ) | const |
Returns the full name if possible and otherwise falls back to the abbreviated name.
Definition at line 124 of file localehelper.cpp.
const LocaleDetail & TagParser::Locale::someAbbreviatedName | ( | LocaleFormat | preferredFormat = LocaleFormat::BCP_47 | ) | const |
Returns some abbreviated name, preferably of the specified preferredFormat.
This function returns the preferredFormat if present. Otherwise it returns the most relevant detail. This might be improved in the future, e.g. to convert to the preferredFormat. It would also be possible to combine multiple details. For instance, if BCP-47 is preferred but only an ISO language and a domain name country are present, both could be combined and returned as BCP-47 abbreviation.
Returns an empty string if no details are present.
Definition at line 85 of file localehelper.cpp.
std::string TagParser::Locale::toString | ( | ) | const |
Returns all details as comma-separated string.
Definition at line 135 of file localehelper.cpp.