ft_irc/srcs/IrcMessage.cpp

63 lines
1.6 KiB
C++

#include "IrcMessage.hpp"
IrcMessage::IrcMessage(void) : _valid(false)
{
}
IrcMessage::IrcMessage(const IrcMessage &other)
{
*this = other;
}
IrcMessage &IrcMessage::operator=(const IrcMessage &other)
{
if (this != &other)
{
_prefix = other._prefix;
_command = other._command;
_params = other._params;
_raw = other._raw;
_valid = other._valid;
_error = other._error;
}
return (*this);
}
IrcMessage::~IrcMessage(void)
{
}
void IrcMessage::setPrefix(const std::string &prefix) { _prefix = prefix; }
void IrcMessage::setCommand(const std::string &command) { _command = command; }
void IrcMessage::addParam(const std::string &param) { _params.push_back(param); }
void IrcMessage::setRaw(const std::string &raw) { _raw = raw; }
void IrcMessage::setValid(bool valid) { _valid = valid; }
void IrcMessage::setError(const std::string &error) { _error = error; }
const std::string &IrcMessage::getPrefix(void) const { return (_prefix); }
const std::string &IrcMessage::getCommand(void) const { return (_command); }
const std::vector<std::string> &IrcMessage::getParams(void) const { return (_params); }
const std::string &IrcMessage::getRaw(void) const { return (_raw); }
bool IrcMessage::isValid(void) const { return (_valid); }
const std::string &IrcMessage::getError(void) const { return (_error); }
bool IrcMessage::hasPrefix(void) const
{
return (!_prefix.empty());
}
bool IrcMessage::hasParam(size_t index) const
{
return (index < _params.size());
}
const std::string &IrcMessage::param(size_t index) const
{
return (_params[index]);
}
size_t IrcMessage::paramCount(void) const
{
return (_params.size());
}