2018-06-26 14:09:39 +02:00
|
|
|
#include "Account.hpp"
|
2018-05-06 12:52:47 +02:00
|
|
|
|
2018-05-26 20:25:00 +02:00
|
|
|
#include <tuple>
|
|
|
|
|
2018-05-06 12:52:47 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
2018-05-28 08:34:54 +02:00
|
|
|
Account::Account(ProviderId _providerId)
|
|
|
|
: providerId(_providerId)
|
2018-05-06 12:52:47 +02:00
|
|
|
{
|
2018-05-28 08:34:54 +02:00
|
|
|
static QString twitch("Twitch");
|
|
|
|
|
|
|
|
this->category = [&]() {
|
|
|
|
switch (_providerId) {
|
|
|
|
case ProviderId::Twitch:
|
|
|
|
return twitch;
|
|
|
|
}
|
|
|
|
return QString("Unknown ProviderId");
|
|
|
|
}();
|
2018-05-06 12:52:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Account::getCategory() const
|
|
|
|
{
|
|
|
|
return this->category;
|
|
|
|
}
|
|
|
|
|
2018-05-28 08:34:54 +02:00
|
|
|
ProviderId Account::getProviderId() const
|
|
|
|
{
|
|
|
|
return this->providerId;
|
|
|
|
}
|
|
|
|
|
2018-05-06 12:52:47 +02:00
|
|
|
bool Account::operator<(const Account &other) const
|
|
|
|
{
|
2018-05-26 20:25:00 +02:00
|
|
|
QString a = this->toString();
|
|
|
|
QString b = other.toString();
|
|
|
|
|
|
|
|
return std::tie(this->category, a) < std::tie(other.category, b);
|
2018-05-06 12:52:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|