mirror-chatterino2/src/controllers/accounts/Account.cpp

44 lines
889 B
C++
Raw Normal View History

2018-05-06 12:52:47 +02:00
#include "account.hpp"
#include <tuple>
2018-05-06 12:52:47 +02:00
namespace chatterino {
namespace controllers {
namespace accounts {
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
{
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 accounts
} // namespace controllers
} // namespace chatterino