tagparser/localeawarestring.h

69 lines
1.3 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_LOCALEAWARESTRING_H
#define TAG_PARSER_LOCALEAWARESTRING_H
2015-04-22 19:22:01 +02:00
#include "./localehelper.h"
2015-04-22 19:22:01 +02:00
#include <string>
#include <vector>
namespace TagParser {
2015-04-22 19:22:01 +02:00
2015-11-10 21:27:40 +01:00
/*!
* \brief The LocaleAwareString class is a standard string with locale information (languages, countries).
*/
2018-03-07 01:17:50 +01:00
class TAG_PARSER_EXPORT LocaleAwareString : public std::string {
2015-04-22 19:22:01 +02:00
public:
explicit LocaleAwareString(const std::string &value = std::string());
explicit LocaleAwareString(std::string &&value);
2015-04-22 19:22:01 +02:00
~LocaleAwareString();
const Locale &locale() const;
Locale &locale();
2015-04-22 19:22:01 +02:00
private:
Locale m_locale;
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.
*/
2018-03-07 01:17:50 +01:00
inline LocaleAwareString::LocaleAwareString(const std::string &value)
: std::string(value)
{
}
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.
*/
2018-03-07 01:17:50 +01:00
inline LocaleAwareString::LocaleAwareString(std::string &&value)
: std::string(value)
{
}
2015-11-10 21:27:40 +01:00
/*!
* \brief Destroys the instance.
*/
2015-04-22 19:22:01 +02:00
inline LocaleAwareString::~LocaleAwareString()
2018-03-07 01:17:50 +01:00
{
}
2015-04-22 19:22:01 +02:00
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns the associated locale.
2015-11-10 21:27:40 +01:00
*/
inline const Locale &LocaleAwareString::locale() const
2015-04-22 19:22:01 +02:00
{
return m_locale;
2015-04-22 19:22:01 +02:00
}
2015-11-10 21:27:40 +01:00
/*!
* \brief Returns the associated locale.
2015-11-10 21:27:40 +01:00
*/
inline Locale &LocaleAwareString::locale()
2015-04-22 19:22:01 +02:00
{
return m_locale;
2015-04-22 19:22:01 +02:00
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2015-04-22 19:22:01 +02:00
#endif // TAG_PARSER_LOCALEAWARESTRING_H