|
PandoraBotIRC
1.0.0
An irc bot that acts as a Pandora chatter bot
|
IRCMessage class represents an IRC message that corresponds with irc protocol. More...
#include <IRCMessage.hpp>
Public Member Functions | |
| IRCMessage ()=default | |
| Default constructor. More... | |
| ~IRCMessage ()=default | |
| Default destructor. More... | |
| IRCMessage (std::string const &sender, std::string const &command, std::string const ¶ms, std::string const &data) | |
| Constructor (1) - Paremeter initialized. More... | |
| IRCMessage (std::string const &raw) | |
| Constructor (2) - Raw message initialized. More... | |
| IRCMessage (IRCMessage const &)=default | |
| Copy constructor is defaulted. More... | |
| IRCMessage & | operator= (IRCMessage const &rhs) |
| Assignment operator allows assignment between IRCMessages. More... | |
| bool | operator== (IRCMessage const &rhs) |
| Comparison operator allows comparison of IRCMessages. More... | |
| std::string | sender () const |
| Gets sender. More... | |
| std::string | command () const |
| Gets command. More... | |
| std::string | params () const |
| Gets params. More... | |
| std::string | data () const |
| Gets data. More... | |
| void | setSender (std::string const &sender) |
| Sets sender. More... | |
| void | setCommand (std::string const &command) |
| Sets command. More... | |
| void | setParams (std::string const ¶ms) |
| Sets params. More... | |
| void | setData (std::string const &data) |
| Sets data. More... | |
| template<typename... Params> | |
| void | addParams (std::string const &head, Params const &...tail) |
| Uses varargs to add parameters. More... | |
| void | addParams () |
| Edge condition for the recursive addParams . More... | |
| bool | empty () const |
| std::string | raw () const |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &os, IRCMessage const &rhs) |
| Global std::ostream operator<< overload for IRCMessages. More... | |
IRCMessage class represents an IRC message that corresponds with irc protocol.
IRC messages come in the form of ":<sender> <command> <params> :<data>\r\n" there may be multiple params, and data can be of any length. Sender, params, and data are optional fields.
IRCMessage may be constructed by raw IRC messages received from a server. This method will throw std::invalid_argument if the string supplied does not match the format of an IRC message.
You can construct IRCMessages two ways. You can initialize it with a raw irc message Or you can initialize it with parameters.
The above code should output:
The above code should output:
|
default |
Default constructor.
|
default |
Default destructor.
| pbirc::irc::IRCMessage::IRCMessage | ( | std::string const & | sender, |
| std::string const & | command, | ||
| std::string const & | params, | ||
| std::string const & | data | ||
| ) |
Constructor (1) - Paremeter initialized.
| [in] | sender | a string that contains the sender bit of the message |
| [in] | command | a string that contains the command bit of the message |
| [in] | params | a string that contains the parameters bit of the message |
| [in] | data | a string that contains the data bit of the message. |
|
explicit |
Constructor (2) - Raw message initialized.
This constructor takes a raw message received from an irc server and fills out the object accordingly.
| std::invalid_argument | if 'raw' does not match the syntax of an irc message. |
| [in] | raw | string that contains the raw irc protocol message |
|
default |
Copy constructor is defaulted.
|
inline |
Uses varargs to add parameters.
Allows for the syntax: addParams("Param1", "Param2", "Param3", ...). in the event that parameters need to be added one by one. (setParams does not allow this)
|
inline |
Edge condition for the recursive addParams .
|
inline |
Gets command.
|
inline |
Gets data.
| bool pbirc::irc::IRCMessage::empty | ( | ) | const |
| IRCMessage & pbirc::irc::IRCMessage::operator= | ( | IRCMessage const & | rhs | ) |
Assignment operator allows assignment between IRCMessages.
| bool pbirc::irc::IRCMessage::operator== | ( | IRCMessage const & | rhs | ) |
Comparison operator allows comparison of IRCMessages.
|
inline |
Gets params.
| std::string pbirc::irc::IRCMessage::raw | ( | ) | const |
|
inline |
Gets sender.
|
inline |
Sets command.
|
inline |
Sets data.
|
inline |
Sets params.
|
inline |
Sets sender.
|
related |
Global std::ostream operator<< overload for IRCMessages.
Outputs the IRC message in the following format:
Sender: Command: Params: Data: