InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
Public Member Functions | List of all members
irc::modestacker Class Reference

#include <hashcomp.h>

Public Member Functions

 modestacker (bool add)
 
void Push (char modeletter, const std::string &parameter)
 
void Push (char modeletter)
 
void PushPlus ()
 
void PushMinus ()
 
int GetStackedLine (std::vector< std::string > &result, int max_line_size=360)
 
int GetStackedLine (std::deque< std::string > &result, int max_line_size=360)
 

Detailed Description

irc::modestacker stacks mode sequences into a list. It can then reproduce this list, clamped to a maximum of MAXMODES values per line.

Constructor & Destructor Documentation

irc::modestacker::modestacker ( bool  add)

Construct a new modestacker.

Parameters
addTrue if the stack is adding modes, false if it is removing them

Member Function Documentation

int irc::modestacker::GetStackedLine ( std::vector< std::string > &  result,
int  max_line_size = 360 
)

Return zero or more elements which form the mode line. This will be clamped to a max of MAXMODES items (MAXMODES-1 mode parameters and one mode sequence string), and max_line_size characters. As specified below, this function should be called in a loop until it returns zero, indicating there are no more modes to return.

Parameters
resultThe vector to populate. This will not be cleared before it is used.
max_line_sizeThe maximum size of the line to build, in characters, seperate to MAXMODES.
Returns
The number of elements in the deque. The function should be called repeatedly until it returns 0, in case there are multiple lines of mode changes to be obtained.
int irc::modestacker::GetStackedLine ( std::deque< std::string > &  result,
int  max_line_size = 360 
)
inline

deprecated compatability interface - TODO remove

void irc::modestacker::Push ( char  modeletter,
const std::string &  parameter 
)

Push a modeletter and its parameter onto the stack. No checking is performed as to if this mode actually requires a parameter. If you stack invalid mode sequences, they will be tidied if and when they are passed to a mode parser.

Parameters
modeletterThe mode letter to insert
parameterThe parameter for the mode
void irc::modestacker::Push ( char  modeletter)

Push a modeletter without parameter onto the stack. No checking is performed as to if this mode actually requires a parameter. If you stack invalid mode sequences, they will be tidied if and when they are passed to a mode parser.

Parameters
modeletterThe mode letter to insert
void irc::modestacker::PushMinus ( )

Push a '-' symbol onto the stack.

void irc::modestacker::PushPlus ( )

Push a '+' symbol onto the stack.


The documentation for this class was generated from the following files: