#include <GtpEngine.h>
Command handlers generate a GTP error response by throwing an instance of GtpFailure. It contains an internal string stream for building the reponse using stream output operators. To make formatting of responses with a temporary object more convenient, operator<< uses non-standard semantics, such that a new object is returned. Usage examples:
    // OK. Construct with string
    throw GtpFailure("message");
    // OK. Use temporary object
    throw GtpFailure() << message << ...;
    // NOT OK. Object is not modified, the return value of << is ignored
    GtpFailure failure;
    failure << message << ...;
    throw failure;
    // OK. Use the internal string stream
    GtpFailure failure;
    failure.ResponseStream() << message << ...;
    throw failure;
    
Definition at line 89 of file GtpEngine.h.
Public Member Functions | |
| GtpFailure () | |
| Construct with no message.   | |
| GtpFailure (const std::string &response) | |
| Construct with message.   | |
| GtpFailure (const GtpFailure &failure) | |
| Copy constructor.   | |
| ~GtpFailure () throw () | |
| Destructor.   | |
| std::string | Response () const | 
| Get the response.   | |
| std::ostream & | ResponseStream () | 
| Get the internal string stream.   | |
Private Attributes | |
| std::ostringstream | m_response | 
Related Functions | |
| (Note that these are not member functions.)  | |
| template<typename TYPE> | |
| GtpFailure | operator<< (const GtpFailure &failure, const TYPE &type) | 
| template<typename TYPE> | |
| GtpFailure | operator<< (const GtpFailure &failure, TYPE &type) | 
| GtpFailure | ( | ) | 
| GtpFailure | ( | const std::string & | response | ) | 
| GtpFailure | ( | const GtpFailure & | failure | ) | 
Copy constructor.
Needed for operator<<. Preserves the internal string stream format state.
Definition at line 402 of file GtpEngine.cpp.
References m_response, and Response().
| ~GtpFailure | ( | ) | throw () | 
| std::string Response | ( | ) | const | 
Get the response.
Returns a copy of the text in the internal string stream.
Definition at line 141 of file GtpEngine.h.
References m_response.
Referenced by GtpFailure(), and GtpEngine::HandleCommand().
| std::ostream & ResponseStream | ( | ) | 
Get the internal string stream.
Definition at line 146 of file GtpEngine.h.
References m_response.
Referenced by operator<<().
| GtpFailure operator<< | ( | const GtpFailure & | failure, | |
| TYPE & | type | |||
| ) |  [related] | 
        
Definition at line 134 of file GtpEngine.h.
References ResponseStream().
| GtpFailure operator<< | ( | const GtpFailure & | failure, | |
| const TYPE & | type | |||
| ) |  [related] | 
        
Definition at line 123 of file GtpEngine.h.
References ResponseStream().
std::ostringstream m_response [private]           | 
        
Definition at line 116 of file GtpEngine.h.
Referenced by GtpFailure(), Response(), and ResponseStream().