tagparser/localeawarestring.h

86 lines
1.8 KiB
C
Raw Normal View History

2015-04-22 19:22:01 +02:00
#ifndef MEDIA_LOCALEAWARESTRING_H
#define MEDIA_LOCALEAWARESTRING_H
2016-08-29 15:43:05 +02:00
#include "./global.h"
2015-04-22 19:22:01 +02:00
#include <string>
#include <vector>
namespace Media {
2015-11-10 21:27:40 +01:00
/*!
* \brief The LocaleAwareString class is a standard string with locale information (languages, countries).
*/
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT LocaleAwareString : public std::string
2015-04-22 19:22:01 +02:00
{
public:
LocaleAwareString(const std::string &value = std::string());
2015-11-10 21:27:40 +01:00
LocaleAwareString(std::string &&value);
2015-04-22 19:22:01 +02:00
~LocaleAwareString();
const std::vector<std::string> &languages() const;
std::vector<std::string> &languages();
const std::vector<std::string> &countries() const;
std::vector<std::string> &countries();
private:
std::vector<std::string> m_languages;
2015-11-10 21:20:12 +01:00
std::vector<std::string> m_countries;
2015-04-22 19:22:01 +02:00
};
2015-11-10 21:27:40 +01:00
/*!
* \brief Constructs a new LocaleAwareString from the specified standard string.
*/
2015-04-22 19:22:01 +02:00
inline LocaleAwareString::LocaleAwareString(const std::string &value) :
std::string(value)
{}
2015-11-10 21:27:40 +01:00
/*!
* \brief Constructs a new LocaleAwareString from the specified standard string.
*/
inline LocaleAwareString::LocaleAwareString(std::string &&value) :
std::string(value)
{}
/*!
* \brief Destroys the instance.
*/
2015-04-22 19:22:01 +02:00
inline LocaleAwareString::~LocaleAwareString()
{}
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns associated languages.
*/
2015-04-22 19:22:01 +02:00
inline const std::vector<std::string> &LocaleAwareString::languages() const
{
return m_languages;
}
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns associated languages.
*/
2015-04-22 19:22:01 +02:00
inline std::vector<std::string> &LocaleAwareString::languages()
{
return m_languages;
}
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns associated countries.
*/
2015-04-22 19:22:01 +02:00
inline const std::vector<std::string> &LocaleAwareString::countries() const
{
2015-11-10 21:20:12 +01:00
return m_countries;
2015-04-22 19:22:01 +02:00
}
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns associated countries.
*/
2015-04-22 19:22:01 +02:00
inline std::vector<std::string> &LocaleAwareString::countries()
{
2015-11-10 21:20:12 +01:00
return m_countries;
2015-04-22 19:22:01 +02:00
}
} // namespace Media
#endif // MEDIA_LOCALEAWARESTRING_H