Encapsulate a chat event.
More...
#include <SimpleChatServer.h>
|
Type | type () const |
| Get the event type. More...
|
|
const Wt::WString & | user () const |
| Get the user who caused the event. More...
|
|
const Wt::WString & | message () const |
| Get the message of the event. More...
|
|
const Wt::WString & | data () const |
| Get the extra data for this event. More...
|
|
const Wt::WString | formattedHTML (const Wt::WString &user, Wt::TextFormat format) const |
| Get the message formatted as HTML, rendered for the given user. More...
|
|
Encapsulate a chat event.
Definition at line 30 of file SimpleChatServer.h.
ChatEvent::ChatEvent |
( |
const Wt::WString & |
user, |
|
|
const Wt::WString & |
message |
|
) |
| |
|
inlineprivate |
Definition at line 69 of file SimpleChatServer.h.
const Wt::WString & message() const
Get the message of the event.
const Wt::WString & user() const
Get the user who caused the event.
ChatEvent::ChatEvent |
( |
Type |
type, |
|
|
const Wt::WString & |
user, |
|
|
const Wt::WString & |
data = Wt::WString::Empty |
|
) |
| |
|
inlineprivate |
Definition at line 73 of file SimpleChatServer.h.
const Wt::WString & user() const
Get the user who caused the event.
Type type() const
Get the event type.
const Wt::WString & data() const
Get the extra data for this event.
const Wt::WString& ChatEvent::data |
( |
| ) |
const |
|
inline |
const WString ChatEvent::formattedHTML |
( |
const Wt::WString & |
user, |
|
|
Wt::TextFormat |
format |
|
) |
| const |
Get the message formatted as HTML, rendered for the given user.
The format
indicates how the message should be formatted.
Definition at line 15 of file SimpleChatServer.C.
20 return WString::fromUTF8(
"<span class='chat-info'>")
21 + WWebWidget::escapeText(
user_) +
" joined.</span>";
23 return WString::fromUTF8(
"<span class='chat-info'>")
25 WString::fromUTF8(
"You") :
26 WWebWidget::escapeText(
user_))
27 +
" logged out.</span>";
29 return "<span class='chat-info'>"
32 (WWebWidget::escapeText(
user_) +
" is"))
33 +
" now known as " + WWebWidget::escapeText(
data_) +
".</span>";
37 result = WString(
"<span class='")
41 +
"'>" + WWebWidget::escapeText(
user_) +
":</span>";
46 if (
message_.toUTF8().find(
user.toUTF8()) != std::string::npos)
47 return result +
"<span class='chat-highlight'>" + msg +
"</span>";
const Wt::WString & user() const
Get the user who caused the event.
const Wt::WString& ChatEvent::message |
( |
| ) |
const |
|
inline |
Type ChatEvent::type |
( |
| ) |
const |
|
inline |
const Wt::WString& ChatEvent::user |
( |
| ) |
const |
|
inline |
Wt::WString ChatEvent::data_ |
|
private |
Wt::WString ChatEvent::message_ |
|
private |
Wt::WString ChatEvent::user_ |
|
private |
The documentation for this class was generated from the following files: