| 1 |
#ifndef HEADER_STRINGMSG_H |
| 2 |
#define HEADER_STRINGMSG_H |
| 3 |
|
| 4 |
#include "BaseMsg.h" |
| 5 |
#include "BaseListener.h" |
| 6 |
|
| 7 |
#include <string> |
| 8 |
|
| 9 |
/** |
| 10 |
* Message with string value. |
| 11 |
*/ |
| 12 |
class StringMsg : public BaseMsg { |
| 13 |
private: |
| 14 |
std::string m_value; |
| 15 |
public: |
| 16 |
CLONE(StringMsg); |
| 17 |
StringMsg(BaseListener *listener, const std::string &name, |
| 18 |
const std::string &value) |
| 19 |
: BaseMsg(listener->getName(), name), m_value(value) {} |
| 20 |
StringMsg(const std::string &listenerName, const std::string &name, |
| 21 |
const std::string &value) |
| 22 |
: BaseMsg(listenerName, name), m_value(value) {} |
| 23 |
|
| 24 |
virtual void sendActual(BaseListener *listener) const |
| 25 |
{ |
| 26 |
listener->receiveString(this); |
| 27 |
} |
| 28 |
const std::string &getValue() const { return m_value; } |
| 29 |
virtual std::string toString() const; |
| 30 |
}; |
| 31 |
|
| 32 |
|
| 33 |
#endif |