ircproxy  The Ultimate Cyborg

WhoOptions Class Reference

#include <WhoRequest.h>

List of all members.


Detailed Description

A class representing the options that can be passed to a WhoRequest.

Definition at line 95 of file WhoRequest.h.


Public Member Functions

std::string const & flags (void) const
 Accessor for flags.
unsigned int fields (void) const
 Accessor for fields.
std::string const & querytype (void) const
 Accessor for querytype.
std::string str (void) const
 Return the reassembled options string.
bool matches_against_channel (void) const
 Return true if the mask is matched against channel names.

Private Attributes

std::string M_flags
 Everything up till the ''.
unsigned int M_fields
 Mask representing the fields, or 0 when no fields where given.
std::string M_querytype
 The query type, or empty when no query type was given.

Member Function Documentation

std::string const& WhoOptions::flags ( void   )  const [inline]

Accessor for flags.

Definition at line 106 of file WhoRequest.h.

References M_flags.

00106 { return M_flags; }

unsigned int WhoOptions::fields ( void   )  const [inline]

Accessor for fields.

Definition at line 108 of file WhoRequest.h.

References M_fields.

Referenced by Identity::new_server_message_received().

00108 { return M_fields; }

std::string const& WhoOptions::querytype ( void   )  const [inline]

Accessor for querytype.

Definition at line 110 of file WhoRequest.h.

References M_querytype.

00110 { return M_querytype; }

std::string WhoOptions::str ( void   )  const

Return the reassembled options string.

Definition at line 90 of file WhoRequest.cc.

References M_fields, M_flags, and M_querytype.

Referenced by operator<<(), and ServerSession::send_who_write_event().

00091 {
00092   std::string result(M_flags);
00093   if (M_fields != 0)
00094     result += '%';
00095   for (unsigned int field = 1; field < field_percentage; field <<= 1)
00096     if ((M_fields & field))
00097       switch(field)
00098       {
00099         case field_c:
00100           result += 'c';
00101           break;
00102         case field_d:
00103           result += 'd';
00104           break;
00105         case field_f:
00106           result += 'f';
00107           break;
00108         case field_h:
00109           result += 'h';
00110           break;
00111         case field_i:
00112           result += 'i';
00113           break;
00114         case field_l:
00115           result += 'l';
00116           break;
00117         case field_n:
00118           result += 'n';
00119           break;
00120         case field_r:
00121           result += 'r';
00122           break;
00123         case field_s:
00124           result += 's';
00125           break;
00126         case field_t:
00127           result += 't';
00128           break;
00129         case field_u:
00130           result += 'u';
00131           break;
00132         case field_a:
00133           result += 'a';
00134           break;
00135         case field_o:
00136           result += 'o';
00137           break;
00138       }
00139   if (!M_querytype.empty())
00140   {
00141     if (M_fields == 0)
00142       result += '%';
00143     result += ',';
00144     result += M_querytype;
00145   }
00146   return result;
00147 }

bool WhoOptions::matches_against_channel ( void   )  const

Return true if the mask is matched against channel names.

Definition at line 149 of file WhoRequest.cc.

References M_fields.

00150 {
00151   return (M_fields & ~field_percentage) == 0 || ((M_fields & field_c) == field_c);
00152 }


Member Data Documentation

std::string WhoOptions::M_flags [private]

Everything up till the ''.

Definition at line 97 of file WhoRequest.h.

Referenced by flags(), and str().

unsigned int WhoOptions::M_fields [private]

Mask representing the fields, or 0 when no fields where given.

Definition at line 98 of file WhoRequest.h.

Referenced by fields(), matches_against_channel(), and str().

std::string WhoOptions::M_querytype [private]

The query type, or empty when no query type was given.

Definition at line 99 of file WhoRequest.h.

Referenced by querytype(), and str().


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

Copyright © 2005-2007 Carlo Wood.  All rights reserved.