Design Pattern Examples
Overview of object-oriented design patterns
IMessageHandler Struct Referenceabstract

Represents a handler in a chain of handlers. All objects that participate in the HandlerChain class must implement this interface. More...

#include <HandlerChain_Class.h>

Inheritance diagram for IMessageHandler:
Inheritance graph
Collaboration diagram for IMessageHandler:
Collaboration graph

Public Types

using shared_ptr_t = std::shared_ptr< IMessageHandler >
 Alias to make it easier when using a shared pointer.
 

Public Member Functions

virtual ~IMessageHandler ()
 Virtual destructor (required for interfaces in C++)
 
virtual int ID ()=0
 ID of the window. This is used to uniquely identify a window in the collection.
 
virtual bool ProcessMessage (Message *message)=0
 Called with a message on each window.
 
virtual std::string ToString ()=0
 Convert the handler to a string.
 

Detailed Description

Represents a handler in a chain of handlers. All objects that participate in the HandlerChain class must implement this interface.

Definition at line 29 of file HandlerChain_Class.h.

Member Typedef Documentation

◆ shared_ptr_t

using shared_ptr_t = std::shared_ptr<IMessageHandler>

Alias to make it easier when using a shared pointer.

Definition at line 34 of file HandlerChain_Class.h.

Constructor & Destructor Documentation

◆ ~IMessageHandler()

virtual ~IMessageHandler ( )
inlinevirtual

Virtual destructor (required for interfaces in C++)

Definition at line 39 of file HandlerChain_Class.h.

Member Function Documentation

◆ ID()

virtual int ID ( )
pure virtual

ID of the window. This is used to uniquely identify a window in the collection.

Implemented in MessageWindow.

Referenced by HandlerChain::RemoveHandler(), and MessageWindow::ToString().

◆ ProcessMessage()

virtual bool ProcessMessage ( Message message)
pure virtual

Called with a message on each window.

Parameters
messageMessage object representing the message to process.
Returns
Returns true if the message was processed and the message should not be passed to subsequent windows. Returns false to indicate the message should be passed to subsequent windows.

Implemented in MessageWindow.

◆ ToString()

virtual std::string ToString ( )
pure virtual

Convert the handler to a string.

Returns
Returns a representation of the handler.

Implemented in MessageWindow.


The documentation for this struct was generated from the following file: