irccd  3.0.3
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
irccd::daemon::irc::message Struct Reference

Describe a IRC message. More...

#include <irc.hpp>

Public Member Functions

template<typename Enum >
auto is (Enum e) const noexcept -> bool
 
auto get (unsigned short index) const noexcept -> const std::string &
 
auto is_ctcp (unsigned short index) const noexcept -> bool
 
auto ctcp (unsigned short index) const -> std::string
 

Static Public Member Functions

static auto parse (const std::string &line) -> message
 

Public Attributes

std::string prefix
 optional prefix More...
 
std::string command
 command (maybe string or code) More...
 
std::vector< std::string > args
 parameters More...
 

Detailed Description

Describe a IRC message.

Member Function Documentation

◆ ctcp()

auto irccd::daemon::irc::message::ctcp ( unsigned short  index) const -> std::string

Parse a CTCP message.

Precondition
is_ctcp(index)
Parameters
indexthe param index
Returns
the CTCP command

◆ get()

auto irccd::daemon::irc::message::get ( unsigned short  index) const -> const std::string &
noexcept

Convenient function that returns an empty string if the nth argument is not defined.

Parameters
indexthe index
Returns
a string or empty if out of bounds

◆ is()

template<typename Enum >
auto irccd::daemon::irc::message::is ( Enum  e) const -> bool
inlinenoexcept

Check if the command is of the given enum number.

Parameters
ethe code
Returns
true if command is a number and equals to e

◆ is_ctcp()

auto irccd::daemon::irc::message::is_ctcp ( unsigned short  index) const -> bool
noexcept

Tells if the message is a CTCP.

Parameters
indexthe param index (maybe out of bounds)
Returns
true if CTCP

◆ parse()

static auto irccd::daemon::irc::message::parse ( const std::string &  line) -> message
static

Parse a IRC message.

Parameters
linethe buffer content (without \r\n)
Returns
the message (maybe empty if line is empty)

Member Data Documentation

◆ args

std::vector<std::string> irccd::daemon::irc::message::args

parameters

◆ command

std::string irccd::daemon::irc::message::command

command (maybe string or code)

◆ prefix

std::string irccd::daemon::irc::message::prefix

optional prefix


The documentation for this struct was generated from the following file: