ircproxy  The Ultimate Cyborg

UserAnswer Class Reference

#include <UserAnswer.h>

Inheritance diagram for UserAnswer:

UserAnswerEventType

List of all members.


Detailed Description

A user answer to a question.

Definition at line 31 of file UserAnswer.h.


Public Member Functions

 UserAnswer (std::string const &answer, ClientSession const &client_session, std::string const &target_name)
 Construct a UserAnswer with answer answer, target Network network and target name target_name.
std::string const & answer (void) const
 Returns the answer string.
std::string const & target_name (void) const
 Returns the name of the target that the answer is directed to.
bool is_match (boost::shared_ptr< Target > const &target) const
 Returns true if target is the same target that this answer is directed to.

Private Attributes

std::string M_answer
 The answer as typed by the user.
ClientSession const & M_client_session
 The client session that the answer is directed to.
std::string const & M_target_name
 The name of the target that the answer is directed to.

Friends

std::ostream & operator<< (std::ostream &os, UserAnswer const &answer)
 Write UserAnswer answer to os.

Constructor & Destructor Documentation

UserAnswer::UserAnswer ( std::string const &  answer,
ClientSession const &  client_session,
std::string const &  target_name 
) [inline]

Construct a UserAnswer with answer answer, target Network network and target name target_name.

Definition at line 38 of file UserAnswer.h.

00038                                                                                                          :
00039       M_answer(answer), M_client_session(client_session), M_target_name(target_name) { }
  //! Returns the answer string.


Member Function Documentation

std::string const& UserAnswer::answer ( void   )  const [inline]

Returns the answer string.

Definition at line 41 of file UserAnswer.h.

References M_answer.

Referenced by Identity::received_network_domain_answer(), and ServerConnection::received_server_port_answer().

00041 { return M_answer; }

std::string const& UserAnswer::target_name ( void   )  const [inline]

Returns the name of the target that the answer is directed to.

Definition at line 43 of file UserAnswer.h.

References M_target_name.

00043 { return M_target_name; }

bool UserAnswer::is_match ( boost::shared_ptr< Target > const &  target  )  const

Returns true if target is the same target that this answer is directed to.

Definition at line 70 of file UserAnswer.cc.

References IdentityReference::identity(), M_client_session, M_target_name, and Identity::network().

00071 {
00072   return &M_client_session.identity().network() == &target->network() &&
00073          M_target_name == target->in_name(M_client_session);
00074 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
UserAnswer const &  answer 
) [friend]

Write UserAnswer answer to os.

Definition at line 275 of file debug_ostream_operators.cc.

00276 {
00277   os << '{' << "answer:\"" << answer.M_answer;
00278   os << "\", client_session:" << answer.M_client_session;
00279   os << ", target:\"" << answer.M_target_name;
00280   os << "\"}";
00281   return os;
00282 }


Member Data Documentation

std::string UserAnswer::M_answer [private]

The answer as typed by the user.

Definition at line 33 of file UserAnswer.h.

Referenced by answer(), and operator<<().

The client session that the answer is directed to.

Definition at line 34 of file UserAnswer.h.

Referenced by is_match(), and operator<<().

std::string const& UserAnswer::M_target_name [private]

The name of the target that the answer is directed to.

Definition at line 35 of file UserAnswer.h.

Referenced by is_match(), operator<<(), and target_name().


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

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