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

41 lines
799 B
C++
Raw Normal View History

2018-06-26 14:09:39 +02:00
#include "Account.hpp"
2018-05-06 12:52:47 +02:00
#include <tuple>
2018-05-06 12:52:47 +02:00
namespace chatterino {
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_ = [&]() {
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
{
return this->category_;
2018-05-06 12:52:47 +02:00
}
2018-05-28 08:34:54 +02:00
ProviderId Account::getProviderId() const
{
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
{
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