2018-04-30 23:30:05 +02:00
|
|
|
#include "command.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace controllers {
|
|
|
|
namespace commands {
|
|
|
|
|
|
|
|
// command
|
|
|
|
Command::Command(const QString &_text)
|
|
|
|
{
|
|
|
|
int index = _text.indexOf(' ');
|
|
|
|
|
|
|
|
if (index == -1) {
|
|
|
|
this->name = _text;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-06 00:32:45 +02:00
|
|
|
this->name = _text.mid(0, index).trimmed();
|
|
|
|
this->func = _text.mid(index + 1).trimmed();
|
2018-04-30 23:30:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Command::Command(const QString &_name, const QString &_func)
|
2018-05-06 00:32:45 +02:00
|
|
|
: name(_name.trimmed())
|
|
|
|
, func(_func.trimmed())
|
2018-04-30 23:30:05 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Command::toString() const
|
|
|
|
{
|
|
|
|
return this->name + " " + this->func;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace commands
|
|
|
|
} // namespace controllers
|
|
|
|
} // namespace chatterino
|