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-07-06 18:10:21 +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");
|
|
|
|
|
2018-07-06 18:10:21 +02:00
|
|
|
this->category_ = [&]() {
|
2018-10-21 13:43:02 +02:00
|
|
|
switch (providerId)
|
|
|
|
{
|
2018-05-28 08:34:54 +02:00
|
|
|
case ProviderId::Twitch:
|
|
|
|
return twitch;
|
|
|
|
}
|
|
|
|
return QString("Unknown ProviderId");
|
|
|
|
}();
|
2018-05-06 12:52:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Account::getCategory() const
|
|
|
|
{
|
2018-07-06 18:10:21 +02:00
|
|
|
return this->category_;
|
2018-05-06 12:52:47 +02:00
|
|
|
}
|
|
|
|
|
2018-05-28 08:34:54 +02:00
|
|
|
ProviderId Account::getProviderId() const
|
|
|
|
{
|
2018-07-06 18:10:21 +02:00
|
|
|
return this->providerId_;
|
2018-05-28 08:34:54 +02:00
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
2018-07-06 18:10:21 +02:00
|
|
|
return std::tie(this->category_, a) < std::tie(other.category_, b);
|
2018-05-06 12:52:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|