ircproxy The Ultimate Cyborg |
#include <MessageOut.h>
Definition at line 96 of file MessageOut.h.
Public Member Functions | |
MessageOut (Priority const &priority, msg_type type=unsafe_msg) | |
Construct a MessageOut object with Priority and Prefix. | |
MessageOut (PseudoMessageOut const &pseudo_message_out) | |
Construct a MessageOut object that represents a pseudo message. | |
MessageOut (MessageOut const &message) | |
Copy-constructor. | |
template<class SESSION> | |
void | write_to (std::ostream &os, SESSION const &session) const |
Write the message to an ostream. | |
Priority const & | priority (void) const |
Returns the priority of this message. | |
bool | is_pseudo_message (void) const |
Returns true if this is a pseudo message. | |
bool | is_safe (void) const |
Returns the true if the message can be sent to the server without first logging into X. | |
Private Attributes | |
boost::shared_ptr< MessageOutData > | M_data |
Shared pointer to the actual message data. | |
Friends | |
bool | operator< (MessageOut const &msg1, MessageOut const &msg2) |
Returns true if the priority of message msg1 is less than the priority of message msg2. | |
std::ostream & | operator<< (std::ostream &os, MessageOut const &message) |
For debugging purposes. Write a MessageOut to os. |
Construct a MessageOut object with Priority and Prefix.
Definition at line 102 of file MessageOut.h.
00102 : M_data(NEW(MessageOutData(priority, type))) { }
MessageOut::MessageOut | ( | PseudoMessageOut const & | pseudo_message_out | ) | [inline] |
Construct a MessageOut object that represents a pseudo message.
Definition at line 104 of file MessageOut.h.
00104 : M_data(pseudo_message_out.data()) { }
MessageOut::MessageOut | ( | MessageOut const & | message | ) | [inline] |
void MessageOut::write_to | ( | std::ostream & | os, | |
SESSION const & | session | |||
) | const [inline] |
Write the message to an ostream.
Definition at line 105 of file MessageOut.cc.
References ASSERT, DoutEntering, and M_data.
Referenced by ClientSession::queue_msg().
00106 { 00107 DoutEntering(dc::debug, "MessageOut<" << type_info_of<SESSION>().demangled_name() << ">::write_to(" << os << ", " << session << ") for " << *this); 00108 if (M_data->is_pseudo_message()) 00109 boost::static_pointer_cast<PseudoMessageOutData>(M_data)->M_pseudo_message_event_server.trigger(PseudoMessageEventType()); 00110 else 00111 { 00112 #ifndef CWDEBUG 00113 std::ostream& tmp(os); 00114 #else 00115 ASSERT(!os.fail()); 00116 std::stringstream tmp; 00117 #endif 00118 for (std::vector<boost::shared_ptr<JustInTimeToken> >::iterator iter = M_data->M_tokens.begin(); iter != M_data->M_tokens.end(); ++iter) 00119 (*iter)->write_to(tmp, session); 00120 tmp << "\r\n"; 00121 #ifdef CWDEBUG 00122 std::string result(tmp.str()); 00123 os << result; 00124 Dout(dc::debug, "Wrote string \"" << buf2str(result.data(), result.size()) << "\"."); 00125 #endif 00126 } 00127 }
Priority const& MessageOut::priority | ( | void | ) | const [inline] |
Returns the priority of this message.
Definition at line 116 of file MessageOut.h.
References M_data.
00116 { return M_data->M_priority; }
bool MessageOut::is_pseudo_message | ( | void | ) | const [inline] |
Returns true if this is a pseudo message.
Definition at line 119 of file MessageOut.h.
References M_data.
00119 { return M_data->is_pseudo_message(); }
bool MessageOut::is_safe | ( | void | ) | const [inline] |
Returns the true if the message can be sent to the server without first logging into X.
Definition at line 122 of file MessageOut.h.
References M_data.
00122 { return M_data->is_safe(); }
bool operator< | ( | MessageOut const & | msg1, | |
MessageOut const & | msg2 | |||
) | [friend] |
Returns true if the priority of message msg1 is less than the priority of message msg2.
Definition at line 125 of file MessageOut.h.
00126 { 00127 return msg1.M_data->M_priority < msg2.M_data->M_priority || 00128 (msg1.M_data->M_priority == msg2.M_data->M_priority && 00129 msg1.M_data->M_sequence_number > msg2.M_data->M_sequence_number); 00130 }
std::ostream& operator<< | ( | std::ostream & | os, | |
MessageOut const & | message | |||
) | [friend] |
For debugging purposes. Write a MessageOut to os.
Definition at line 466 of file debug_ostream_operators.cc.
boost::shared_ptr<MessageOutData> MessageOut::M_data [private] |
Shared pointer to the actual message data.
Definition at line 98 of file MessageOut.h.
Referenced by is_pseudo_message(), is_safe(), operator<<(), priority(), and write_to().
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|